ghost-portal/packages/app-explorer/src/index.tsx
Jaco Greeff e6bced1d9a
Block explorer expanded (#801)
* Add extrinsic hash to detail display

* Move BlockByHash -> ByHash

* Query block by number

* isEmpty check fro block and header
2019-03-12 13:02:39 +01:00

73 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 { AppProps, BareProps, I18nProps } from '@polkadot/ui-app/types';
import './index.css';
import React from 'react';
import { Route, Switch } from 'react-router';
import Tabs, { TabItem } from '@polkadot/ui-app/Tabs';
import translate from './translate';
import BlockQuery from './BlockQuery';
import Main from './Main';
import NodeInfo from './NodeInfo';
type Props = AppProps & BareProps & I18nProps;
type State = {
items: Array<TabItem>
};
class ExplorerApp extends React.Component<Props, State> {
constructor (props: Props) {
super(props);
const { t } = this.props;
this.state = {
items: [
{
name: 'chain',
text: t('Chain info')
},
{
hasParams: true,
name: 'query',
text: t('Block query')
},
{
name: 'node',
text: t('Node info')
}
]
};
}
render () {
const { basePath } = this.props;
const { items } = this.state;
return (
<main className='explorer--App'>
<header>
<Tabs
basePath={basePath}
items={items}
/>
</header>
<Switch>
<Route path={`${basePath}/query/:value`} component={BlockQuery} />
<Route path={`${basePath}/query`} component={BlockQuery} />
<Route path={`${basePath}/node`} component={NodeInfo} />
<Route component={Main} />
</Switch>
</main>
);
}
}
export default translate(ExplorerApp);