diff options
| author | Adam Soltys <[email protected]> | 2026-02-11 17:09:39 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 17:09:39 -0800 |
| commit | 3aa9ce1b5985397d7f568887ec6f881df13c1034 (patch) | |
| tree | 2c459692dc5315e92924de6be9f0999a835e0f54 /src/routes/(app)/invoice | |
| parent | 8a4b0087cbfe8b43d9b43d19af6d991a646ef3d7 (diff) | |
| download | coinos-ui-3aa9ce1b5985397d7f568887ec6f881df13c1034.tar.gz coinos-ui-3aa9ce1b5985397d7f568887ec6f881df13c1034.zip | |
fix ts errors
Diffstat (limited to 'src/routes/(app)/invoice')
| -rw-r--r-- | src/routes/(app)/invoice/[id]/+page.svelte | 5 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/[id]/tip/+page.svelte | 28 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/routes/(app)/invoice/[id]/+page.svelte b/src/routes/(app)/invoice/[id]/+page.svelte index beffa264..bf62a062 100644 --- a/src/routes/(app)/invoice/[id]/+page.svelte +++ b/src/routes/(app)/invoice/[id]/+page.svelte @@ -28,7 +28,7 @@ import { t } from "$lib/translations"; import { goto, invalidate } from "$app/navigation"; - let { data } = $props(); + let { data }: any = $props(); let showOptions; @@ -91,7 +91,7 @@ else url += "?options=true"; goto(url, { invalidateAll: true, noScroll: true }); - } catch (e) { + } catch (e: any) { fail(e.message); } }; @@ -185,7 +185,6 @@ {invoice} {copy} {link} - {type} {txt} t={$t} bind:showQr={$showQr} diff --git a/src/routes/(app)/invoice/[id]/tip/+page.svelte b/src/routes/(app)/invoice/[id]/tip/+page.svelte index c9f38837..4d3af188 100644 --- a/src/routes/(app)/invoice/[id]/tip/+page.svelte +++ b/src/routes/(app)/invoice/[id]/tip/+page.svelte @@ -10,10 +10,10 @@ const tipAmounts = ["No", "10%", "15%", "20%"]; let showCustomAmount = $state(); - let customInput = $state(); - let customTipAmount = $state(); + let customInput: HTMLInputElement = $state() as any; + let customTipAmount: number = $state(0); - let apply = async (e) => { + let apply = async (e: Event) => { e.preventDefault(); if (customTipAmount > 0) { @@ -25,24 +25,24 @@ let active = (amount) => !customTipAmount && Math.round(tipPercent) === parseInt(amount.slice(0, 2)); - const handleCustomTipAmount = (e) => { - customTipAmount = e.target.value; + const handleCustomTipAmount = (e: Event) => { + customTipAmount = Number((e.target as HTMLInputElement).value); tipPercent = (customTipAmount / amountFiat) * 100; tip = Math.round((amount / 100) * tipPercent); }; let timeout; - const handleSlide = (e) => { - customTipAmount = ""; + const handleSlide = (e: Event) => { + customTipAmount = 0; if (customInput) { customInput.value = ""; } - tipPercent = e.target.value; + tipPercent = Number((e.target as HTMLInputElement).value); tip = Math.round((amount / 100) * tipPercent); }; let submitting = $state(); - const handleTipButtonClick = async (v) => { + const handleTipButtonClick = async (v: string) => { submitting = true; if (v === "No") { tipPercent = 0; @@ -56,9 +56,9 @@ submit.click(); }; - let submit = $state(); + let submit: HTMLButtonElement = $state() as any; - let { data } = $props(); + let { data }: any = $props(); let { invoice, id, user } = $state(data); let { aid, @@ -87,7 +87,7 @@ }); let amountFiat = $derived(parseFloat(((amount * rate) / sats).toFixed(2))); - let tipAmount = $derived(((tip * rate) / sats).toFixed(2)); + let tipAmount = $derived(parseFloat(((tip * rate) / sats).toFixed(2))); let invoiceAmountFiatFormatted = $derived(f(amountFiat, currency)); </script> @@ -147,14 +147,14 @@ use:focus type="button" class="btn" - class:active={active(amount, tipPercent)} + class:active={active(amount)} onclick={() => handleTipButtonClick(amount)}>{amount}</button > {:else} <button type="button" class="btn" - class:active={active(amount, tipPercent)} + class:active={active(amount)} onclick={() => handleTipButtonClick(amount)}>{amount}</button > {/if} |
