Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Display failed transactions in transactions tab
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Oct 9, 2017
1 parent 696b4d8 commit ccedb70
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/components/transactions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import Transactions from './transactions';
const mapStateToProps = state => ({
address: state.account.address,
activePeer: state.peers.data,
transactions: [...state.transactions.pending, ...state.transactions.confirmed],
transactions: [
...state.transactions.pending,
...state.transactions.failed,
...state.transactions.confirmed,
],
count: state.transactions.count,
confirmedCount: state.transactions.confirmed.length,
pendingCount: state.transactions.pending.length,
Expand Down
4 changes: 3 additions & 1 deletion src/components/transactions/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ describe('TransactionsHOC', () => {
let wrapper;
const confirmed = [];
const pending = [];
const failed = [];
const transactions = {
pending,
failed,
confirmed,
count: confirmed.length,
};
Expand Down Expand Up @@ -46,7 +48,7 @@ describe('TransactionsHOC', () => {
const props = wrapper.find('Transactions').props();
expect(props.address).to.be.equal(account.address);
expect(props.activePeer).to.be.equal(peers.data);
expect(props.transactions).to.deep.equal([...transactions, ...pending]);
expect(props.transactions).to.deep.equal([...pending, ...failed, ...confirmed]);
expect(props.count).to.be.equal(transactions.count);
expect(props.confirmedCount).to.be.equal(confirmed.length);
expect(props.pendingCount).to.be.equal(pending.length);
Expand Down
6 changes: 5 additions & 1 deletion src/components/transactions/transactionRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import Status from './status';
import Amount from './amount';
import Spinner from '../spinner';

const setRowClass = tx => (
tx.failed && styles.failedTransaction
);

class TransactionRow extends React.Component {
// eslint-disable-next-line class-methods-use-this
shouldComponentUpdate(nextProps) {
Expand All @@ -17,7 +21,7 @@ class TransactionRow extends React.Component {

render() {
const props = this.props;
return (<tr>
return (<tr className={`${setRowClass(props.value)}`}>
<td className={`${props.tableStyle.rowCell} ${styles.centerText}`}>
{props.value.confirmations ?
<TooltipTime label={props.value.timestamp}></TooltipTime> :
Expand Down
4 changes: 4 additions & 0 deletions src/components/transactions/transactions.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
background: color(var(--in) alpha(45%)) !important;
}

.failedTransaction {
background-color: rgb(255, 228, 220) !important;
}

.empty {
color: #777;
text-align: center;
Expand Down

0 comments on commit ccedb70

Please sign in to comment.