Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/locales/en-US/exchange.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"quit": "Quit",
"swaps": {
"all": "All",
"title": "Recent Swaps",
"title": "Open Orders",
"viewAllSwaps": "View all swaps"
}
}
2 changes: 1 addition & 1 deletion app/renderer/containers/Exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ExchangeContainer extends SuperContainer {
return {
baseCurrency: 'CHIPS',
quoteCurrency: 'KMD',
activeSwapsView: 'All',
activeSwapsView: 'OpenOrders',
swapHistory: [],
orderBook: {
bids: [],
Expand Down
28 changes: 17 additions & 11 deletions app/renderer/views/Exchange/Swaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const t = translate('exchange');

const swapLimit = 50;

const getOpenOrders = () => exchangeContainer.state.swapHistory.filter(swap => !['completed', 'failed'].includes(swap.status));

const TabButton = props => (
<span
className={
Expand All @@ -32,16 +34,20 @@ const TabView = ({component}) => (
<View component={component} activeView={exchangeContainer.state.activeSwapsView}/>
);

const All = () => (
<SwapList swaps={exchangeContainer.state.swapHistory} limit={swapLimit} showCancel/>
);
const OpenOrders = () => {
const openOrders = getOpenOrders();

return (
<SwapList swaps={openOrders} limit={swapLimit} showCancel/>
);
};

const Split = () => {
const CurrentPairOpenOrders = () => {
const {state} = exchangeContainer;

const filteredData = state.swapHistory.filter(x =>
x.baseCurrency === state.baseCurrency &&
x.quoteCurrency === state.quoteCurrency
const filteredData = getOpenOrders().filter(swap =>
swap.baseCurrency === state.baseCurrency &&
swap.quoteCurrency === state.quoteCurrency
);

return (
Expand All @@ -59,17 +65,17 @@ const Swaps = () => {
<nav>
<TabButton
title={t('swaps.all')}
component={All}
component={OpenOrders}
/>
<TabButton
title={`${state.baseCurrency}/${state.quoteCurrency}`}
component={Split}
component={CurrentPairOpenOrders}
/>
</nav>
</header>
<main>
<TabView component={All}/>
<TabView component={Split}/>
<TabView component={OpenOrders}/>
<TabView component={CurrentPairOpenOrders}/>
</main>
</div>
);
Expand Down