aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-08 15:41:29 -0800
committerAdam Soltys <[email protected]>2024-11-08 15:41:29 -0800
commite964dcce2d24f13a40a93a82b79c38b28a190bb5 (patch)
tree0c64969887814e6f842b8d1e3ba03db90821538e /src
parentfe9977bdd2bc4d51d51563479945aa5ad09f1287 (diff)
downloadcoinos-ui-e964dcce2d24f13a40a93a82b79c38b28a190bb5.tar.gz
coinos-ui-e964dcce2d24f13a40a93a82b79c38b28a190bb5.zip
fix set amount
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/[username]/receive/+page.svelte26
-rw-r--r--src/routes/(app)/invoice/[id]/+layout.server.ts1
-rw-r--r--src/routes/(app)/invoice/[id]/+page.svelte1
3 files changed, 15 insertions, 13 deletions
diff --git a/src/routes/(app)/[username]/receive/+page.svelte b/src/routes/(app)/[username]/receive/+page.svelte
index 9a696929..56bb1f92 100644
--- a/src/routes/(app)/[username]/receive/+page.svelte
+++ b/src/routes/(app)/[username]/receive/+page.svelte
@@ -1,5 +1,5 @@
<script>
- import { run } from 'svelte/legacy';
+ import { run } from "svelte/legacy";
import { send } from "$lib/socket";
import { btc, post, copy, f, get, types, sat, s, sats } from "$lib/utils";
@@ -27,10 +27,8 @@
let rate = rates[currency];
let type = types.lightning;
let hash = "";
-
let qr;
-
let aid = subject.id;
let invoice = $state({
aid,
@@ -38,7 +36,9 @@
items: [],
user: subject,
});
- let amount = $state(), amountFiat, tip;
+ let amount = $state(),
+ amountFiat,
+ tip;
let setType = async (type) => {
invoice.type = type;
@@ -71,22 +71,25 @@
goto(url, { invalidateAll: true, noScroll: true });
};
- let newAmount;
+ let newAmount = $state();
let settingAmount = $state();
+ let fiat = $state(true);
let toggleAmount = () => (settingAmount = !settingAmount);
let submit;
run(() => {
refresh(data);
});
- let link = $derived([types.bitcoin, types.liquid].includes(type)
- ? text
- : `lightning:${text}`);
- let txt = $derived([types.bitcoin, types.liquid].includes(type) ? hash : text);
+ let link = $derived(
+ [types.bitcoin, types.liquid].includes(type) ? text : `lightning:${text}`,
+ );
+ let txt = $derived(
+ [types.bitcoin, types.liquid].includes(type) ? hash : text,
+ );
</script>
<div class="invoice container mx-auto max-w-xl px-4 space-y-2">
<InvoiceData
- {src}
+ {src}
{link}
{qr}
{txt}
@@ -116,12 +119,13 @@
</div>
<SetAmount
+ bind:newAmount
+ bind:fiat
{currency}
{rate}
{submit}
{settingAmount}
{setAmount}
- {newAmount}
{toggleAmount}
amountPrompt={$amountPrompt}
t={$t}
diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts
index 9b667c7b..e428d9fe 100644
--- a/src/routes/(app)/invoice/[id]/+layout.server.ts
+++ b/src/routes/(app)/invoice/[id]/+layout.server.ts
@@ -35,7 +35,6 @@ export async function load({ cookies, depends, params, url, parent }) {
}
}
- console.log("REDRAW", invoice?.text);
const src = Qr.drawImg(invoice?.text || "", { size: 500 });
const theme = cookies.get("theme");
return { id, invoice, subject, src, user, token, theme };
diff --git a/src/routes/(app)/invoice/[id]/+page.svelte b/src/routes/(app)/invoice/[id]/+page.svelte
index ded42016..29684703 100644
--- a/src/routes/(app)/invoice/[id]/+page.svelte
+++ b/src/routes/(app)/invoice/[id]/+page.svelte
@@ -74,7 +74,6 @@
};
let setAmount = $state(async () => {
- console.log("LALA", newAmount);
if (typeof $amountPrompt === "undefined") $amountPrompt = true;
settingAmount = false;
amount = newAmount;