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
12 changes: 6 additions & 6 deletions app/renderer/components/SwapList.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ const SortDirections = {

// eslint-disable-next-line no-unused-vars
class CancelButton extends React.Component {
state = {
isCancelling: false,
}

cancelSwap = async swapUuid => {
this.setState({isCancelling: true});
await tradesContainer.setIsSwapCancelling(swapUuid, true);
this.forceUpdate();

try {
await appContainer.api.cancelOrder(swapUuid);
Expand All @@ -43,7 +40,10 @@ class CancelButton extends React.Component {
<button
type="button"
className="cancel__button"
disabled={swap.status !== 'pending' || this.state.isCancelling}
disabled={
swap.status !== 'pending' ||
tradesContainer.state.isSwapCancelling[swap.uuid]
}
onClick={() => this.cancelSwap(swap.uuid)}
>
{t('list.cancel')}
Expand Down
9 changes: 9 additions & 0 deletions app/renderer/containers/Trades.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ import {Container} from 'unstated';
class TradesContainer extends Container {
state = {
activeView: 'OpenOrders',
isSwapCancelling: {},
};

setActiveView = activeView => {
this.setState({activeView});
};

setIsSwapCancelling = (swapUuid, isCancelling) => {
this.setState(state => {
const {isSwapCancelling} = state;
isSwapCancelling[swapUuid] = isCancelling;
return state;
});
};
}

const tradesContainer = new TradesContainer();
Expand Down