diff options
| author | Adam Soltys <[email protected]> | 2026-03-03 16:08:52 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-03 16:08:52 -0800 |
| commit | 8551df92b96ff69f3cda50184cb714ba30f3803d (patch) | |
| tree | b53b414d20d40d9bb9ab33764caa113c5996a262 /src/components/InvoiceData.svelte | |
| parent | 14fff3ba852b1d696f61a0da25aaf0e04ccd4158 (diff) | |
| download | coinos-ui-8551df92b96ff69f3cda50184cb714ba30f3803d.tar.gz coinos-ui-8551df92b96ff69f3cda50184cb714ba30f3803d.zip | |
get rid of /receive route
Diffstat (limited to 'src/components/InvoiceData.svelte')
| -rw-r--r-- | src/components/InvoiceData.svelte | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/src/components/InvoiceData.svelte b/src/components/InvoiceData.svelte index 617f6f42..ece30457 100644 --- a/src/components/InvoiceData.svelte +++ b/src/components/InvoiceData.svelte @@ -24,31 +24,34 @@ let { memo } = $derived(invoice); let qrSrc = $derived(`/qr/${encodeURIComponent(invoice.text)}/raw`); - let visibleSrc = $state(""); - let first = true; + let srcs: string[] = $state([]); $effect(() => { const next = qrSrc; - if (first) { - first = false; - visibleSrc = next; - return; + if (!srcs.length) { + srcs = [next]; + } else if (next !== srcs[srcs.length - 1]) { + srcs = [...srcs, next]; } - const img = new Image(); - img.onload = () => (visibleSrc = next); - img.src = next; }); + + let onLoaded = (src: string) => { + const idx = srcs.indexOf(src); + if (idx > 0) srcs = srcs.slice(idx); + }; </script> {#if showQr} - <div class="max-w-[280px] w-full mx-auto"> - <a href={link}> - <img - src={visibleSrc} - class="z-10 border-4 border-white" - alt={txt} - /> - </a> + <div class="max-w-[280px] w-full mx-auto aspect-square relative"> + {#each srcs as src, i (src)} + <a href={link} class="absolute inset-0" style:z-index={i}> + <img + {src} + alt={txt} + onload={srcs.length > 1 ? () => onLoaded(src) : undefined} + /> + </a> + {/each} </div> {/if} @@ -92,3 +95,4 @@ {#if memo} <div class="text-xl text-center">{memo}</div> {/if} + |
