This commit is contained in:
Iuri Matias 2018-10-16 22:28:36 -04:00 committed by Pascal Precht
parent cc88b846aa
commit 6fd6988b0f
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
4 changed files with 60 additions and 22 deletions

View File

@ -1,13 +1,23 @@
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import React from 'react'; import React from 'react';
import {Row, Col} from "reactstrap"; import {Row, Col, Card, CardBody, CardTitle} from "reactstrap";
import ContractsList from './ContractsList'; import ContractsList from './ContractsList';
const Contracts = ({contracts, title = "Contracts"}) => ( const Contracts = ({contracts, title = "Contracts"}) => (
<Row> <Row>
<Col> <Col>
<h1>{title}</h1> <Card>
<CardBody>
<Row>
<Col sm="5">
<CardTitle className="mb-0">Contracts</CardTitle>
</Col>
</Row>
<div style={{ marginTop: 40 + 'px' }}>
<ContractsList contracts={contracts}></ContractsList> <ContractsList contracts={contracts}></ContractsList>
</div>
</CardBody>
</Card>
</Col> </Col>
</Row> </Row>
); );

View File

@ -5,8 +5,8 @@ import {Link} from 'react-router-dom';
import {formatContractForDisplay} from '../utils/presentation'; import {formatContractForDisplay} from '../utils/presentation';
const ContractsList = ({contracts}) => ( const ContractsList = ({contracts}) => (
<Table responsive className="text-nowrap"> <Table hover responsive className="table-outline mb-0 d-none d-sm-table text-nowrap">
<thead> <thead className="thead-light">
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Address</th> <th>Address</th>

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { DropdownItem, DropdownMenu, DropdownToggle, Nav, Container } from 'reactstrap'; import { DropdownItem, DropdownMenu, DropdownToggle, Nav, NavItem, NavLink, Container } from 'reactstrap';
import {LIGHT_THEME, DARK_THEME} from '../constants'; import {LIGHT_THEME, DARK_THEME} from '../constants';
import FontAwesome from 'react-fontawesome'; import FontAwesome from 'react-fontawesome';
@ -19,7 +19,7 @@ import {
AppHeaderDropdown AppHeaderDropdown
} from '@coreui/react'; } from '@coreui/react';
import logo from '../images/logo.png'; import logo from '../images/logo-new.svg';
const sidebarNavItems = {items: [ const sidebarNavItems = {items: [
{name: "Dashboard", url: "/embark", icon: 'fa fa-tachometer'}, {name: "Dashboard", url: "/embark", icon: 'fa fa-tachometer'},
@ -31,7 +31,7 @@ const sidebarNavItems = {items: [
{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"}
]}, ]},
{name: "Fiddle", url: "/embark/fiddle", icon: "fa fa-codepen"}, {name: "Editor", url: "/embark/fiddle", icon: "fa fa-codepen"},
{name: "Documentation", url: "/embark/documentation", icon: "fa fa-book"}, {name: "Documentation", url: "/embark/documentation", icon: "fa fa-book"},
{name: "Utils", url: "/embark/utilities/converter", icon: "fa fa-cog", children: [ {name: "Utils", url: "/embark/utilities/converter", icon: "fa fa-cog", children: [
{url: "/embark/utilities/converter", icon: "fa fa-plug", name: "Converter"}, {url: "/embark/utilities/converter", icon: "fa fa-plug", name: "Converter"},
@ -42,7 +42,7 @@ const sidebarNavItems = {items: [
]}; ]};
const Layout = ({children, logout, credentials, location, toggleTheme, currentTheme}) => ( const Layout = ({children, logout, credentials, location, toggleTheme, currentTheme}) => (
<div className="app"> <div className="app animated fadeIn">
<AppHeader fixed> <AppHeader fixed>
<AppSidebarToggler className="d-lg-none" display="md" mobile /> <AppSidebarToggler className="d-lg-none" display="md" mobile />
<AppNavbarBrand <AppNavbarBrand
@ -50,6 +50,15 @@ const Layout = ({children, logout, credentials, location, toggleTheme, currentTh
minimized={{ src: logo, width: 30, height: 30, alt: 'Embark Logo' }} minimized={{ src: logo, width: 30, height: 30, alt: 'Embark Logo' }}
/> />
<AppSidebarToggler className="d-md-down-none" display="lg" /> <AppSidebarToggler className="d-md-down-none" display="lg" />
<Nav className="d-md-down-none" navbar>
{sidebarNavItems.items.map((item) => {
return (
<NavItem className="px-3">
<NavLink href={item.url}>{item.name}</NavLink>
</NavItem>
)
})}
</Nav>
<Nav className="ml-auto" navbar> <Nav className="ml-auto" navbar>
<AppHeaderDropdown direction="down"> <AppHeaderDropdown direction="down">
<DropdownToggle nav> <DropdownToggle nav>
@ -74,7 +83,7 @@ const Layout = ({children, logout, credentials, location, toggleTheme, currentTh
<AppSidebarMinimizer /> <AppSidebarMinimizer />
</AppSidebar> </AppSidebar>
<main className="main"> <main className="main">
<Container fluid className="h-100"> <Container fluid className="h-100" style={{"margin-top": '24px'}}>
{children} {children}
</Container> </Container>
</main> </main>

View File

@ -2,6 +2,12 @@ import PropTypes from "prop-types";
import React, {Component} from 'react'; import React, {Component} from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {
Card,
CardHeader,
CardBody
} from 'reactstrap';
import { import {
contracts as contractsAction, contracts as contractsAction,
commands as commandsAction, commands as commandsAction,
@ -53,17 +59,28 @@ class HomeContainer extends Component {
render() { render() {
return ( return (
<React.Fragment> <React.Fragment>
<h1 className="my-5">Dashboard</h1>
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes}) => ( <DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes}) => (
<Processes processes={processes} /> <Processes processes={processes} />
)} /> )} />
<DataWrapper shouldRender={this.props.contracts.length > 0} {...this.props} render={({contracts}) => ( <DataWrapper shouldRender={this.props.contracts.length > 0} {...this.props} render={({contracts}) => (
<Card>
<CardHeader>
Deployed Contracts
</CardHeader>
<CardBody>
<div style={{maxHeight: '227px', marginBottom: '1.5rem', overflow: 'auto'}}> <div style={{maxHeight: '227px', marginBottom: '1.5rem', overflow: 'auto'}}>
<ContractsList contracts={contracts} /> <ContractsList contracts={contracts} />
</div> </div>
</CardBody>
</Card>
)} /> )} />
<DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes, postCommand, postCommandSuggestions, processLogs, commandSuggestions}) => ( <DataWrapper shouldRender={this.props.processes.length > 0 } {...this.props} render={({processes, postCommand, postCommandSuggestions, processLogs, commandSuggestions}) => (
<Card>
<CardHeader>
Logs & Console
</CardHeader>
<CardBody>
<Console activeProcess={this.state.activeProcess} <Console activeProcess={this.state.activeProcess}
postCommand={postCommand} postCommand={postCommand}
postCommandSuggestions={postCommandSuggestions} postCommandSuggestions={postCommandSuggestions}
@ -72,6 +89,8 @@ class HomeContainer extends Component {
commandSuggestions={commandSuggestions} commandSuggestions={commandSuggestions}
isEmbark={() => this.isEmbark} isEmbark={() => this.isEmbark}
updateTab={processName => this.updateTab(processName)} /> updateTab={processName => this.updateTab(processName)} />
</CardBody>
</Card>
)} /> )} />
</React.Fragment> </React.Fragment>
); );