From 26463a3aec9a851e1a8167a98baaf332759253b3 Mon Sep 17 00:00:00 2001 From: apporc Date: Tue, 10 Sep 2024 21:41:16 +0800 Subject: [PATCH] Staking: Use Table component --- .../(account)/(staking)/staking/+page.svelte | 35 +------------ .../(staking)/staking/unstaking.svelte | 51 +++++++++++++++++++ .../(staking)/staking/withdraw/+page.svelte | 31 +---------- 3 files changed, 55 insertions(+), 62 deletions(-) create mode 100644 src/routes/[network]/(account)/(staking)/staking/unstaking.svelte diff --git a/src/routes/[network]/(account)/(staking)/staking/+page.svelte b/src/routes/[network]/(account)/(staking)/staking/+page.svelte index 8cd019fb..b6fa544e 100644 --- a/src/routes/[network]/(account)/(staking)/staking/+page.svelte +++ b/src/routes/[network]/(account)/(staking)/staking/+page.svelte @@ -9,6 +9,7 @@ import type { UnstakingRecord, WithdrawableBalance } from './utils'; import { getStakedBalance, getUnstakingBalances, getAPY } from './utils'; + import UnstakingBalances from './unstaking.svelte'; const context = getContext('state'); const { data } = $props(); @@ -46,39 +47,7 @@ > - - - - - - - - - - - {#each unstaking as record} - {#if !record.savings} - - - - {/if} - {/each} - -
AmountDate available
{record.balance}{record.date - ? record.date.toLocaleDateString(undefined, { - weekday: 'long', - year: 'numeric', - month: 'long', - day: 'numeric' - }) - : '--'} -
- -
+ diff --git a/src/routes/[network]/(account)/(staking)/staking/unstaking.svelte b/src/routes/[network]/(account)/(staking)/staking/unstaking.svelte new file mode 100644 index 00000000..baf281eb --- /dev/null +++ b/src/routes/[network]/(account)/(staking)/staking/unstaking.svelte @@ -0,0 +1,51 @@ + + + + + + + + + Amount + Date available + + + + {#each records as record} + {#if !record.savings} + + {record.balance} + + {record.date + ? record.date.toLocaleDateString(undefined, { + weekday: 'long', + year: 'numeric', + month: 'long', + day: 'numeric' + }) + : '--'} + + + {/if} + {/each} + + + {#if href} + + {/if} + diff --git a/src/routes/[network]/(account)/(staking)/staking/withdraw/+page.svelte b/src/routes/[network]/(account)/(staking)/staking/withdraw/+page.svelte index bef21c35..f63c7c2a 100644 --- a/src/routes/[network]/(account)/(staking)/staking/withdraw/+page.svelte +++ b/src/routes/[network]/(account)/(staking)/staking/withdraw/+page.svelte @@ -13,6 +13,7 @@ import type { UnicoveContext } from '$lib/state/client.svelte'; import { getContext } from 'svelte'; import { WithdrawState } from './state.svelte'; + import UnstakingBalances from '../unstaking.svelte'; const context = getContext('state'); const { data } = $props(); @@ -43,35 +44,7 @@ > - - - - - - - - - - {#each withdrawState.unstaking as record} - {#if !record.savings} - - - - {/if} - {/each} - -
AmountDate available
{record.balance}{record.date - ? record.date.toLocaleDateString(undefined, { - weekday: 'long', - year: 'numeric', - month: 'long', - day: 'numeric' - }) - : '--'} -
-
+
{/if}