conflict in transactions

This commit is contained in:
Jonathan Rainville 2018-10-24 10:45:06 -04:00
parent 2ed2f9388b
commit bc0a89fd6d
4 changed files with 59 additions and 39 deletions

View File

@ -1,9 +1,17 @@
import PropTypes from "prop-types";
import React from 'react'; import React from 'react';
import {CardTitle} from 'reactstrap'; import {CardTitle} from 'reactstrap';
import Blockies from 'react-blockies'; import Blockies from 'react-blockies';
const CardTitleIdenticon = ({id, children}) => ( const CardTitleIdenticon = ({id, children}) => (
<CardTitle><Blockies seed={id} className="rounded"/><span className="ml-2 align-top">{children}</span></CardTitle> <CardTitle>
) <Blockies seed={id} className="rounded"/><span className="ml-2 align-top text-truncate">{children}</span>
</CardTitle>
);
export default CardTitleIdenticon CardTitleIdenticon.propTypes = {
id: PropTypes.string,
children: PropTypes.object
};
export default CardTitleIdenticon;

View File

@ -7,3 +7,8 @@
.dark-theme .explorer-row { .dark-theme .explorer-row {
border-bottom-color: #23282c; border-bottom-color: #23282c;
} }
.explorer-row .text-truncate {
width: 90%;
display: inline-block;
}

View File

@ -4,21 +4,23 @@ import {Row, Col, Card, CardHeader, CardBody} from 'reactstrap';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import CardTitleIdenticon from './CardTitleIdenticon'; import CardTitleIdenticon from './CardTitleIdenticon';
import LoadMore from "./LoadMore";
const Transactions = ({transactions}) => ( const Transactions = ({transactions, showLoadMore, loadMore}) => (
<Row> <Row>
<Col> <Col>
<h1>Transactions</h1> <Card>
{transactions.map(transaction => (
<Card key={transaction.hash}>
<CardHeader> <CardHeader>
<h1>Transactions</h1>
</CardHeader>
<CardBody>
{transactions.map(transaction => (
<div className="explorer-row" key={transaction.hash}>
<CardTitleIdenticon id={transaction.hash}>Transaction&nbsp; <CardTitleIdenticon id={transaction.hash}>Transaction&nbsp;
<Link to={`/embark/explorer/transactions/${transaction.hash}`}> <Link to={`/embark/explorer/transactions/${transaction.hash}`}>
{transaction.hash} {transaction.hash}
</Link> </Link>
</CardTitleIdenticon> </CardTitleIdenticon>
</CardHeader>
<CardBody>
<Row> <Row>
<Col> <Col>
<strong>Block number</strong> <strong>Block number</strong>
@ -37,15 +39,19 @@ const Transactions = ({transactions}) => (
<div>{transaction.to ? "Contract Call" : "Contract Creation"}</div> <div>{transaction.to ? "Contract Call" : "Contract Creation"}</div>
</Col> </Col>
</Row> </Row>
</div>
))}
{showLoadMore && <LoadMore loadMore={() => loadMore()} />}
</CardBody> </CardBody>
</Card> </Card>
))}
</Col> </Col>
</Row> </Row>
); );
Transactions.propTypes = { Transactions.propTypes = {
transactions: PropTypes.arrayOf(PropTypes.object) transactions: PropTypes.arrayOf(PropTypes.object),
showLoadMore: PropTypes.bool,
loadMore: PropTypes.func
}; };
export default Transactions; export default Transactions;

View File

@ -3,6 +3,7 @@ import {connect} from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import {transactions as transactionsAction, initBlockHeader, stopBlockHeader} from '../actions'; import {transactions as transactionsAction, initBlockHeader, stopBlockHeader} from '../actions';
import Blocks from "../components/Blocks";
import LoadMore from "../components/LoadMore"; import LoadMore from "../components/LoadMore";
import Transactions from '../components/Transactions'; import Transactions from '../components/Transactions';
import DataWrapper from "../components/DataWrapper"; import DataWrapper from "../components/DataWrapper";
@ -34,9 +35,9 @@ class TransactionsContainer extends Component {
return ( return (
<React.Fragment> <React.Fragment>
<DataWrapper shouldRender={this.props.transactions.length > 0} {...this.props} render={({transactions}) => ( <DataWrapper shouldRender={this.props.transactions.length > 0} {...this.props} render={({transactions}) => (
<Transactions transactions={transactions} /> <Transactions transactions={transactions}
showLoadMore={(this.loadMoreFrom() >= 0)} loadMore={() => this.loadMore()} />
)} /> )} />
{(this.loadMoreFrom() > 0) ? <LoadMore loadMore={() => this.loadMore()} /> : <React.Fragment />}
</React.Fragment> </React.Fragment>
); );
} }