Skip to content

Commit

Permalink
feat(wallet): display the invitation fee, feePurse, and expiry
Browse files Browse the repository at this point in the history
Closes #3650

Other details are still available by the </> debug click.
  • Loading branch information
michaelfig committed Aug 17, 2021
1 parent 3682116 commit 49ece05
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions packages/dapp-svelte-wallet/ui/src/Transaction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
return `${match[1]} ${match[2]}`;
}
function cmp(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
const makeRejected = context =>
function rejected(e) {
// We expect our caller to see this result, so just log an error.
Expand All @@ -50,8 +60,10 @@
instancePetname,
instanceHandleBoardId,
installationHandleBoardId,
feePursePetname,
offerId,
requestContext: { date, dappOrigin, origin = "unknown origin" } = {},
invitationDetails: { fee, expiry } = {},
proposalForDisplay: { give = {}, want = {} } = {},
} = item);
Expand Down Expand Up @@ -99,18 +111,33 @@
<Debug title="Offer Detail" target={item} />
</div>
<div>
{#each Object.entries(give) as [role, { amount, pursePetname }], i}
{#each Object.entries(give).sort(([kwa], [kwb]) => cmp(kwa, kwb)) as [role, { amount, pursePetname }], i}
<div>
<h6>Give</h6>
<h6>Give {role}</h6>
<Amount {amount} displayInfo={amount.displayInfo} /> from <Petname name={pursePetname} />
</div>
{/each}
{#each Object.entries(want) as [role, { amount, displayInfo, pursePetname }], i}
{#each Object.entries(want).sort(([kwa], [kwb]) => cmp(kwa, kwb)) as [role, { amount, pursePetname }], i}
<div>
<h6>Want</h6>
<h6>Want {role}</h6>
<Amount {amount} displayInfo={amount.displayInfo} /> into <Petname name={pursePetname} />
</div>
{/each}
{#if fee}
<div>
<h6>Pay Fee</h6>
<Amount amount={fee} displayInfo={fee.displayInfo} />
{#if feePursePetname}
from <Petname name={feePursePetname} />
{/if}
</div>
{/if}
{#if expiry}
<div>
<h6>Expiry</h6>
{formatDateNow(parseFloat(expiry) * 1000)}
</div>
{/if}
</div>
<div class="actions">
{#if status === 'pending'}
Expand Down

0 comments on commit 49ece05

Please sign in to comment.