Browse Source

sort desc tx history

all-modes
pbca26 8 years ago
parent
commit
167572feb8
  1. 7
      react/src/components/dashboard/walletsData.js
  2. 7
      react/src/components/dashboard/walletsNativeTxHistory.js
  3. 5
      react/src/util/sort.js

7
react/src/components/dashboard/walletsData.js

@ -2,6 +2,7 @@ import React from 'react';
import Config from '../../config';
import { translate } from '../../translate/translate';
import { secondsToString } from '../../util/time';
import { sortByDate } from '../../util/sort';
import {
basiliskRefresh,
basiliskConnection,
@ -156,7 +157,7 @@ class WalletsData extends React.Component {
this.setState({
[e.target.name]: e.target.value,
activePage: 1,
itemsList: historyToSplit,
itemsList: sortByDate(historyToSplit),
});
}
@ -171,7 +172,7 @@ class WalletsData extends React.Component {
historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage);
this.setState(Object.assign({}, this.state, {
itemsList: historyToSplit,
itemsList: sortByDate(historyToSplit),
}));
}
}
@ -189,7 +190,7 @@ class WalletsData extends React.Component {
this.setState(Object.assign({}, this.state, {
activePage: page,
itemsList: historyToSplit,
itemsList: sortByDate(historyToSplit),
}));
}

7
react/src/components/dashboard/walletsNativeTxHistory.js

@ -1,6 +1,7 @@
import React from 'react';
import { translate } from '../../translate/translate';
import { secondsToString } from '../../util/time';
import { sortByDate } from '../../util/sort';
import { toggleDashboardTxInfoModal } from '../../actions/actionCreators';
import Store from '../../store';
@ -31,7 +32,7 @@ class WalletsNativeTxHistory extends React.Component {
this.setState({
[e.target.name]: e.target.value,
activePage: 1,
itemsList: historyToSplit,
itemsList: sortByDate(historyToSplit),
});
}
@ -85,7 +86,7 @@ class WalletsNativeTxHistory extends React.Component {
historyToSplit = historyToSplit.slice((this.state.activePage - 1) * this.state.itemsPerPage, this.state.activePage * this.state.itemsPerPage);
this.setState(Object.assign({}, this.state, {
itemsList: historyToSplit,
itemsList: sortByDate(historyToSplit),
}));
}
}
@ -97,7 +98,7 @@ class WalletsNativeTxHistory extends React.Component {
this.setState(Object.assign({}, this.state, {
activePage: page,
itemsList: historyToSplit,
itemsList: sortByDate(historyToSplit),
}));
}

5
react/src/util/sort.js

@ -0,0 +1,5 @@
export function sortByDate(data) {
return data.sort(function(a, b){
return new Date(b.blocktime || b.timestamp) - new Date(a.blocktime || a.timestamp);
});
}
Loading…
Cancel
Save