diff options
| author | Adam Soltys <[email protected]> | 2026-02-04 12:42:42 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 15:34:19 -0800 |
| commit | 78c201d8d9d2f3ec07f6ea36201977846e29ccd9 (patch) | |
| tree | 413d697c2cfa9d3e867c791e161183bad958ed86 /src/routes/(app)/payment | |
| parent | 882c3bd3fd01b6001172c61e0d2227d962254c62 (diff) | |
| download | coinos-ui-78c201d8d9d2f3ec07f6ea36201977846e29ccd9.tar.gz coinos-ui-78c201d8d9d2f3ec07f6ea36201977846e29ccd9.zip | |
homepage design and currency toggling
Diffstat (limited to 'src/routes/(app)/payment')
| -rw-r--r-- | src/routes/(app)/payment/[id]/+page.svelte | 40 | ||||
| -rw-r--r-- | src/routes/(app)/payment/[id]/plain/+page.svelte | 19 |
2 files changed, 44 insertions, 15 deletions
diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index f91f2f26..b4120adb 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -14,6 +14,13 @@ success, types, } from "$lib/utils"; + import { fiat } from "$lib/store"; + + const toggleFiat = (e) => { + e.preventDefault(); + e.stopPropagation(); + $fiat = !$fiat; + }; import Avatar from "$comp/Avatar.svelte"; import { format } from "date-fns"; import { PUBLIC_EXPLORER, PUBLIC_LIQUID_EXPLORER } from "$env/static/public"; @@ -79,18 +86,27 @@ {#snippet field(title, amount)} <div> <span class="text-lg text-secondary">{$t(title)}</span> - <div class="flex gap-2 items-end"> - <div class="flex items-center"> - <iconify-icon - noobserver - icon="ph:lightning-fill" - class="text-yellow-300" - ></iconify-icon>{s(amount, userLocale)} - </div> - <span class="text-secondary text-lg"> - {f(toFiat(amount, rate), currency, userLocale)} - </span> - </div> + <button + type="button" + class="flex gap-2 items-end" + onclick={toggleFiat} + aria-label="Toggle currency display" + > + {#if $fiat} + <div class="flex items-center gap-1"> + {f(toFiat(amount, rate), currency, userLocale)} + </div> + {:else} + <div class="flex items-center gap-1"> + <iconify-icon + noobserver + icon="ph:lightning-fill" + class="text-yellow-300" + ></iconify-icon> + {s(amount, userLocale)} + </div> + {/if} + </button> </div> {/snippet} diff --git a/src/routes/(app)/payment/[id]/plain/+page.svelte b/src/routes/(app)/payment/[id]/plain/+page.svelte index 5dc82ce3..8e3fe8f3 100644 --- a/src/routes/(app)/payment/[id]/plain/+page.svelte +++ b/src/routes/(app)/payment/[id]/plain/+page.svelte @@ -14,6 +14,7 @@ success, types, } from "$lib/utils"; + import { fiat } from "$lib/store"; import Avatar from "$comp/Avatar.svelte"; import { format } from "date-fns"; import { PUBLIC_EXPLORER as expl } from "$env/static/public"; @@ -40,7 +41,11 @@ <div> <span class="text-lg text-secondary">Amount</span> <div> - {f(toFiat(a, rate), currency)} + {#if $fiat} + {f(toFiat(a, rate), currency)} + {:else} + {s(a)} + {/if} </div> </div> @@ -48,7 +53,11 @@ <div> <span class="text-lg text-secondary">Tip</span> <div> - {f(toFiat(tip, rate), currency)} + {#if $fiat} + {f(toFiat(tip, rate), currency)} + {:else} + {s(tip)} + {/if} ({Math.round((tip * 100) / Math.abs(a))}%) </div> </div> @@ -56,7 +65,11 @@ <div> <span class="text-lg text-secondary">Total</span> <div> - {f(toFiat(a + (tip || 0), rate), currency)} + {#if $fiat} + {f(toFiat(a + (tip || 0), rate), currency)} + {:else} + {s(a + (tip || 0))} + {/if} </div> </div> {/if} |
