conflict in blocks

This commit is contained in:
Jonathan Rainville 2018-10-24 10:42:06 -04:00
parent 7eb87f1a25
commit 2ed2f9388b
4 changed files with 48 additions and 37 deletions

View File

@ -4,26 +4,24 @@ import {Row, Col, Card, CardHeader, CardBody} from 'reactstrap';
import PropTypes from 'prop-types';
import CardTitleIdenticon from './CardTitleIdenticon';
import LoadMore from "./LoadMore";
const Blocks = ({blocks}) => (
const Blocks = ({blocks, showLoadMore, loadMore}) => (
<Row>
<Col>
<h1>Blocks</h1>
{blocks.map(block => (
<Card key={block.number}>
<Card>
<CardHeader>
<h1>Blocks</h1>
</CardHeader>
<CardBody>
{blocks.map(block => (
<div className="explorer-row" key={block.number}>
<CardTitleIdenticon id={block.hash}>Block&nbsp;
<Link to={`/embark/explorer/blocks/${block.number}`}>
<Link className="align-top" to={`/embark/explorer/blocks/${block.number}`}>
{block.number}
</Link>
</CardTitleIdenticon>
</CardHeader>
<CardBody>
<Row>
<Col>
<strong>Number</strong>
<div>{block.number}</div>
</Col>
<Col>
<strong>Mined On</strong>
<div>{new Date(block.timestamp * 1000).toLocaleString()}</div>
@ -37,15 +35,19 @@ const Blocks = ({blocks}) => (
<div>{block.transactions.length}</div>
</Col>
</Row>
</div>
))}
{showLoadMore && <LoadMore loadMore={() => loadMore()} />}
</CardBody>
</Card>
))}
</Col>
</Row>
);
Blocks.propTypes = {
blocks: PropTypes.arrayOf(PropTypes.object)
blocks: PropTypes.arrayOf(PropTypes.object),
showLoadMore: PropTypes.bool,
loadMore: PropTypes.func
};
export default Blocks;

View File

@ -0,0 +1,9 @@
.explorer-row {
margin-bottom: 20px;
padding-bottom: 5px;
border-bottom: 1px solid #c8ced3;
}
.dark-theme .explorer-row {
border-bottom-color: #23282c;
}

View File

@ -8,6 +8,8 @@ import AccountsContainer from '../containers/AccountsContainer';
import BlocksContainer from '../containers/BlocksContainer';
import TransactionsContainer from '../containers/TransactionsContainer';
import './Explorer.css';
const ExplorerDashboardLayout = () => (
<React.Fragment>
<Row>

View File

@ -5,7 +5,6 @@ import PropTypes from 'prop-types';
import {blocks as blocksAction, initBlockHeader, stopBlockHeader} from '../actions';
import Blocks from '../components/Blocks';
import DataWrapper from "../components/DataWrapper";
import LoadMore from "../components/LoadMore";
import {getBlocks} from "../reducers/selectors";
class BlocksContainer extends Component {
@ -34,9 +33,8 @@ class BlocksContainer extends Component {
return (
<React.Fragment>
<DataWrapper shouldRender={this.props.blocks.length > 0} {...this.props} render={({blocks}) => (
<Blocks blocks={blocks} />
<Blocks blocks={blocks} showLoadMore={(this.loadMoreFrom() >= 0)} loadMore={() => this.loadMore()} />
)} />
{(this.loadMoreFrom() >= 0) ? <LoadMore loadMore={() => this.loadMore()} /> : <React.Fragment />}
</React.Fragment>
);
}