Skip to content

Commit

Permalink
feat(wallet): Eagerly show pending state for approved offers (#3846)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart authored Sep 21, 2021
1 parent a3306d0 commit 20abcbe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/dapp-svelte-wallet/ui/src/TransactionV2.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
export let item;
export let dismiss;
let isPending = false;
function formatDateNow(stamp) {
if (!stamp) {
return "unknown time";
Expand Down Expand Up @@ -58,6 +60,11 @@
complete: "success",
};
const accept = () => {
isPending = true;
E(walletP).acceptOffer(offerId).catch(makeRejected('Cannot accept'));
}
$: ({
instancePetname,
instanceHandleBoardId,
Expand All @@ -68,7 +75,7 @@
proposalForDisplay: { give = {}, want = {} } = {},
} = item);
$: status = item.status || 'proposed';
$: status = item.status || (isPending ? 'pending' : 'proposed');
</script>

<style>
Expand Down Expand Up @@ -201,8 +208,7 @@
{/if}
{#if status === 'proposed'}
<div>
<Chip on:click={() =>
E(walletP).acceptOffer(offerId).catch(makeRejected('Cannot accept'))}
<Chip on:click={accept}
selected icon="check" color="success">
Accept
</Chip>
Expand Down

0 comments on commit 20abcbe

Please sign in to comment.