ghost-portal/packages/app-explorer/src/BlockInfo/ByHash.tsx
Jaco Greeff f887f68cfb
Combine AddressSummary & Row (#1260)
* Combine AddressSummary & Row

* Cleanup address rendering

* Tiny tags cleanups

* Remove unused ui--AddressSummary overrides

* Column component

* Columar

* Cleanups

* Remove hot client

* Backport data padding
2019-06-02 10:13:38 +02:00

60 lines
1.7 KiB
TypeScript

// Copyright 2017-2019 @polkadot/app-explorer authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { I18nProps } from '@polkadot/ui-app/types';
import { ApiProps } from '@polkadot/ui-api/types';
import React from 'react';
import { HeaderExtended } from '@polkadot/api-derive';
import { EventRecord, SignedBlock } from '@polkadot/types';
import { withCalls } from '@polkadot/ui-api';
import { Columar } from '@polkadot/ui-app';
import BlockHeader from '../BlockHeader';
import translate from '../translate';
import Events from './Events';
import Extrinsics from './Extrinsics';
import Logs from './Logs';
type Props = ApiProps & I18nProps & {
system_events?: Array<EventRecord>,
chain_getBlock?: SignedBlock,
chain_getHeader?: HeaderExtended,
value: string
};
class BlockByHash extends React.PureComponent<Props> {
render () {
const { system_events, chain_getBlock, chain_getHeader } = this.props;
if (!chain_getBlock || chain_getBlock.isEmpty || !chain_getHeader || chain_getHeader.isEmpty) {
return null;
}
return (
<>
<header>
<BlockHeader
value={chain_getHeader}
withExplorer
/>
</header>
<Columar>
<Extrinsics value={chain_getBlock.block.extrinsics} />
<Events value={system_events} />
<Logs value={chain_getHeader.digest.logs} />
</Columar>
</>
);
}
}
export default translate(
withCalls<Props>(
['rpc.chain.getBlock', { paramName: 'value' }],
['derive.chain.getHeader', { paramName: 'value' }],
['query.system.events', { atProp: 'value' }]
)(BlockByHash)
);