aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/payment
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-07 21:16:25 -0800
committerAdam Soltys <[email protected]>2024-11-08 09:27:40 -0800
commit32fcc461cd43c8907df5e306d520bb671307eab1 (patch)
tree0253780c569998b6c1a5f43026586e94916c3fee /src/routes/(app)/payment
parentbe5aa52cea1d57c875cfb22d25c6a866b8de2239 (diff)
downloadcoinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.tar.gz
coinos-ui-32fcc461cd43c8907df5e306d520bb671307eab1.zip
svelte 5
Diffstat (limited to 'src/routes/(app)/payment')
-rw-r--r--src/routes/(app)/payment/[id]/+page.svelte20
-rw-r--r--src/routes/(app)/payment/[id]/plain/+page.svelte4
2 files changed, 14 insertions, 10 deletions
diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte
index 150c2bc4..fd5ea95f 100644
--- a/src/routes/(app)/payment/[id]/+page.svelte
+++ b/src/routes/(app)/payment/[id]/+page.svelte
@@ -1,4 +1,6 @@
<script>
+ import { run } from 'svelte/legacy';
+
import { browser } from "$app/environment";
import { onMount, tick } from "svelte";
import { t, loading } from "$lib/translations";
@@ -19,11 +21,10 @@
import { PUBLIC_EXPLORER, PUBLIC_LIQUID_EXPLORER } from "$env/static/public";
import locales from "$lib/locales";
- export let data;
- let { user, payment: p } = data;
+ let { data } = $props();
+ let { user, payment: p } = $state(data);
let locale = locales[user.language];
- $: refresh(data);
let refresh = (d) => {
({ user, payment: p } = d);
({
@@ -65,7 +66,7 @@
ourfee,
fee,
currency,
- } = p;
+ } = $state(p);
let a = Math.abs(amount);
let expl = {
@@ -86,11 +87,11 @@
}
};
- let txid, vout;
+ let txid = $state(), vout = $state();
if (amount > 0) [txid, vout] = ref.split(":");
else txid = hash;
- let direction = "";
+ let direction = $state("");
onMount(() => {
direction = amount > 0 ? $t("payments.from") : $t("payments.to");
@@ -98,6 +99,9 @@
direction =
direction[0].toUpperCase() + direction.substr(1, direction.length);
});
+ run(() => {
+ refresh(data);
+ });
</script>
<div class="container mx-auto max-w-lg px-4 space-y-8 break-all text-2xl">
@@ -222,7 +226,7 @@
</div>
<button
class="flex font-bold hover:opacity-80 mb-auto my-auto"
- on:click={() => copy(txid)}
+ onclick={() => copy(txid)}
>
<Icon icon="copy" style="ml-2 w-12 my-auto" />
</button>
@@ -237,7 +241,7 @@
<div>{path}</div>
<button
class="flex font-bold hover:opacity-80 mb-auto my-auto"
- on:click={() => copy(path)}
+ onclick={() => copy(path)}
>
<Icon icon="copy" style="ml-2 w-12 my-auto" />
</button>
diff --git a/src/routes/(app)/payment/[id]/plain/+page.svelte b/src/routes/(app)/payment/[id]/plain/+page.svelte
index c63a9d7f..7d5c09aa 100644
--- a/src/routes/(app)/payment/[id]/plain/+page.svelte
+++ b/src/routes/(app)/payment/[id]/plain/+page.svelte
@@ -19,7 +19,7 @@
import { format } from "date-fns";
import { PUBLIC_EXPLORER as expl } from "$env/static/public";
- export let data;
+ let { data } = $props();
let { user, payment: p } = data;
let { username } = user;
@@ -84,5 +84,5 @@
</div>
<a href={`/payment/${id}`}>
- <div class="opacity-0 w-screen h-screen fixed top-0 left-0 z-50" />
+ <div class="opacity-0 w-screen h-screen fixed top-0 left-0 z-50"></div>
</a>