Add explorer overview page

Explorer “dashboard” or overview page has been added to give an overview of what can be seen on the individual explorer pages.

Needs work for exact routes not highlighting the overview page.
This commit is contained in:
emizzle 2018-10-16 09:36:29 +11:00 committed by Pascal Precht
parent 60bb3b5b4a
commit b27caad7a4
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
4 changed files with 85 additions and 11 deletions

View File

@ -0,0 +1,34 @@
import React from 'react';
import {
Page,
Grid
} from "tabler-react";
import AccountsContainer from '../containers/AccountsContainer';
import BlocksContainer from '../containers/BlocksContainer';
import TransactionsContainer from '../containers/TransactionsContainer';
const ExplorerDashboardLayout = () => (
<React.Fragment>
<Grid.Row md={12}>
<Grid.Col>
<Page.Title className="my-5">Explorer</Page.Title>
</Grid.Col>
</Grid.Row>
<Grid.Row>
<Grid.Col className="pl-md-0 pr-md-0 ml-md-0 mr-md-0 pr-lg-3 mr-lg-3 pl-lg-2 ml-lg-2">
<AccountsContainer />
</Grid.Col>
</Grid.Row>
<Grid.Row>
<Grid.Col md={6}>
<BlocksContainer />
</Grid.Col>
<Grid.Col md={6}>
<TransactionsContainer />
</Grid.Col>
</Grid.Row>
</React.Fragment>
);
export default ExplorerDashboardLayout;

View File

@ -1,5 +1,10 @@
import React from 'react'; import React from 'react';
import {Route, Switch} from 'react-router-dom'; import {NavLink, Route, Switch} from 'react-router-dom';
import {
Page,
Grid,
List
} from "tabler-react";
import AccountsContainer from '../containers/AccountsContainer'; import AccountsContainer from '../containers/AccountsContainer';
import AccountContainer from '../containers/AccountContainer'; import AccountContainer from '../containers/AccountContainer';
@ -8,7 +13,37 @@ import BlockContainer from '../containers/BlockContainer';
import TransactionsContainer from '../containers/TransactionsContainer'; import TransactionsContainer from '../containers/TransactionsContainer';
import TransactionContainer from '../containers/TransactionContainer'; import TransactionContainer from '../containers/TransactionContainer';
const groupItems = [
{to: "/embark/explorer", icon: "compass", value: "Overview", exact: true},
{to: "/embark/explorer/accounts", icon: "users", value: "Accounts"},
{to: "/embark/explorer/blocks", icon: "book-open", value: "Blocks"},
{to: "/embark/explorer/transactions", icon: "activity", value: "Transactions"}
];
const className = "d-flex align-items-center";
const ExplorerLayout = () => ( const ExplorerLayout = () => (
<Grid.Row>
<Grid.Col md={3}>
<Page.Title className="my-5">Explorer</Page.Title>
<div>
<List.Group transparent={true}>
{groupItems.map((groupItem) => (
<List.GroupItem
key={groupItem.value}
className={className}
to={groupItem.to}
icon={groupItem.icon}
RootComponent={NavLink}
exact={groupItem.exact || false}
>
{groupItem.value}
</List.GroupItem>
))}
</List.Group>
</div>
</Grid.Col>
<Grid.Col md={9}>
<Switch> <Switch>
<Route exact path="/embark/explorer/accounts" component={AccountsContainer} /> <Route exact path="/embark/explorer/accounts" component={AccountsContainer} />
<Route exact path="/embark/explorer/accounts/:address" component={AccountContainer} /> <Route exact path="/embark/explorer/accounts/:address" component={AccountContainer} />
@ -17,6 +52,8 @@ const ExplorerLayout = () => (
<Route exact path="/embark/explorer/transactions" component={TransactionsContainer} /> <Route exact path="/embark/explorer/transactions" component={TransactionsContainer} />
<Route exact path="/embark/explorer/transactions/:hash" component={TransactionContainer} /> <Route exact path="/embark/explorer/transactions/:hash" component={TransactionContainer} />
</Switch> </Switch>
</Grid.Col>
</Grid.Row>
); );
export default ExplorerLayout; export default ExplorerLayout;

View File

@ -23,7 +23,8 @@ const sidebarNavItems = {items: [
{name: "Dashboard", url: "/embark", icon: 'fa fa-tachometer'}, {name: "Dashboard", url: "/embark", icon: 'fa fa-tachometer'},
{name: "Deployment", url: "/embark/deployment", icon: "fa fa-arrow-up"}, {name: "Deployment", url: "/embark/deployment", icon: "fa fa-arrow-up"},
{name: "Contracts", url: "/embark/contracts", icon: "fa fa-file-text"}, {name: "Contracts", url: "/embark/contracts", icon: "fa fa-file-text"},
{name: "Explorer", url: "/embark/explorer/accounts", icon: "fa fa-signal", children: [ {name: "Explorer", url: "/embark/explorer", icon: "fa fa-signal", children: [
{url: "/embark/explorer", icon: "fa fa-compass", name: "Overview", exact: true},
{url: "/embark/explorer/accounts", icon: "fa fa-users", name: "Accounts"}, {url: "/embark/explorer/accounts", icon: "fa fa-users", name: "Accounts"},
{url: "/embark/explorer/blocks", icon: "fa fa-stop", name: "Blocks"}, {url: "/embark/explorer/blocks", icon: "fa fa-stop", name: "Blocks"},
{url: "/embark/explorer/transactions", icon: "fa fa-tree", name: "Transactions"}, {url: "/embark/explorer/transactions", icon: "fa fa-tree", name: "Transactions"},

View File

@ -6,6 +6,7 @@ import ContractsContainer from './containers/ContractsContainer';
import ContractLayoutContainer from './containers/ContractLayoutContainer'; import ContractLayoutContainer from './containers/ContractLayoutContainer';
import DeploymentContainer from './containers/DeploymentContainer'; import DeploymentContainer from './containers/DeploymentContainer';
import NoMatch from './components/NoMatch'; import NoMatch from './components/NoMatch';
import ExplorerDashboardLayout from './components/ExplorerDashboardLayout';
import ExplorerLayout from './components/ExplorerLayout'; import ExplorerLayout from './components/ExplorerLayout';
import FiddleLayout from './components/FiddleLayout'; import FiddleLayout from './components/FiddleLayout';
import UtilsLayout from './components/UtilsLayout'; import UtilsLayout from './components/UtilsLayout';
@ -14,7 +15,8 @@ const routes = (
<React.Fragment> <React.Fragment>
<Switch> <Switch>
<Route exact path="/embark/" component={HomeContainer} /> <Route exact path="/embark/" component={HomeContainer} />
<Route path="/embark/explorer/" component={ExplorerLayout} /> <Route exact path="/embark/explorer" component={ExplorerDashboardLayout} />
<Route path="/embark/explorer" component={ExplorerLayout} />
<Route path="/embark/deployment/" component={DeploymentContainer} /> <Route path="/embark/deployment/" component={DeploymentContainer} />
<Route path="/embark/contracts/:contractName" component={ContractLayoutContainer} /> <Route path="/embark/contracts/:contractName" component={ContractLayoutContainer} />
<Route path="/embark/contracts" component={ContractsContainer} /> <Route path="/embark/contracts" component={ContractsContainer} />