From c588662026d9544c40faf1e4cbbb6454bf37193d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 11 Jul 2025 11:22:27 -0700 Subject: gift link page --- src/locales/en.json | 22 ++++++++------ src/routes/(app)/fund/[id]/+layout.server.ts | 12 ++++++++ src/routes/(app)/fund/[id]/+page.server.ts | 13 +------- src/routes/(app)/fund/[id]/+page.svelte | 11 +++---- src/routes/(app)/fund/[id]/gift/+page.server.ts | 7 +++++ src/routes/(app)/fund/[id]/gift/+page.svelte | 40 +++++++++++++++++++++++++ 6 files changed, 77 insertions(+), 28 deletions(-) create mode 100644 src/routes/(app)/fund/[id]/+layout.server.ts create mode 100644 src/routes/(app)/fund/[id]/gift/+page.server.ts create mode 100644 src/routes/(app)/fund/[id]/gift/+page.svelte (limited to 'src') diff --git a/src/locales/en.json b/src/locales/en.json index 88de69da..6045b00d 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -296,8 +296,8 @@ "placeholder": "Enter an address, invoice or username" }, "settings": { - "tip": "Default tip", - "tipDesc": "Default tip percentage when auto-paying trusted users", + "tip": "Default tip", + "tipDesc": "Default tip percentage when auto-paying trusted users", "nostr": "Nostr", "name": "Name", "integrations": "Integrations", @@ -351,11 +351,11 @@ "username": "Username", "email": "Email", "newPassword": "New Password", - "newPasswordDesc": "(Leave blank to keep unchanged)", - "yourUsername": "Your username is", - "yourPassword": "and your password is", - "welcome": "Welcome!", - "clickBelow": "Click below to finish setting up your account", + "newPasswordDesc": "(Leave blank to keep unchanged)", + "yourUsername": "Your username is", + "yourPassword": "and your password is", + "welcome": "Welcome!", + "clickBelow": "Click below to finish setting up your account", "about": "About", "aboutPlaceholder": "A little something about you or your business address and hours", "emailNotifications": "Email Notifications", @@ -405,8 +405,12 @@ } }, "payments": { - "trustUser": "Send and enable auto-pay", - "sweep": "Sweep link", + "trustUser": "Send and enable auto-pay", + "gift": "Gift all funds", + "giftLink": "Gift link", + "giftDesc1": "Whoever opens the link below will receive all the available funds.", + "giftDesc2": "If they are logged in, the funds will go to their account, otherwise a new account will be generated.", + "sweep": "Sweep link", "lockedBalance": "Locked balance", "insufficientFunds": "Insufficient funds", "pending": "Pending", diff --git a/src/routes/(app)/fund/[id]/+layout.server.ts b/src/routes/(app)/fund/[id]/+layout.server.ts new file mode 100644 index 00000000..3669eb7d --- /dev/null +++ b/src/routes/(app)/fund/[id]/+layout.server.ts @@ -0,0 +1,12 @@ +import getRates from "$lib/rates"; +import { get } from "$lib/utils"; + +export const load = async ({ depends, params: { id }, parent }) => { + depends("app:payments"); + const data = await get(`/fund/${id}`); + data.managers = await get(`/fund/${id}/managers`); + const rates = await getRates(); + const { user } = await parent(); + data.rate = rates[user?.currency || "USD"]; + return data; +}; diff --git a/src/routes/(app)/fund/[id]/+page.server.ts b/src/routes/(app)/fund/[id]/+page.server.ts index a4f402af..cd2bd979 100644 --- a/src/routes/(app)/fund/[id]/+page.server.ts +++ b/src/routes/(app)/fund/[id]/+page.server.ts @@ -1,17 +1,6 @@ -import getRates from "$lib/rates"; -import { auth, get, post } from "$lib/utils"; +import { auth, post } from "$lib/utils"; import { redirect } from "@sveltejs/kit"; -export const load = async ({ depends, params: { id }, parent }) => { - depends("app:payments"); - const data = await get(`/fund/${id}`); - data.managers = await get(`/fund/${id}/managers`); - const rates = await getRates(); - const { user } = await parent(); - data.rate = rates[user?.currency || "USD"]; - return data; -}; - export const actions = { default: async ({ cookies, locals, params }) => { const { user } = locals; diff --git a/src/routes/(app)/fund/[id]/+page.svelte b/src/routes/(app)/fund/[id]/+page.svelte index 7f465512..da869fed 100644 --- a/src/routes/(app)/fund/[id]/+page.svelte +++ b/src/routes/(app)/fund/[id]/+page.svelte @@ -111,14 +111,11 @@ >
{$t("payments.shareLink")}
- +
{$t("payments.giftLink")}
+ diff --git a/src/routes/(app)/fund/[id]/gift/+page.server.ts b/src/routes/(app)/fund/[id]/gift/+page.server.ts new file mode 100644 index 00000000..50be31f7 --- /dev/null +++ b/src/routes/(app)/fund/[id]/gift/+page.server.ts @@ -0,0 +1,7 @@ +export const load = async ({ params, parent }) => { + const p = await parent(); + console.log(p); + const { amount, rate } = p; + const { id } = params; + return { amount, id, rate }; +}; diff --git a/src/routes/(app)/fund/[id]/gift/+page.svelte b/src/routes/(app)/fund/[id]/gift/+page.svelte new file mode 100644 index 00000000..ed38c06d --- /dev/null +++ b/src/routes/(app)/fund/[id]/gift/+page.svelte @@ -0,0 +1,40 @@ + + +
+

{$t("payments.gift")}

+ + + +
+

{$t("payments.giftDesc1")}

+

{$t("payments.giftDesc2")}

+
+ +
+ + + + + +
+
-- cgit v1.2.3