diff options
| author | Adam Soltys <[email protected]> | 2023-01-18 19:44:27 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-18 19:44:27 -0800 |
| commit | 67c4af186fec0423664b18847921eb9696a1eeef (patch) | |
| tree | 85e0fb00f3aa89fdde1cbb667bf801564bff7610 /src/routes/(app)/tx | |
| parent | b1ad12734eeafc36a07bd76f649a98ae9ade5723 (diff) | |
| download | coinos-ui-67c4af186fec0423664b18847921eb9696a1eeef.tar.gz coinos-ui-67c4af186fec0423664b18847921eb9696a1eeef.zip | |
pots
Diffstat (limited to 'src/routes/(app)/tx')
| -rw-r--r-- | src/routes/(app)/tx/[id]/+page.server.js | 2 | ||||
| -rw-r--r-- | src/routes/(app)/tx/[id]/+page.svelte | 28 |
2 files changed, 15 insertions, 15 deletions
diff --git a/src/routes/(app)/tx/[id]/+page.server.js b/src/routes/(app)/tx/[id]/+page.server.js index 7db5d4f1..cbd7355e 100644 --- a/src/routes/(app)/tx/[id]/+page.server.js +++ b/src/routes/(app)/tx/[id]/+page.server.js @@ -2,5 +2,5 @@ import { auth, get } from '$lib/utils'; export async function load({ cookies, params }) { let tx = await get(`/payments/${params.id}`, auth(cookies)); - return { tx }; + return { tx }; } diff --git a/src/routes/(app)/tx/[id]/+page.svelte b/src/routes/(app)/tx/[id]/+page.svelte index 63e45f17..a2bb1459 100644 --- a/src/routes/(app)/tx/[id]/+page.svelte +++ b/src/routes/(app)/tx/[id]/+page.svelte @@ -2,13 +2,15 @@ import { t } from '$lib/translations'; import { back, copy, f, s, sats } from '$lib/utils'; import { Avatar, Icon } from '$comp'; - import { format, parseISO } from 'date-fns'; + import { format } from 'date-fns'; import { PUBLIC_EXPLORER as expl } from '$env/static/public'; export let data; let { user, tx } = data; let { username } = user; - let { amount, hash, createdAt, rate, network, preimage, fee, currency } = tx; + let { amount, hash, created, rate, type, preimage, fee, currency } = tx; + fee = fee || 0; + let fiat = (Math.abs(amount) * rate) / sats; </script> @@ -32,12 +34,12 @@ <div> <div class="font-bold">{$t('payments.date')}</div> <div> - {format(parseISO(createdAt), 'MMMM d')}, - {format(parseISO(createdAt), 'h:mm aaa')} + {format(new Date(created), 'MMMM d')}, + {format(new Date(created), 'h:mm aaa')} </div> </div> - {#if network === 'lightning'} + {#if type === 'lightning'} <div> <div class="font-bold">{$t('payments.preimage')}</div> <div> @@ -47,16 +49,14 @@ {:else} <div> <div class="font-bold">{$t('payments.id')}</div> - <div class="flex"> - <div> - <a href={`${expl}/tx/${hash}`} target="_blank" class="text-blue-600">{hash}</a> + <div class="flex"> + <div> + <a href={`${expl}/tx/${hash}`} target="_blank" class="text-blue-600">{hash}</a> + </div> + <button class="flex font-bold hover:opacity-80 mb-auto" on:click={() => copy(hash)} + ><Icon icon="copy" style="mr-1" /> + </button> </div> - <button - class="flex font-bold hover:opacity-80 mb-auto" - on:click={() => copy(hash)} - ><Icon icon="copy" style="mr-1" /> - </button> - </div> </div> {/if} </div> |
