Skip to content

Commit

Permalink
fix: properly display rejected offer manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Nov 4, 2020
1 parent 2be854d commit 420a524
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/dapp-svelte-wallet/ui/src/Transaction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
return `${match[1]} ${match[2]}`;
}
const makeRejected = context =>
function rejected(e) {
// TODO: Do something less blatant.
alert(`${context}: ${e}`);
};
const statusText = {
decline: "Declined",
rejected: "Rejected",
Expand Down Expand Up @@ -108,15 +114,18 @@
</div>
<div class="actions">
{#if status === 'pending'}
<Chip on:click={() => E(walletP).cancelOffer(offerId)}
<Chip on:click={() =>
E(walletP).cancelOffer(offerId).catch(makeRejected('Cannot cancel'))}
selected icon="clear" color="alert"
>Cancel</Chip>
{/if}
{#if status === 'proposed'}
<div class="flex flex-row">
<Chip on:click={() => E(walletP).acceptOffer(offerId)}
<Chip on:click={() =>
E(walletP).acceptOffer(offerId).catch(makeRejected('Cannot accept'))}
selected icon="check" color="success"
>Accept</Chip> <Chip on:click={() => E(walletP).declineOffer(offerId)}
>Accept</Chip> <Chip on:click={() =>
E(walletP).declineOffer(offerId).catch(makeRejected('Cannot decline'))}
selected icon="clear" color="error"
>Decline</Chip>
</div>
Expand Down

0 comments on commit 420a524

Please sign in to comment.