From f558ffd47a7666ce292bf1f8dde949b12904351e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 24 Oct 2023 23:34:39 -0700 Subject: fix classic payments --- src/routes/(app)/send/invoice/[id]/+page.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/routes/(app)/send') diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index a558895c..02ab9d41 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -102,8 +102,16 @@

{$t('payments.to')}

- -

{recipient.username}

+ {#if recipient.username.includes('@classic')} + Bitcoin + {:else} + + {/if} +

{recipient.username.replace('@classic', '')}

{:else} -- cgit v1.2.3 From 8041f705373758940b9487ed5c4cd34bfb04ac16 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 8 Nov 2023 13:46:04 -0800 Subject: rename pot to fund --- src/lib/utils.js | 2 +- src/locales/en.json | 2 +- .../(app)/[username]/card/[serial]/+page.server.js | 6 +- .../(app)/[username]/invoice/[id]/+page.svelte | 2 +- src/routes/(app)/fund/[name]/+page.server.js | 23 ++++ src/routes/(app)/fund/[name]/+page.svelte | 138 +++++++++++++++++++++ src/routes/(app)/fund/[name]/sweep/+page.server.js | 14 +++ src/routes/(app)/fund/[name]/sweep/+page.svelte | 37 ++++++ .../(app)/fund/[name]/withdraw/+page.server.js | 20 +++ src/routes/(app)/fund/[name]/withdraw/+page.svelte | 58 +++++++++ src/routes/(app)/fund/[name]/withdraw/+server.js | 6 + src/routes/(app)/payment/[id]/+page.svelte | 4 +- src/routes/(app)/pot/[name]/+page.server.js | 23 ---- src/routes/(app)/pot/[name]/+page.svelte | 138 --------------------- src/routes/(app)/pot/[name]/sweep/+page.server.js | 14 --- src/routes/(app)/pot/[name]/sweep/+page.svelte | 37 ------ .../(app)/pot/[name]/withdraw/+page.server.js | 20 --- src/routes/(app)/pot/[name]/withdraw/+page.svelte | 58 --------- src/routes/(app)/pot/[name]/withdraw/+server.js | 6 - src/routes/(app)/send/[...text]/+page.server.js | 9 +- src/routes/(app)/send/[...text]/+page.svelte | 13 -- .../send/fund/[name]/[...amount]/+page.server.js | 17 +++ .../send/fund/[name]/[...amount]/+page.svelte | 58 +++++++++ .../send/pot/[name]/[...amount]/+page.server.js | 17 --- .../(app)/send/pot/[name]/[...amount]/+page.svelte | 58 --------- 25 files changed, 383 insertions(+), 397 deletions(-) create mode 100644 src/routes/(app)/fund/[name]/+page.server.js create mode 100644 src/routes/(app)/fund/[name]/+page.svelte create mode 100644 src/routes/(app)/fund/[name]/sweep/+page.server.js create mode 100644 src/routes/(app)/fund/[name]/sweep/+page.svelte create mode 100644 src/routes/(app)/fund/[name]/withdraw/+page.server.js create mode 100644 src/routes/(app)/fund/[name]/withdraw/+page.svelte create mode 100644 src/routes/(app)/fund/[name]/withdraw/+server.js delete mode 100644 src/routes/(app)/pot/[name]/+page.server.js delete mode 100644 src/routes/(app)/pot/[name]/+page.svelte delete mode 100644 src/routes/(app)/pot/[name]/sweep/+page.server.js delete mode 100644 src/routes/(app)/pot/[name]/sweep/+page.svelte delete mode 100644 src/routes/(app)/pot/[name]/withdraw/+page.server.js delete mode 100644 src/routes/(app)/pot/[name]/withdraw/+page.svelte delete mode 100644 src/routes/(app)/pot/[name]/withdraw/+server.js create mode 100644 src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js create mode 100644 src/routes/(app)/send/fund/[name]/[...amount]/+page.svelte delete mode 100644 src/routes/(app)/send/pot/[name]/[...amount]/+page.server.js delete mode 100644 src/routes/(app)/send/pot/[name]/[...amount]/+page.svelte (limited to 'src/routes/(app)/send') diff --git a/src/lib/utils.js b/src/lib/utils.js index 52494c88..9e1066e2 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -251,7 +251,7 @@ export let types = { bitcoin: 'bitcoin', lightning: 'lightning', internal: 'internal', - pot: 'pot', + fund: 'fund', classic: 'classic' }; diff --git a/src/locales/en.json b/src/locales/en.json index a1d0c0aa..d3e294d4 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -263,7 +263,7 @@ } }, "payments": { - "moneyPot": "Money Pot", + "fund": "Fund", "addFunds": "Add Funds", "takeFunds": "Take Funds", "show": "Show", diff --git a/src/routes/(app)/[username]/card/[serial]/+page.server.js b/src/routes/(app)/[username]/card/[serial]/+page.server.js index e2569536..40e375aa 100644 --- a/src/routes/(app)/[username]/card/[serial]/+page.server.js +++ b/src/routes/(app)/[username]/card/[serial]/+page.server.js @@ -3,14 +3,14 @@ import { redirect } from "@sveltejs/kit" export let load = async ({ cookies, params }) => { let { serial } = params; - let pot; + let fund; try { - pot = await get(`/pot/${serial}`, auth(cookies)); + fund = await get(`/fund/${serial}`, auth(cookies)); } catch (e) { console.log(e); } - if (pot) throw redirect(307, `/pot/${serial}`); + if (fund) throw redirect(307, `/fund/${serial}`); return params; }; diff --git a/src/routes/(app)/[username]/invoice/[id]/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/+page.svelte index 2d204255..a0894dd1 100644 --- a/src/routes/(app)/[username]/invoice/[id]/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[id]/+page.svelte @@ -15,7 +15,7 @@ let reading = async ({ message, serialNumber }) => { let name = serialNumber.replace(/:/g, '-'); - let result = await post(`/pot/${name}/withdraw`, { amount, hash, name }); + let result = await post(`/fund/${name}/withdraw`, { amount, hash, name }); }; let readingerror = (e) => console.log('nfc error', e); diff --git a/src/routes/(app)/fund/[name]/+page.server.js b/src/routes/(app)/fund/[name]/+page.server.js new file mode 100644 index 00000000..ad20c7d9 --- /dev/null +++ b/src/routes/(app)/fund/[name]/+page.server.js @@ -0,0 +1,23 @@ +import { error, redirect } from '@sveltejs/kit'; +import { auth, get, post } from '$lib/utils'; +import Qr from 'qrcode-base64'; + +export let load = async ({ params: { name }, url }) => { + let { amount, payments } = await get(`/fund/${name}`); + + let src = Qr.drawImg(url.href, { size: 300 }); + return { amount, payments, src }; +}; + +export const actions = { + default: async ({ cookies, locals, params, request }) => { + let { user } = locals; + + if (user) { + await post('/redeem', params, auth(cookies)); + throw redirect(307, `/${user.username}/payments`); + } + + throw redirect(307, '/register'); + } +}; diff --git a/src/routes/(app)/fund/[name]/+page.svelte b/src/routes/(app)/fund/[name]/+page.svelte new file mode 100644 index 00000000..0ac10c24 --- /dev/null +++ b/src/routes/(app)/fund/[name]/+page.svelte @@ -0,0 +1,138 @@ + + +
+
+
+
+ + {#if name.split('-').length === 4} +

Card {name}

+ {:else} + Fund +
+

{$t('payments.fund')}

+

{name}

+
+ {/if} +
+ {#if show} + {name} + {/if} +
+
+

+ {f(amountFiat, currency)} +

+

+ {sat(amount)} +

+
+
+ +
+ + +
+ +
+
+
diff --git a/src/routes/(app)/fund/[name]/sweep/+page.server.js b/src/routes/(app)/fund/[name]/sweep/+page.server.js new file mode 100644 index 00000000..929348ef --- /dev/null +++ b/src/routes/(app)/fund/[name]/sweep/+page.server.js @@ -0,0 +1,14 @@ +import { get, auth, post } from '$lib/utils'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ cookies, params, parent }) { + let { user } = await parent(); + let { name } = params; + let { amount } = await get(`/fund/${name}`); + + + if (!amount) throw redirect(307, `/fund/${name}`); + if (!user) throw redirect(307, `/register?redirect=/fund/${name}/sweep`); + await post('/take', { amount, name }, auth(cookies)); + return { amount, name }; +} diff --git a/src/routes/(app)/fund/[name]/sweep/+page.svelte b/src/routes/(app)/fund/[name]/sweep/+page.svelte new file mode 100644 index 00000000..9b473af3 --- /dev/null +++ b/src/routes/(app)/fund/[name]/sweep/+page.svelte @@ -0,0 +1,37 @@ + + +
+
+ + + +
+ +
+ +
+

{$t('payments.fundsClaimed')}

+

+ {f(fiat(amount, rate), currency)} +

+

+ ⚡️{s(amount)} +

+
+ + +
+ + +
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/fund/[name]/withdraw/+page.server.js b/src/routes/(app)/fund/[name]/withdraw/+page.server.js new file mode 100644 index 00000000..4d590890 --- /dev/null +++ b/src/routes/(app)/fund/[name]/withdraw/+page.server.js @@ -0,0 +1,20 @@ +import { fail, json, redirect } from '@sveltejs/kit'; +import { fd, auth, post } from '$lib/utils'; + +export async function load({ parent }) { + let { user } = await parent(); + if (!user) throw redirect(307, '/register'); +} + +export const actions = { + default: async ({ cookies, request }) => { + let body = await fd(request); + try { + await post('/take', body, auth(cookies)); + } catch (e) { + return fail(400, { message: e.message }); + } + + throw redirect(307, `/fund/${body.name}`); + } +}; diff --git a/src/routes/(app)/fund/[name]/withdraw/+page.svelte b/src/routes/(app)/fund/[name]/withdraw/+page.svelte new file mode 100644 index 00000000..7be643a9 --- /dev/null +++ b/src/routes/(app)/fund/[name]/withdraw/+page.svelte @@ -0,0 +1,58 @@ + + + + +{#if form?.message} +
+ {form.message} +
+{/if} + +
+ + +
+ + + + +
+ +
+
+
diff --git a/src/routes/(app)/fund/[name]/withdraw/+server.js b/src/routes/(app)/fund/[name]/withdraw/+server.js new file mode 100644 index 00000000..0f9a23f3 --- /dev/null +++ b/src/routes/(app)/fund/[name]/withdraw/+server.js @@ -0,0 +1,6 @@ +import { json } from '@sveltejs/kit'; +import { auth, post } from '$lib/utils'; + +export async function POST({ cookies, request }) { + return json(await post('/take', await request.json(), auth(cookies))); +} diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 38b91658..98c5a68b 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -47,10 +47,10 @@
{/if} - {#if p.type === types.pot} + {#if p.type === types.fund}
{direction} - +
Pot diff --git a/src/routes/(app)/pot/[name]/+page.server.js b/src/routes/(app)/pot/[name]/+page.server.js deleted file mode 100644 index 8f8b9d8f..00000000 --- a/src/routes/(app)/pot/[name]/+page.server.js +++ /dev/null @@ -1,23 +0,0 @@ -import { error, redirect } from '@sveltejs/kit'; -import { auth, get, post } from '$lib/utils'; -import Qr from 'qrcode-base64'; - -export let load = async ({ params: { name }, url }) => { - let { amount, payments } = await get(`/pot/${name}`); - - let src = Qr.drawImg(url.href, { size: 300 }); - return { amount, payments, src }; -}; - -export const actions = { - default: async ({ cookies, locals, params, request }) => { - let { user } = locals; - - if (user) { - await post('/redeem', params, auth(cookies)); - throw redirect(307, `/${user.username}/payments`); - } - - throw redirect(307, '/register'); - } -}; diff --git a/src/routes/(app)/pot/[name]/+page.svelte b/src/routes/(app)/pot/[name]/+page.svelte deleted file mode 100644 index ea1e45f2..00000000 --- a/src/routes/(app)/pot/[name]/+page.svelte +++ /dev/null @@ -1,138 +0,0 @@ - - - diff --git a/src/routes/(app)/pot/[name]/sweep/+page.server.js b/src/routes/(app)/pot/[name]/sweep/+page.server.js deleted file mode 100644 index c2c8051d..00000000 --- a/src/routes/(app)/pot/[name]/sweep/+page.server.js +++ /dev/null @@ -1,14 +0,0 @@ -import { get, auth, post } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ cookies, params, parent }) { - let { user } = await parent(); - let { name } = params; - let { amount } = await get(`/pot/${name}`); - - - if (!amount) throw redirect(307, `/pot/${name}`); - if (!user) throw redirect(307, `/register?redirect=/pot/${name}/sweep`); - await post('/take', { amount, name }, auth(cookies)); - return { amount, name }; -} diff --git a/src/routes/(app)/pot/[name]/sweep/+page.svelte b/src/routes/(app)/pot/[name]/sweep/+page.svelte deleted file mode 100644 index 9b473af3..00000000 --- a/src/routes/(app)/pot/[name]/sweep/+page.svelte +++ /dev/null @@ -1,37 +0,0 @@ - - -
-
- - - -
- -
- -
-

{$t('payments.fundsClaimed')}

-

- {f(fiat(amount, rate), currency)} -

-

- ⚡️{s(amount)} -

-
- - -
- - -
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/pot/[name]/withdraw/+page.server.js b/src/routes/(app)/pot/[name]/withdraw/+page.server.js deleted file mode 100644 index e7ea29f1..00000000 --- a/src/routes/(app)/pot/[name]/withdraw/+page.server.js +++ /dev/null @@ -1,20 +0,0 @@ -import { fail, json, redirect } from '@sveltejs/kit'; -import { fd, auth, post } from '$lib/utils'; - -export async function load({ parent }) { - let { user } = await parent(); - if (!user) throw redirect(307, '/register'); -} - -export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - try { - await post('/take', body, auth(cookies)); - } catch (e) { - return fail(400, { message: e.message }); - } - - throw redirect(307, `/pot/${body.name}`); - } -}; diff --git a/src/routes/(app)/pot/[name]/withdraw/+page.svelte b/src/routes/(app)/pot/[name]/withdraw/+page.svelte deleted file mode 100644 index 7be643a9..00000000 --- a/src/routes/(app)/pot/[name]/withdraw/+page.svelte +++ /dev/null @@ -1,58 +0,0 @@ - - - - -{#if form?.message} -
- {form.message} -
-{/if} - -
- - -
- - - - -
- -
-
-
diff --git a/src/routes/(app)/pot/[name]/withdraw/+server.js b/src/routes/(app)/pot/[name]/withdraw/+server.js deleted file mode 100644 index 0f9a23f3..00000000 --- a/src/routes/(app)/pot/[name]/withdraw/+server.js +++ /dev/null @@ -1,6 +0,0 @@ -import { json } from '@sveltejs/kit'; -import { auth, post } from '$lib/utils'; - -export async function POST({ cookies, request }) { - return json(await post('/take', await request.json(), auth(cookies))); -} diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js index cafce7c9..6b4b000e 100644 --- a/src/routes/(app)/send/[...text]/+page.server.js +++ b/src/routes/(app)/send/[...text]/+page.server.js @@ -30,7 +30,7 @@ let parse = async (t, host) => { if (id) throw redirect(307, `/send/invoice/${id}`); } - if (t.includes('/pot')) throw redirect(307, t.substring(t.indexOf('/pot'))); + if (t.includes('/fund')) throw redirect(307, t.substring(t.indexOf('/fund'))); if (t.toLowerCase().startsWith('lnurl')) throw redirect(307, `/ln/${t}`); if (t.includes(':')) t = t.split(':')[1]; @@ -66,13 +66,12 @@ let parse = async (t, host) => { if (user) throw redirect(307, `/send/user/${t}`); - // pot - let pot; + let fund; try { - pot = await get(`/pot/${t}`); + fund = await get(`/fund/${t}`); } catch (e) {} - if (pot) throw redirect(307, `/send/pot/${t}`); + if (fund) throw redirect(307, `/send/fund/${t}`); // invoice let invoice; diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index 3abc5a1a..c246f811 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -35,19 +35,6 @@
- {#if form?.error} -
-
- Could not find anything with that name. Would you like to create a new pot? -
-
- -
-
- {/if}
diff --git a/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js b/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js new file mode 100644 index 00000000..2cb3c4a9 --- /dev/null +++ b/src/routes/(app)/send/fund/[name]/[...amount]/+page.server.js @@ -0,0 +1,17 @@ +import { fail, redirect } from '@sveltejs/kit'; +import { auth, fd, post } from '$lib/utils'; + +export const actions = { + default: async ({ cookies, request }) => { + let body = await fd(request); + let p; + + try { + p = await post('/payments', body, auth(cookies)); + } catch (e) { + return fail(400, { message: e.message }); + } + + if (p) throw redirect(307, `/fund/${body.name}`); + } +}; diff --git a/src/routes/(app)/send/fund/[name]/[...amount]/+page.svelte b/src/routes/(app)/send/fund/[name]/[...amount]/+page.svelte new file mode 100644 index 00000000..6aecf8f3 --- /dev/null +++ b/src/routes/(app)/send/fund/[name]/[...amount]/+page.svelte @@ -0,0 +1,58 @@ + + + + +{#if form?.message} +
+ {form.message} +
+{/if} + +
+ + + + + + + +
+ +
+ +
diff --git a/src/routes/(app)/send/pot/[name]/[...amount]/+page.server.js b/src/routes/(app)/send/pot/[name]/[...amount]/+page.server.js deleted file mode 100644 index 3f819696..00000000 --- a/src/routes/(app)/send/pot/[name]/[...amount]/+page.server.js +++ /dev/null @@ -1,17 +0,0 @@ -import { fail, redirect } from '@sveltejs/kit'; -import { auth, fd, post } from '$lib/utils'; - -export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - let p; - - try { - p = await post('/payments', body, auth(cookies)); - } catch (e) { - return fail(400, { message: e.message }); - } - - if (p) throw redirect(307, `/pot/${body.name}`); - } -}; diff --git a/src/routes/(app)/send/pot/[name]/[...amount]/+page.svelte b/src/routes/(app)/send/pot/[name]/[...amount]/+page.svelte deleted file mode 100644 index 6aecf8f3..00000000 --- a/src/routes/(app)/send/pot/[name]/[...amount]/+page.svelte +++ /dev/null @@ -1,58 +0,0 @@ - - - - -{#if form?.message} -
- {form.message} -
-{/if} - -
- - -
- - - - -
- -
-
-
-- cgit v1.2.3 From efdbc67c17fab67bf3cdce448a30aa82f62c5212 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 9 Nov 2023 16:49:10 -0800 Subject: funds --- src/components/AppHeader.svelte | 1 + src/locales/en.json | 4 +- src/routes/(app)/fund/[id]/+page.server.js | 23 ---- src/routes/(app)/fund/[id]/+page.svelte | 138 --------------------- src/routes/(app)/fund/[id]/sweep/+page.server.js | 14 --- src/routes/(app)/fund/[id]/sweep/+page.svelte | 37 ------ .../(app)/fund/[id]/withdraw/+page.server.js | 20 --- src/routes/(app)/fund/[id]/withdraw/+page.svelte | 58 --------- src/routes/(app)/fund/[id]/withdraw/+server.js | 6 - src/routes/(app)/funds/[id]/+page.server.js | 23 ++++ src/routes/(app)/funds/[id]/+page.svelte | 138 +++++++++++++++++++++ src/routes/(app)/funds/[id]/sweep/+page.server.js | 14 +++ src/routes/(app)/funds/[id]/sweep/+page.svelte | 37 ++++++ .../(app)/funds/[id]/withdraw/+page.server.js | 20 +++ src/routes/(app)/funds/[id]/withdraw/+page.svelte | 58 +++++++++ src/routes/(app)/funds/[id]/withdraw/+server.js | 6 + src/routes/(app)/send/[...text]/+page.svelte | 8 ++ static/icons/fund.svg | 63 ++++++++++ 18 files changed, 371 insertions(+), 297 deletions(-) delete mode 100644 src/routes/(app)/fund/[id]/+page.server.js delete mode 100644 src/routes/(app)/fund/[id]/+page.svelte delete mode 100644 src/routes/(app)/fund/[id]/sweep/+page.server.js delete mode 100644 src/routes/(app)/fund/[id]/sweep/+page.svelte delete mode 100644 src/routes/(app)/fund/[id]/withdraw/+page.server.js delete mode 100644 src/routes/(app)/fund/[id]/withdraw/+page.svelte delete mode 100644 src/routes/(app)/fund/[id]/withdraw/+server.js create mode 100644 src/routes/(app)/funds/[id]/+page.server.js create mode 100644 src/routes/(app)/funds/[id]/+page.svelte create mode 100644 src/routes/(app)/funds/[id]/sweep/+page.server.js create mode 100644 src/routes/(app)/funds/[id]/sweep/+page.svelte create mode 100644 src/routes/(app)/funds/[id]/withdraw/+page.server.js create mode 100644 src/routes/(app)/funds/[id]/withdraw/+page.svelte create mode 100644 src/routes/(app)/funds/[id]/withdraw/+server.js create mode 100644 static/icons/fund.svg (limited to 'src/routes/(app)/send') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 798073fb..4ee0c4a7 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -17,6 +17,7 @@ menuButtons = [ { key: 'nav.settings', icon: 'settings', href: `/${user.username}/settings` }, { key: 'nav.support', icon: 'support', href: `/support` }, + { key: 'nav.funds', icon: 'fund', href: `/${user.username}/funds` }, { key: 'nav.map', icon: 'map', href: `/${user.username}/map` }, { key: 'nav.merch', icon: 'shirt', href: `https://coinosmerch.com` }, { key: 'nav.signOut', icon: 'logout', href: `/logout` } diff --git a/src/locales/en.json b/src/locales/en.json index d3e294d4..7aa157d1 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -26,7 +26,8 @@ "error": { "header": "Error", "message": "Please try again or contact support.", - "signIn": "Please sign in to continue." + "signIn": "Please sign in to continue.", + "unrecognizedInput": "Unrecognized input" }, "faq": { "header": "FAQ", @@ -145,6 +146,7 @@ "failed": "Login failed" }, "nav": { + "funds": "Funds", "map": "Map", "merch": "Merch", "profile": "Profile", diff --git a/src/routes/(app)/fund/[id]/+page.server.js b/src/routes/(app)/fund/[id]/+page.server.js deleted file mode 100644 index 4194deed..00000000 --- a/src/routes/(app)/fund/[id]/+page.server.js +++ /dev/null @@ -1,23 +0,0 @@ -import { error, redirect } from '@sveltejs/kit'; -import { auth, get, post } from '$lib/utils'; -import Qr from 'qrcode-base64'; - -export let load = async ({ params: { id }, url }) => { - let { amount, payments } = await get(`/fund/${id}`); - - let src = Qr.drawImg(url.href, { size: 300 }); - return { amount, payments, src }; -}; - -export const actions = { - default: async ({ cookies, locals, params, request }) => { - let { user } = locals; - - if (user) { - await post('/redeem', params, auth(cookies)); - throw redirect(307, `/${user.username}/payments`); - } - - throw redirect(307, '/register'); - } -}; diff --git a/src/routes/(app)/fund/[id]/+page.svelte b/src/routes/(app)/fund/[id]/+page.svelte deleted file mode 100644 index d2d3079c..00000000 --- a/src/routes/(app)/fund/[id]/+page.svelte +++ /dev/null @@ -1,138 +0,0 @@ - - -
-
-
-
- - {#if id.split('-').length === 4} -

Card {id}

- {:else} - Fund -
-

{$t('payments.fund')}

-

{id}

-
- {/if} -
- {#if show} - {id} - {/if} -
-
-

- {f(amountFiat, currency)} -

-

- {sat(amount)} -

-
-
- -
- - -
- -
-
-
diff --git a/src/routes/(app)/fund/[id]/sweep/+page.server.js b/src/routes/(app)/fund/[id]/sweep/+page.server.js deleted file mode 100644 index 9fd244a3..00000000 --- a/src/routes/(app)/fund/[id]/sweep/+page.server.js +++ /dev/null @@ -1,14 +0,0 @@ -import { get, auth, post } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ cookies, params, parent }) { - let { user } = await parent(); - let { id } = params; - let { amount } = await get(`/fund/${id}`); - - - if (!amount) throw redirect(307, `/fund/${id}`); - if (!user) throw redirect(307, `/register?redirect=/fund/${id}/sweep`); - await post('/take', { amount, id }, auth(cookies)); - return { amount, id }; -} diff --git a/src/routes/(app)/fund/[id]/sweep/+page.svelte b/src/routes/(app)/fund/[id]/sweep/+page.svelte deleted file mode 100644 index 64bed4dd..00000000 --- a/src/routes/(app)/fund/[id]/sweep/+page.svelte +++ /dev/null @@ -1,37 +0,0 @@ - - -
-
- - - -
- -
- -
-

{$t('payments.fundsClaimed')}

-

- {f(fiat(amount, rate), currency)} -

-

- ⚡️{s(amount)} -

-
- - -
- - -
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.server.js b/src/routes/(app)/fund/[id]/withdraw/+page.server.js deleted file mode 100644 index 476149f2..00000000 --- a/src/routes/(app)/fund/[id]/withdraw/+page.server.js +++ /dev/null @@ -1,20 +0,0 @@ -import { fail, json, redirect } from '@sveltejs/kit'; -import { fd, auth, post } from '$lib/utils'; - -export async function load({ parent }) { - let { user } = await parent(); - if (!user) throw redirect(307, '/register'); -} - -export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - try { - await post('/take', body, auth(cookies)); - } catch (e) { - return fail(400, { message: e.message }); - } - - throw redirect(307, `/fund/${body.id}`); - } -}; diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.svelte b/src/routes/(app)/fund/[id]/withdraw/+page.svelte deleted file mode 100644 index 9cad945a..00000000 --- a/src/routes/(app)/fund/[id]/withdraw/+page.svelte +++ /dev/null @@ -1,58 +0,0 @@ - - - - -{#if form?.message} -
- {form.message} -
-{/if} - -
- - -
- - - - -
- -
-
-
diff --git a/src/routes/(app)/fund/[id]/withdraw/+server.js b/src/routes/(app)/fund/[id]/withdraw/+server.js deleted file mode 100644 index 0f9a23f3..00000000 --- a/src/routes/(app)/fund/[id]/withdraw/+server.js +++ /dev/null @@ -1,6 +0,0 @@ -import { json } from '@sveltejs/kit'; -import { auth, post } from '$lib/utils'; - -export async function POST({ cookies, request }) { - return json(await post('/take', await request.json(), auth(cookies))); -} diff --git a/src/routes/(app)/funds/[id]/+page.server.js b/src/routes/(app)/funds/[id]/+page.server.js new file mode 100644 index 00000000..4194deed --- /dev/null +++ b/src/routes/(app)/funds/[id]/+page.server.js @@ -0,0 +1,23 @@ +import { error, redirect } from '@sveltejs/kit'; +import { auth, get, post } from '$lib/utils'; +import Qr from 'qrcode-base64'; + +export let load = async ({ params: { id }, url }) => { + let { amount, payments } = await get(`/fund/${id}`); + + let src = Qr.drawImg(url.href, { size: 300 }); + return { amount, payments, src }; +}; + +export const actions = { + default: async ({ cookies, locals, params, request }) => { + let { user } = locals; + + if (user) { + await post('/redeem', params, auth(cookies)); + throw redirect(307, `/${user.username}/payments`); + } + + throw redirect(307, '/register'); + } +}; diff --git a/src/routes/(app)/funds/[id]/+page.svelte b/src/routes/(app)/funds/[id]/+page.svelte new file mode 100644 index 00000000..d2d3079c --- /dev/null +++ b/src/routes/(app)/funds/[id]/+page.svelte @@ -0,0 +1,138 @@ + + +
+
+
+
+ + {#if id.split('-').length === 4} +

Card {id}

+ {:else} + Fund +
+

{$t('payments.fund')}

+

{id}

+
+ {/if} +
+ {#if show} + {id} + {/if} +
+
+

+ {f(amountFiat, currency)} +

+

+ {sat(amount)} +

+
+
+ +
+ + +
+ +
+
+
diff --git a/src/routes/(app)/funds/[id]/sweep/+page.server.js b/src/routes/(app)/funds/[id]/sweep/+page.server.js new file mode 100644 index 00000000..9fd244a3 --- /dev/null +++ b/src/routes/(app)/funds/[id]/sweep/+page.server.js @@ -0,0 +1,14 @@ +import { get, auth, post } from '$lib/utils'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ cookies, params, parent }) { + let { user } = await parent(); + let { id } = params; + let { amount } = await get(`/fund/${id}`); + + + if (!amount) throw redirect(307, `/fund/${id}`); + if (!user) throw redirect(307, `/register?redirect=/fund/${id}/sweep`); + await post('/take', { amount, id }, auth(cookies)); + return { amount, id }; +} diff --git a/src/routes/(app)/funds/[id]/sweep/+page.svelte b/src/routes/(app)/funds/[id]/sweep/+page.svelte new file mode 100644 index 00000000..64bed4dd --- /dev/null +++ b/src/routes/(app)/funds/[id]/sweep/+page.svelte @@ -0,0 +1,37 @@ + + +
+
+ + + +
+ +
+ +
+

{$t('payments.fundsClaimed')}

+

+ {f(fiat(amount, rate), currency)} +

+

+ ⚡️{s(amount)} +

+
+ + +
+ + +
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/funds/[id]/withdraw/+page.server.js b/src/routes/(app)/funds/[id]/withdraw/+page.server.js new file mode 100644 index 00000000..476149f2 --- /dev/null +++ b/src/routes/(app)/funds/[id]/withdraw/+page.server.js @@ -0,0 +1,20 @@ +import { fail, json, redirect } from '@sveltejs/kit'; +import { fd, auth, post } from '$lib/utils'; + +export async function load({ parent }) { + let { user } = await parent(); + if (!user) throw redirect(307, '/register'); +} + +export const actions = { + default: async ({ cookies, request }) => { + let body = await fd(request); + try { + await post('/take', body, auth(cookies)); + } catch (e) { + return fail(400, { message: e.message }); + } + + throw redirect(307, `/fund/${body.id}`); + } +}; diff --git a/src/routes/(app)/funds/[id]/withdraw/+page.svelte b/src/routes/(app)/funds/[id]/withdraw/+page.svelte new file mode 100644 index 00000000..9cad945a --- /dev/null +++ b/src/routes/(app)/funds/[id]/withdraw/+page.svelte @@ -0,0 +1,58 @@ + + + + +{#if form?.message} +
+ {form.message} +
+{/if} + +
+ + +
+ + + + +
+ +
+
+
diff --git a/src/routes/(app)/funds/[id]/withdraw/+server.js b/src/routes/(app)/funds/[id]/withdraw/+server.js new file mode 100644 index 00000000..0f9a23f3 --- /dev/null +++ b/src/routes/(app)/funds/[id]/withdraw/+server.js @@ -0,0 +1,6 @@ +import { json } from '@sveltejs/kit'; +import { auth, post } from '$lib/utils'; + +export async function POST({ cookies, request }) { + return json(await post('/take', await request.json(), auth(cookies))); +} diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index c246f811..de84c287 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -35,6 +35,14 @@
+ {#if form?.error} +
+
+ {$t('error.unrecognizedInput')} +
+
+ {/if} +
diff --git a/static/icons/fund.svg b/static/icons/fund.svg new file mode 100644 index 00000000..93bd87f5 --- /dev/null +++ b/static/icons/fund.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From ae87f1d43c6d2cf34bd2ea6fd7b4d28af6d2aa91 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 10 Nov 2023 21:33:49 -0800 Subject: nav update --- src/components/AppHeader.svelte | 9 +- src/locales/en.json | 30 ++--- .../(app)/[username]/(profile)/+layout.svelte | 32 ++--- src/routes/(app)/[username]/(profile)/+page.svelte | 20 ++- src/routes/(app)/[username]/funds/+page.server.js | 0 src/routes/(app)/[username]/funds/+page.svelte | 56 +++++++++ src/routes/(app)/fund/[id]/+page.server.js | 23 ++++ src/routes/(app)/fund/[id]/+page.svelte | 138 +++++++++++++++++++++ src/routes/(app)/fund/[id]/sweep/+page.server.js | 14 +++ src/routes/(app)/fund/[id]/sweep/+page.svelte | 37 ++++++ .../(app)/fund/[id]/withdraw/+page.server.js | 20 +++ src/routes/(app)/fund/[id]/withdraw/+page.svelte | 58 +++++++++ src/routes/(app)/fund/[id]/withdraw/+server.js | 6 + src/routes/(app)/funds/[id]/+page.server.js | 23 ---- src/routes/(app)/funds/[id]/+page.svelte | 138 --------------------- src/routes/(app)/funds/[id]/sweep/+page.server.js | 14 --- src/routes/(app)/funds/[id]/sweep/+page.svelte | 37 ------ .../(app)/funds/[id]/withdraw/+page.server.js | 20 --- src/routes/(app)/funds/[id]/withdraw/+page.svelte | 58 --------- src/routes/(app)/funds/[id]/withdraw/+server.js | 6 - src/routes/(app)/send/[...text]/+page.svelte | 2 +- src/routes/+page.svelte | 2 +- static/icons/about.svg | 12 ++ static/icons/book.svg | 4 + static/icons/camera.svg | 54 +------- static/icons/fund.svg | 65 +--------- static/icons/funds.svg | 52 ++++++++ static/icons/home.svg | 46 +------ static/icons/message.svg | 3 + static/icons/receive.svg | 16 +++ static/icons/shop.svg | 2 + static/icons/support.svg | 5 +- 32 files changed, 491 insertions(+), 511 deletions(-) create mode 100644 src/routes/(app)/[username]/funds/+page.server.js create mode 100644 src/routes/(app)/[username]/funds/+page.svelte create mode 100644 src/routes/(app)/fund/[id]/+page.server.js create mode 100644 src/routes/(app)/fund/[id]/+page.svelte create mode 100644 src/routes/(app)/fund/[id]/sweep/+page.server.js create mode 100644 src/routes/(app)/fund/[id]/sweep/+page.svelte create mode 100644 src/routes/(app)/fund/[id]/withdraw/+page.server.js create mode 100644 src/routes/(app)/fund/[id]/withdraw/+page.svelte create mode 100644 src/routes/(app)/fund/[id]/withdraw/+server.js delete mode 100644 src/routes/(app)/funds/[id]/+page.server.js delete mode 100644 src/routes/(app)/funds/[id]/+page.svelte delete mode 100644 src/routes/(app)/funds/[id]/sweep/+page.server.js delete mode 100644 src/routes/(app)/funds/[id]/sweep/+page.svelte delete mode 100644 src/routes/(app)/funds/[id]/withdraw/+page.server.js delete mode 100644 src/routes/(app)/funds/[id]/withdraw/+page.svelte delete mode 100644 src/routes/(app)/funds/[id]/withdraw/+server.js create mode 100644 static/icons/about.svg create mode 100644 static/icons/book.svg create mode 100644 static/icons/funds.svg create mode 100644 static/icons/message.svg create mode 100644 static/icons/receive.svg create mode 100644 static/icons/shop.svg (limited to 'src/routes/(app)/send') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 4ee0c4a7..4ccd2d03 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -17,10 +17,7 @@ menuButtons = [ { key: 'nav.settings', icon: 'settings', href: `/${user.username}/settings` }, { key: 'nav.support', icon: 'support', href: `/support` }, - { key: 'nav.funds', icon: 'fund', href: `/${user.username}/funds` }, - { key: 'nav.map', icon: 'map', href: `/${user.username}/map` }, - { key: 'nav.merch', icon: 'shirt', href: `https://coinosmerch.com` }, - { key: 'nav.signOut', icon: 'logout', href: `/logout` } + { key: 'nav.signOut', icon: 'logout', href: `/logout` }, ]; let showMenu = false; @@ -56,7 +53,7 @@ .url.pathname === `/${user.username}/receive` ? 'opacity-100' : 'opacity-70 hover:opacity-80'}" - > + > @@ -116,8 +113,6 @@ {/each} -
-
Coinos
diff --git a/src/locales/en.json b/src/locales/en.json index 7aa157d1..9ecd3702 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -31,21 +31,13 @@ }, "faq": { "header": "FAQ", - "why": { - "question": "Why accept Bitcoin?", - "answer": "With Bitcoin, merchants save on fees, consumers gain privacy and savers gain purchasing power. We'll promote your business to an enthusiastic community that prefers to shop at places that take Bitcoin." - }, "cost": { "question": "What does it cost?", - "answer": "Receiving payments into your account is free. Withdrawals to external wallets incur a small fee that varies depending on network conditions. We charge 0.1% to convert between lightning and on-chain Bitcoin. Sending to other Coinos accounts is free." - }, - "individuals": { - "question": "Who can use it?", - "answer": "Anyone, anywhere in the world. Coinos is suitable for individuals and businesses." + "answer": "Receiving payments into your account is free. Withdrawals to external wallets incur a small fee that varies depending on network conditions." }, "compatibility": { "question": "Do I need any special device or software?", - "answer": "No, Coinos is a web app that works anywhere that has Internet. Merchants might use it on a tablet or put up a QR code for customers to scan with their phone." + "answer": "No, Coinos works anywhere that has Internet. Merchants might use it on a tablet or put up a QR code for customers to scan with their phone." }, "safety": { "question": "When do my funds settle?", @@ -55,14 +47,6 @@ "question": "Can Coinos integrate with my existing PoS?", "answer": "We recommend entering sales into your existing PoS as cash transactions." }, - "accounting": { - "question": "What about accounting?", - "answer": "We display all payments in terms of your local currency and let you filter by date so you can report your income as normal. You can export your account history to a csv file. If you sell Bitcoin for a profit you may wish to report capital gains." - }, - "offramp": { - "question": "Can I convert the Bitcoin I receive to my local currency?", - "answer": "You can withdraw your funds at any time to an exchange or brokerage to sell your Bitcoin and receive a bank transfer. We may be willing to provide direct settlement via e-transfer to select Canadian merchants." - }, "bitcoin": { "question": "What can I do with Bitcoin?", "answer": "Spend it at other merchants or pay your expenses with it by getting your staff, suppliers and landlord to take it." @@ -146,14 +130,17 @@ "failed": "Login failed" }, "nav": { + "about": "About", + "docs": "Docs", + "messages": "Messages", "funds": "Funds", "map": "Map", - "merch": "Merch", + "merch": "Shop", "profile": "Profile", "startInSeconds": "Start in Seconds", "account": "Account", "signIn": "Sign In", - "signOut": "Sign Out", + "signOut": "Sign out", "dashboard": "Dashboard", "settings": "Settings", "support": "Support" @@ -203,7 +190,7 @@ }, "send": { "contacts": "Contacts", - "scan": "Scan QR", + "scan": "Scan", "paste": "Paste", "next": "Next", "placeholder": "Paste a bitcoin address, lightning invoice or coinos username" @@ -265,6 +252,7 @@ } }, "payments": { + "create": "Create", "fund": "Fund", "addFunds": "Add Funds", "takeFunds": "Take Funds", diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 35c316bb..8790aaf2 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -17,7 +17,7 @@ $: ({ currency, username: n, display } = subject); $: username = n.length > 60 ? n.substr(0, 6) : display || n; - $: npub = bech32m.encode('npub', toWords(hexToUint8Array(user.pubkey)), 180); + $: npub = bech32m.encode('npub', toWords(hexToUint8Array(subject.pubkey)), 180); $: lnaddr = `${n}@${$page.url.host}`; $: profile = `${$page.url.host}/${n}`; @@ -147,7 +147,7 @@ {#if following}
{/if} - {#if user && user.username !== subject.username && subject.pubkey} + {#if !subject.anon && subject.username !== user?.username}
-
+
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index 84aa4425..180b12bd 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -96,21 +96,21 @@ {/if}
- - diff --git a/src/routes/(app)/[username]/funds/+page.server.js b/src/routes/(app)/[username]/funds/+page.server.js new file mode 100644 index 00000000..e69de29b diff --git a/src/routes/(app)/[username]/funds/+page.svelte b/src/routes/(app)/[username]/funds/+page.svelte new file mode 100644 index 00000000..6479fb8b --- /dev/null +++ b/src/routes/(app)/[username]/funds/+page.svelte @@ -0,0 +1,56 @@ + + +
+

+ Funds +

+ +
+
+
+
+ +
+ +
+
+ +
+
+
+ Pot +
+ +
Pot
+
+
+ +
+
+ +
+
+
+
+ + +
+
+ + diff --git a/src/routes/(app)/fund/[id]/+page.server.js b/src/routes/(app)/fund/[id]/+page.server.js new file mode 100644 index 00000000..4194deed --- /dev/null +++ b/src/routes/(app)/fund/[id]/+page.server.js @@ -0,0 +1,23 @@ +import { error, redirect } from '@sveltejs/kit'; +import { auth, get, post } from '$lib/utils'; +import Qr from 'qrcode-base64'; + +export let load = async ({ params: { id }, url }) => { + let { amount, payments } = await get(`/fund/${id}`); + + let src = Qr.drawImg(url.href, { size: 300 }); + return { amount, payments, src }; +}; + +export const actions = { + default: async ({ cookies, locals, params, request }) => { + let { user } = locals; + + if (user) { + await post('/redeem', params, auth(cookies)); + throw redirect(307, `/${user.username}/payments`); + } + + throw redirect(307, '/register'); + } +}; diff --git a/src/routes/(app)/fund/[id]/+page.svelte b/src/routes/(app)/fund/[id]/+page.svelte new file mode 100644 index 00000000..d2d3079c --- /dev/null +++ b/src/routes/(app)/fund/[id]/+page.svelte @@ -0,0 +1,138 @@ + + +
+
+
+
+ + {#if id.split('-').length === 4} +

Card {id}

+ {:else} + Fund +
+

{$t('payments.fund')}

+

{id}

+
+ {/if} +
+ {#if show} + {id} + {/if} +
+
+

+ {f(amountFiat, currency)} +

+

+ {sat(amount)} +

+
+
+ +
+ + +
+ +
+
+
diff --git a/src/routes/(app)/fund/[id]/sweep/+page.server.js b/src/routes/(app)/fund/[id]/sweep/+page.server.js new file mode 100644 index 00000000..9fd244a3 --- /dev/null +++ b/src/routes/(app)/fund/[id]/sweep/+page.server.js @@ -0,0 +1,14 @@ +import { get, auth, post } from '$lib/utils'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ cookies, params, parent }) { + let { user } = await parent(); + let { id } = params; + let { amount } = await get(`/fund/${id}`); + + + if (!amount) throw redirect(307, `/fund/${id}`); + if (!user) throw redirect(307, `/register?redirect=/fund/${id}/sweep`); + await post('/take', { amount, id }, auth(cookies)); + return { amount, id }; +} diff --git a/src/routes/(app)/fund/[id]/sweep/+page.svelte b/src/routes/(app)/fund/[id]/sweep/+page.svelte new file mode 100644 index 00000000..64bed4dd --- /dev/null +++ b/src/routes/(app)/fund/[id]/sweep/+page.svelte @@ -0,0 +1,37 @@ + + +
+
+ + + +
+ +
+ +
+

{$t('payments.fundsClaimed')}

+

+ {f(fiat(amount, rate), currency)} +

+

+ ⚡️{s(amount)} +

+
+ + +
+ + +
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.server.js b/src/routes/(app)/fund/[id]/withdraw/+page.server.js new file mode 100644 index 00000000..476149f2 --- /dev/null +++ b/src/routes/(app)/fund/[id]/withdraw/+page.server.js @@ -0,0 +1,20 @@ +import { fail, json, redirect } from '@sveltejs/kit'; +import { fd, auth, post } from '$lib/utils'; + +export async function load({ parent }) { + let { user } = await parent(); + if (!user) throw redirect(307, '/register'); +} + +export const actions = { + default: async ({ cookies, request }) => { + let body = await fd(request); + try { + await post('/take', body, auth(cookies)); + } catch (e) { + return fail(400, { message: e.message }); + } + + throw redirect(307, `/fund/${body.id}`); + } +}; diff --git a/src/routes/(app)/fund/[id]/withdraw/+page.svelte b/src/routes/(app)/fund/[id]/withdraw/+page.svelte new file mode 100644 index 00000000..9cad945a --- /dev/null +++ b/src/routes/(app)/fund/[id]/withdraw/+page.svelte @@ -0,0 +1,58 @@ + + + + +{#if form?.message} +
+ {form.message} +
+{/if} + +
+ + + + + + + +
+ +
+ +
diff --git a/src/routes/(app)/fund/[id]/withdraw/+server.js b/src/routes/(app)/fund/[id]/withdraw/+server.js new file mode 100644 index 00000000..0f9a23f3 --- /dev/null +++ b/src/routes/(app)/fund/[id]/withdraw/+server.js @@ -0,0 +1,6 @@ +import { json } from '@sveltejs/kit'; +import { auth, post } from '$lib/utils'; + +export async function POST({ cookies, request }) { + return json(await post('/take', await request.json(), auth(cookies))); +} diff --git a/src/routes/(app)/funds/[id]/+page.server.js b/src/routes/(app)/funds/[id]/+page.server.js deleted file mode 100644 index 4194deed..00000000 --- a/src/routes/(app)/funds/[id]/+page.server.js +++ /dev/null @@ -1,23 +0,0 @@ -import { error, redirect } from '@sveltejs/kit'; -import { auth, get, post } from '$lib/utils'; -import Qr from 'qrcode-base64'; - -export let load = async ({ params: { id }, url }) => { - let { amount, payments } = await get(`/fund/${id}`); - - let src = Qr.drawImg(url.href, { size: 300 }); - return { amount, payments, src }; -}; - -export const actions = { - default: async ({ cookies, locals, params, request }) => { - let { user } = locals; - - if (user) { - await post('/redeem', params, auth(cookies)); - throw redirect(307, `/${user.username}/payments`); - } - - throw redirect(307, '/register'); - } -}; diff --git a/src/routes/(app)/funds/[id]/+page.svelte b/src/routes/(app)/funds/[id]/+page.svelte deleted file mode 100644 index d2d3079c..00000000 --- a/src/routes/(app)/funds/[id]/+page.svelte +++ /dev/null @@ -1,138 +0,0 @@ - - -
-
-
-
- - {#if id.split('-').length === 4} -

Card {id}

- {:else} - Fund -
-

{$t('payments.fund')}

-

{id}

-
- {/if} -
- {#if show} - {id} - {/if} -
-
-

- {f(amountFiat, currency)} -

-

- {sat(amount)} -

-
-
- -
- - -
- -
-
-
diff --git a/src/routes/(app)/funds/[id]/sweep/+page.server.js b/src/routes/(app)/funds/[id]/sweep/+page.server.js deleted file mode 100644 index 9fd244a3..00000000 --- a/src/routes/(app)/funds/[id]/sweep/+page.server.js +++ /dev/null @@ -1,14 +0,0 @@ -import { get, auth, post } from '$lib/utils'; -import { redirect } from '@sveltejs/kit'; - -export async function load({ cookies, params, parent }) { - let { user } = await parent(); - let { id } = params; - let { amount } = await get(`/fund/${id}`); - - - if (!amount) throw redirect(307, `/fund/${id}`); - if (!user) throw redirect(307, `/register?redirect=/fund/${id}/sweep`); - await post('/take', { amount, id }, auth(cookies)); - return { amount, id }; -} diff --git a/src/routes/(app)/funds/[id]/sweep/+page.svelte b/src/routes/(app)/funds/[id]/sweep/+page.svelte deleted file mode 100644 index 64bed4dd..00000000 --- a/src/routes/(app)/funds/[id]/sweep/+page.svelte +++ /dev/null @@ -1,37 +0,0 @@ - - -
-
- - - -
- -
- -
-

{$t('payments.fundsClaimed')}

-

- {f(fiat(amount, rate), currency)} -

-

- ⚡️{s(amount)} -

-
- - -
- - -
{$t('payments.tapAnywhere')}
diff --git a/src/routes/(app)/funds/[id]/withdraw/+page.server.js b/src/routes/(app)/funds/[id]/withdraw/+page.server.js deleted file mode 100644 index 476149f2..00000000 --- a/src/routes/(app)/funds/[id]/withdraw/+page.server.js +++ /dev/null @@ -1,20 +0,0 @@ -import { fail, json, redirect } from '@sveltejs/kit'; -import { fd, auth, post } from '$lib/utils'; - -export async function load({ parent }) { - let { user } = await parent(); - if (!user) throw redirect(307, '/register'); -} - -export const actions = { - default: async ({ cookies, request }) => { - let body = await fd(request); - try { - await post('/take', body, auth(cookies)); - } catch (e) { - return fail(400, { message: e.message }); - } - - throw redirect(307, `/fund/${body.id}`); - } -}; diff --git a/src/routes/(app)/funds/[id]/withdraw/+page.svelte b/src/routes/(app)/funds/[id]/withdraw/+page.svelte deleted file mode 100644 index 9cad945a..00000000 --- a/src/routes/(app)/funds/[id]/withdraw/+page.svelte +++ /dev/null @@ -1,58 +0,0 @@ - - - - -{#if form?.message} -
- {form.message} -
-{/if} - -
- - -
- - - - -
- -
-
-
diff --git a/src/routes/(app)/funds/[id]/withdraw/+server.js b/src/routes/(app)/funds/[id]/withdraw/+server.js deleted file mode 100644 index 0f9a23f3..00000000 --- a/src/routes/(app)/funds/[id]/withdraw/+server.js +++ /dev/null @@ -1,6 +0,0 @@ -import { json } from '@sveltejs/kit'; -import { auth, post } from '$lib/utils'; - -export async function POST({ cookies, request }) { - return json(await post('/take', await request.json(), auth(cookies))); -} diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index de84c287..b2c9616c 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -61,7 +61,7 @@ type="button" class="flex border rounded-full px-6 py-2 font-bold hover:opacity-80 mr-1" > - +
{$t('user.send.scan')}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ec9f55b7..0aaf887d 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -89,7 +89,7 @@
-

{$t('faq.header')}

+

{$t('faq.header')}

{#each Object.keys(faqs).filter((f) => f !== 'header') as faqID} {/each} diff --git a/static/icons/about.svg b/static/icons/about.svg new file mode 100644 index 00000000..3222097f --- /dev/null +++ b/static/icons/about.svg @@ -0,0 +1,12 @@ + + + + about + + + + + + + + \ No newline at end of file diff --git a/static/icons/book.svg b/static/icons/book.svg new file mode 100644 index 00000000..4d7b091d --- /dev/null +++ b/static/icons/book.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/static/icons/camera.svg b/static/icons/camera.svg index b615c7b5..3568ed14 100644 --- a/static/icons/camera.svg +++ b/static/icons/camera.svg @@ -1,49 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + \ No newline at end of file diff --git a/static/icons/fund.svg b/static/icons/fund.svg index 93bd87f5..0ffd17cd 100644 --- a/static/icons/fund.svg +++ b/static/icons/fund.svg @@ -1,63 +1,4 @@ - - - - - - - - - - - - - + + + \ No newline at end of file diff --git a/static/icons/funds.svg b/static/icons/funds.svg new file mode 100644 index 00000000..f3d0c5a0 --- /dev/null +++ b/static/icons/funds.svg @@ -0,0 +1,52 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/static/icons/home.svg b/static/icons/home.svg index 2aa2cbed..c3482cdd 100644 --- a/static/icons/home.svg +++ b/static/icons/home.svg @@ -1,42 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + \ No newline at end of file diff --git a/static/icons/message.svg b/static/icons/message.svg new file mode 100644 index 00000000..47b935b5 --- /dev/null +++ b/static/icons/message.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/receive.svg b/static/icons/receive.svg new file mode 100644 index 00000000..143ae144 --- /dev/null +++ b/static/icons/receive.svg @@ -0,0 +1,16 @@ + + + + + + + + + \ No newline at end of file diff --git a/static/icons/shop.svg b/static/icons/shop.svg new file mode 100644 index 00000000..15b2918c --- /dev/null +++ b/static/icons/shop.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/static/icons/support.svg b/static/icons/support.svg index 47b935b5..f9265ed8 100644 --- a/static/icons/support.svg +++ b/static/icons/support.svg @@ -1,3 +1,2 @@ - - - + + \ No newline at end of file -- cgit v1.2.3 From cb6f474608cd0b91c2cf3258f2b07f930bc6f8b7 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 20 Nov 2023 14:38:36 -0800 Subject: add qr generator button --- src/locales/en.json | 1 + src/routes/(app)/send/[...text]/+page.svelte | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'src/routes/(app)/send') diff --git a/src/locales/en.json b/src/locales/en.json index c68b5b91..2e7b2079 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -189,6 +189,7 @@ "showQR": "Show QR" }, "send": { + "makeQR": "QR", "contacts": "Contacts", "scan": "Scan", "paste": "Paste", diff --git a/src/routes/(app)/send/[...text]/+page.svelte b/src/routes/(app)/send/[...text]/+page.svelte index b2c9616c..74afd846 100644 --- a/src/routes/(app)/send/[...text]/+page.svelte +++ b/src/routes/(app)/send/[...text]/+page.svelte @@ -56,6 +56,18 @@
+ {#if text?.length} + + + + {/if} + - - - - - - - - - - -
- (showMenu = false)}> - +
+ -
- -
-
+
+ +
+ Coinos +
+
+
+ {:else} + + + + {/if} + +
+ +
+ {/if} diff --git a/src/components/Avatar.svelte b/src/components/Avatar.svelte index b258a0e8..3955a42f 100644 --- a/src/components/Avatar.svelte +++ b/src/components/Avatar.svelte @@ -1,29 +1,31 @@ -
- {user.username} -
+
+ {user.username} +
diff --git a/src/components/Balance.svelte b/src/components/Balance.svelte index 0e4f2ec2..92714f98 100644 --- a/src/components/Balance.svelte +++ b/src/components/Balance.svelte @@ -1,34 +1,34 @@ {#if show && user.haspin && $pin?.length !== 6} - (show = false)} /> + (show = false)} /> {/if}
- {#if user.haspin && !$pin} - - {:else} -
- {#if isNaN($animatedRate)} -
—
- {:else} - {f((user.balance * $animatedRate) / sats, user.currency)} - {/if} -
+ {#if user.haspin && !$pin} + + {:else} +
+ {#if isNaN($animatedRate)} +
—
+ {:else} + {f((user.balance * $animatedRate) / sats, user.currency)} + {/if} +
-
- ⚡️{s(user.balance)} -
- {/if} +
+ ⚡️{s(user.balance)} +
+ {/if}
diff --git a/src/components/Calendar.svelte b/src/components/Calendar.svelte index 7504f48e..b07c136c 100644 --- a/src/components/Calendar.svelte +++ b/src/components/Calendar.svelte @@ -1,14 +1,14 @@ - + diff --git a/src/components/Card.svelte b/src/components/Card.svelte index 44ab635f..864465c0 100644 --- a/src/components/Card.svelte +++ b/src/components/Card.svelte @@ -1,14 +1,14 @@ - + diff --git a/src/components/Check.svelte b/src/components/Check.svelte index 4c9f504b..222c4dea 100644 --- a/src/components/Check.svelte +++ b/src/components/Check.svelte @@ -1,11 +1,11 @@ diff --git a/src/components/Code.svelte b/src/components/Code.svelte index ffca98a4..6c1048cf 100644 --- a/src/components/Code.svelte +++ b/src/components/Code.svelte @@ -1,27 +1,31 @@ -
-
-
{samples[sample]}
-
- +
+
+
{samples[sample]}
+
+
diff --git a/src/components/Event.svelte b/src/components/Event.svelte index 68f44589..2312f44e 100644 --- a/src/components/Event.svelte +++ b/src/components/Event.svelte @@ -1,84 +1,87 @@ -
- -
-
- -
- -
-
+
+ +
+
+ +
+ +
+
-
-
-
- {user.display_name || ''} - @{user.username} -
-
 {distance(seen)}
-
-
- {content} -
+
+
+
+ {user.display_name || ""} + @{user.username} +
+
 {distance(seen)}
+
+
+ {content} +
-
-
- -
444
-
-
- -
1072
-
-
- -
26
-
-
- -
4
-
-
-
+
+
+ +
444
+
+
+ +
1072
+
+
+ +
26
+
+
+ +
4
+
+
+
diff --git a/src/components/FaqCard.svelte b/src/components/FaqCard.svelte index 918e03d6..ae1ad077 100644 --- a/src/components/FaqCard.svelte +++ b/src/components/FaqCard.svelte @@ -1,15 +1,15 @@
-

{$t('faq.' + questionID + '.question')}

-

- {$t('faq.' + questionID + '.answer')} -

+

{$t("faq." + questionID + ".question")}

+

+ {$t("faq." + questionID + ".answer")} +

diff --git a/src/components/Feed.svelte b/src/components/Feed.svelte index 7de087a7..0c9c96d1 100644 --- a/src/components/Feed.svelte +++ b/src/components/Feed.svelte @@ -1,72 +1,84 @@ {#if user} -
-
- -
- -
+
+
+ +
+ +
{/if} {#if browser} - {#if sorted.length} - - - - - - {:else} -
-
{$t('user.noNotes')}
-
- {/if} + {#if sorted.length} + + + + + + {:else} +
+
{$t("user.noNotes")}
+
+ {/if} {/if} diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index eda26526..c1ac79cf 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -1,65 +1,74 @@ -