diff --git a/src/js/pages/MyProfile/components/Trades.jsx b/src/js/pages/MyProfile/components/Trades.jsx index 7575af85..da4ca824 100644 --- a/src/js/pages/MyProfile/components/Trades.jsx +++ b/src/js/pages/MyProfile/components/Trades.jsx @@ -13,6 +13,8 @@ import {ARBITRATION_SOLVED_BUYER, ARBITRATION_SOLVED_SELLER} from "../../../feat import './Trades.scss'; +const COMPLETED_STATES = [tradeStates.expired, tradeStates.canceled, tradeStates.arbitration_closed, tradeStates.released]; + const getTradeStyle = (trade, isBuyer) => { if (trade.mining) { return {text: 'Mining', className: 'bg-info'}; @@ -55,7 +57,8 @@ const getTradeStyle = (trade, isBuyer) => { class Trades extends Component { state = { filteredState: '', - showFilters: false + showFilters: false, + hideCompletedTrades: false }; filterState(stateName) { @@ -84,6 +87,17 @@ class Trades extends Component { + + + + + + + } {!this.state.showFilters &&

this.setState({showFilters: true})}>Show Filters

} @@ -94,6 +108,9 @@ class Trades extends Component { if (this.state.filteredState && trade.status !== this.state.filteredState) { return null; } + if (this.state.hideCompletedTrades && COMPLETED_STATES.includes(trade.status)) { + return null; + } const isBuyer = addressCompare(trade.buyer, address); const tradeStyle = getTradeStyle(trade, isBuyer); return