From 1b3accf009e859f6098c659cdbed695e5b17b641 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 27 Feb 2023 10:30:10 -0800 Subject: don't redirect homepage --- src/routes/(app)/+layout.server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/+layout.server.js b/src/routes/(app)/+layout.server.js index 881dbccc..ef278744 100644 --- a/src/routes/(app)/+layout.server.js +++ b/src/routes/(app)/+layout.server.js @@ -19,7 +19,7 @@ export async function load({ cookies, request, url, params }) { throw redirect(307, `/migrate`); } - if (user && ['/', '/login', '/register'].includes(pathname) && request.method === 'GET') { + if (user && ['/login', '/register'].includes(pathname) && request.method === 'GET') { throw redirect(307, `/${user.username}`); } -- cgit v1.2.3 From 301770cb05331c8cbb32f60b11c62a79c9d28df3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 27 Feb 2023 19:28:59 -0800 Subject: prettier --- src/components/AppHeader.svelte | 1 - src/components/LandingHeader.svelte | 26 +++++++-------- .../(app)/[username]/invoice/[hash]/+page.svelte | 36 +++++++-------------- src/routes/(app)/payment/[id]/+page.svelte | 37 +++++++++++----------- .../bitcoin/[address]/[...amount]/+page.svelte | 10 ++++-- src/routes/(app)/sent/+page.svelte | 2 +- 6 files changed, 52 insertions(+), 60 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 74afd7b9..51c70851 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -15,7 +15,6 @@ let menuButtons; if (user) menuButtons = [ - { key: 'nav.profile', icon: 'profile', href: `/${user.username}` }, { key: 'nav.settings', icon: 'settings', href: `/${user.username}/settings` }, { key: 'nav.support', icon: 'support', href: `/support` }, { key: 'nav.signOut', icon: 'logout', href: `/logout` } diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index f9db5ea0..ed7907c1 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -40,29 +40,29 @@ {/if} - {#if !user} + {#if user} {:else} {/if} diff --git a/src/routes/(app)/[username]/invoice/[hash]/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/+page.svelte index 2ff92687..fff2b22c 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[hash]/+page.svelte @@ -7,7 +7,6 @@ import { last } from '$lib/store'; import { Avatar, Icon, Heart, Image } from '$comp'; import { t } from '$lib/translations'; - import screenfull from 'screenfull'; import { goto, invalidate } from '$app/navigation'; export let data; @@ -67,14 +66,6 @@ $: link = type === 'bitcoin' ? text : `lightning:${text}`; $: txt = type === 'bitcoin' ? hash : text; - let full; - let toggle = () => { - screenfull.toggle(qr); - full = !full; - if (full) src = lg; - else src = sm; - }; - let toggleType = async () => { invoice.type = invoice.type === types.lightning ? types.bitcoin : types.lightning; ({ hash } = await post(`/${username}/invoice`, { @@ -111,21 +102,18 @@
Bitcoin
-
-
- {txt} -
-
+ +
+ + {#if amount > 0} diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index b8a23605..2e170a43 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -26,14 +26,14 @@ {#if p.with}
{amount > 0 ? 'From' : 'To'} - - {/if} @@ -42,18 +42,19 @@
{f(fiat(a, rate), currency)} {#if tip} - - + {f(fiat(tip, rate), currency)} - + + + {f(fiat(tip, rate), currency)} + {/if} - ⚡️{`${s(a)}`} - - {#if tip} - - + ⚡️{s(tip)} - - {/if} - + ⚡️{`${s(a)}`} + + {#if tip} + + + ⚡️{s(tip)} + + {/if} +
diff --git a/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.svelte b/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.svelte index b3a944f4..77d5fde6 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/[...amount]/+page.svelte @@ -22,7 +22,7 @@ loading = false; if (form?.message?.includes('pin')) $pin = undefined; if (form) ({ min, max, feeRate, fee, ourfee, subtract } = form); - if (!ourfee) ourfee = 0; + if (!ourfee) ourfee = 0; if (feeRate) confirmed = true; stale = false; }; @@ -77,7 +77,9 @@ {f(toFiat(fee + ourfee, $selectedRate), currency)}

⚡️{s(fee + ourfee)}

- +
{:else} @@ -104,7 +106,9 @@
- +
{/if} diff --git a/src/routes/(app)/sent/+page.svelte b/src/routes/(app)/sent/+page.svelte index 72511487..760d2e1d 100644 --- a/src/routes/(app)/sent/+page.svelte +++ b/src/routes/(app)/sent/+page.svelte @@ -7,7 +7,7 @@ export let data; let { payments, user } = data; - let { currency, username } = user; + let { currency, username } = user; let payment = payments[0]; let { amount, rate, tip } = payment; -- cgit v1.2.3 From 3651919e5a2e4783b05d8af369f0d24e279b15c8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 1 Mar 2023 22:40:45 -0800 Subject: support form captcha --- src/routes/(app)/support/+page.server.js | 15 --------- src/routes/(app)/support/+page.svelte | 57 +++++++++++++++++++++----------- src/routes/(app)/support/+server.js | 7 ++++ 3 files changed, 44 insertions(+), 35 deletions(-) delete mode 100644 src/routes/(app)/support/+page.server.js create mode 100644 src/routes/(app)/support/+server.js (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/support/+page.server.js b/src/routes/(app)/support/+page.server.js deleted file mode 100644 index 6d0af616..00000000 --- a/src/routes/(app)/support/+page.server.js +++ /dev/null @@ -1,15 +0,0 @@ -import { fd, post } from '$lib/utils'; -import { fail } from '@sveltejs/kit'; - -export const actions = { - default: async ({ cookies, request }) => { - let form = await fd(request); - try { - await post('/email', form); - } catch (e) { - return fail(400, { error: e.message }); - } - - return { success: true }; - } -}; diff --git a/src/routes/(app)/support/+page.svelte b/src/routes/(app)/support/+page.svelte index d00cc069..8dbfc1af 100644 --- a/src/routes/(app)/support/+page.svelte +++ b/src/routes/(app)/support/+page.svelte @@ -1,10 +1,10 @@ + + + + {#if user} {/if} -{#if form?.error} -
- {form.error} -
-{/if} +
+ {#if sent} +

Thank you!

+
Someone will be in touch shortly.
-
- {#if form?.success} -

Thank you!

-

Someone will be in touch shortly.

- - - - + {:else}

{$t('user.support.header')}

-

+

Fill out this form or email us directly at support@coinos.io and we'll do our best to get back to you in a timely manner.

-
+
Date: Wed, 1 Mar 2023 22:54:28 -0800 Subject: disable prerendering --- src/routes/(app)/support/+server.js | 2 ++ src/routes/+page.server.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/support/+server.js b/src/routes/(app)/support/+server.js index af5fcc66..6b1778a8 100644 --- a/src/routes/(app)/support/+server.js +++ b/src/routes/(app)/support/+server.js @@ -1,6 +1,8 @@ import { json } from '@sveltejs/kit'; import { auth, post } from '$lib/utils'; +export const prerender = false; + export async function POST({ cookies, request }) { let result = await post('/email', await request.json(), auth(cookies)); return json(result); diff --git a/src/routes/+page.server.js b/src/routes/+page.server.js index 4bcc6089..7936e88b 100644 --- a/src/routes/+page.server.js +++ b/src/routes/+page.server.js @@ -1,6 +1,6 @@ import { get } from '$lib/utils'; -export const prerender = true; +// export const prerender = true; export let load = async () => { let data = { locations: [] }; -- cgit v1.2.3 From 0c3cb465a91941531a09cd53f3e4b0b78f24784f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 3 Mar 2023 12:33:29 -0800 Subject: use div for message input --- src/app.css | 1 - .../(app)/[username]/(profile)/+layout.svelte | 1 - src/routes/(app)/[username]/dashboard/+page.svelte | 1 - src/routes/(app)/[username]/messages/+page.svelte | 36 +++++++++++++--------- .../[username]/payments/[...page]/+page.svelte | 2 +- .../(app)/launch/thanks/[asset]/+page.server.js | 1 - src/routes/(app)/send/[...text]/+page.svelte | 1 - src/routes/(app)/send/invoice/[id]/+page.server.js | 2 +- .../(app)/send/lightning/[payreq]/+page.server.js | 2 +- .../user/[username]/[...amount]/+page.server.js | 2 +- src/routes/(static)/bounties/+page.svelte | 2 +- 11 files changed, 27 insertions(+), 24 deletions(-) delete mode 100644 src/routes/(app)/launch/thanks/[asset]/+page.server.js (limited to 'src/routes/(app)') diff --git a/src/app.css b/src/app.css index 12fad732..3a722fb1 100644 --- a/src/app.css +++ b/src/app.css @@ -35,7 +35,6 @@ button.primary { -webkit-appearance: none; -moz-appearance: none; background: transparent; - background-image: url('/icons/down.svg'); background-repeat: no-repeat; background-position-x: 95%; background-position-y: 1em; diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 6eb2a850..133930b1 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -4,7 +4,6 @@ import { Icon } from '$comp'; import { t } from '$lib/translations'; import { sign, send } from '$lib/nostr'; - import { v4 } from 'uuid'; export let data; let events, user, subject, src, text; diff --git a/src/routes/(app)/[username]/dashboard/+page.svelte b/src/routes/(app)/[username]/dashboard/+page.svelte index 499034e6..d8761ea9 100644 --- a/src/routes/(app)/[username]/dashboard/+page.svelte +++ b/src/routes/(app)/[username]/dashboard/+page.svelte @@ -7,7 +7,6 @@ import { goto } from '$app/navigation'; import { t } from '$lib/translations'; import { events } from '$lib/store'; - import { v4 } from 'uuid'; export let data; $: ({ invoices, requests } = data); diff --git a/src/routes/(app)/[username]/messages/+page.svelte b/src/routes/(app)/[username]/messages/+page.svelte index 5de18c66..7a10d605 100644 --- a/src/routes/(app)/[username]/messages/+page.svelte +++ b/src/routes/(app)/[username]/messages/+page.svelte @@ -2,7 +2,7 @@ import { cubicInOut } from 'svelte/easing'; import { browser } from '$app/environment'; import { t } from '$lib/translations'; - import { format, parseISO } from 'date-fns'; + import { format } from 'date-fns'; import { scale, fade, fly } from 'svelte/transition'; import { enhance } from '$app/forms'; import { Avatar, Icon } from '$comp'; @@ -68,7 +68,6 @@ event.message = message; message = ''; - input.focus(); event.author = user; event.recipient = subject; @@ -92,9 +91,16 @@ message = ''; submitting = false; }; + + let keydown = (e) => { + if (e.key === 'Enter') { + e.preventDefault(); + submit(); + } + }; -
+
- + - - - +
diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index aacba81e..a502f8c3 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -1,7 +1,7 @@ -
+
{samples[sample]}
diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index ae69e70a..7520e5d4 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -5,7 +5,7 @@ const followLinks = [ { url: 'https://twitter.com/coinoswallet', titleID: 'twitter' }, { url: 'https://t.me/coinoswallet', titleID: 'telegram' }, - { url: 'https://linktr.ee/coinos.io', titleID: 'linktree' }, + { url: 'https://linktr.ee/coinos.io', titleID: 'linktree' } ]; const companyLinks = [ diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index 133930b1..bbb2379e 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -59,6 +59,9 @@ t++; }, 10); }; + + let hideBio = true; + let toggleBio = () => (hideBio = false);
@@ -66,7 +69,11 @@

{display || username}

-
+
{subject.address && subject.address !== 'null' ? subject.address : ''}
diff --git a/src/routes/(static)/bounties/+page.svelte b/src/routes/(static)/bounties/+page.svelte index e3670e78..32a962fc 100644 --- a/src/routes/(static)/bounties/+page.svelte +++ b/src/routes/(static)/bounties/+page.svelte @@ -54,8 +54,11 @@

⚡️750,000 will be awarded once the merchant has accepted bitcoin for 6 months. We'll be sending - shadowy supertaggersshadowy supertaggers to check up on them periodically.

diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte index cb82bd05..8ddb98cd 100644 --- a/src/routes/(static)/docs/+page.svelte +++ b/src/routes/(static)/docs/+page.svelte @@ -7,7 +7,7 @@ let api = PUBLIC_COINOS_URL + '/api'; if (!token) token = ''; - let tokenSample = `export token="${token}"`; + let tokenSample = `export token="${token}"`;
@@ -31,8 +31,8 @@

Auth Token

This JWT authorizes you to use the API

-
{tokenSample}
-
diff --git a/tailwind.config.cjs b/tailwind.config.cjs index c57db020..1d082420 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -12,6 +12,6 @@ module.exports = { } } }, - plugins: [require('tailwind-scrollbar')], + plugins: [require('tailwind-scrollbar'), require('@tailwindcss/line-clamp')], safelist: ['w-16', 'h-16', 'w-20', 'h-20', 'w-24', 'h-24'] }; -- cgit v1.2.3 From 2810139cfb19643527c8be4589ab1562c441f618 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 11 Mar 2023 10:21:02 -0800 Subject: prompt for tip on internal payments --- src/routes/(app)/send/invoice/[id]/+page.server.js | 14 ++++++++----- src/routes/(app)/send/invoice/[id]/+page.svelte | 24 +++++++++++++++++----- src/routes/(app)/sent/+page.server.js | 1 + 3 files changed, 29 insertions(+), 10 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 3db03123..c3ae0945 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -1,22 +1,26 @@ import { error, fail, redirect } from '@sveltejs/kit'; import { fd, auth, get, post } from '$lib/utils'; -export async function load({ params: { id }, parent }) { +export async function load({ params: { id }, parent, url }) { let { user } = await parent(); - let { amount, address, tip, text, user: recipient } = await get(`/invoice/${id}`); + let { amount, address, rate, prompt, tip, text, user: recipient } = await get(`/invoice/${id}`); + + console.log("AMOUNT, TIP", amount, tip) + + if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); - if (tip) amount += tip; - return { amount, address, payreq: text, recipient }; + return { amount, address, tip, rate, payreq: text, recipient }; } export const actions = { default: async ({ cookies, params: { hash }, request }) => { try { let body = await fd(request); - body.amount = parseInt(body.amount); body.hash = hash; + console.log("SENDING BODY", body) + await post('/payments', body, auth(cookies)); } catch (e) { return fail(400, { message: e.message }); diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index 7570a61a..c9cb9392 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -5,11 +5,11 @@ import { enhance } from '$app/forms'; import { Avatar, Icon, Numpad, Spinner } from '$comp'; import { page } from '$app/stores'; - import { back, f, s, sats } from '$lib/utils'; + import { back, f, fiat as toFiat, s, sats } from '$lib/utils'; export let data; export let form; - let { address, payreq, recipient, user } = data; + let { address, payreq, recipient, rate, tip, user } = data; let { currency } = user; let amount = form?.amount || data.amount; @@ -49,9 +49,23 @@

{$t('payments.send')}

-

- {fiat ? f(amountFiat, currency) : '⚡️' + s(amount)} -

+

+ {f(toFiat(amount, rate), currency)} + {#if tip} + + + {f(toFiat(tip, rate), currency)} + + {/if} +

+

+ ⚡️{s(amount)} + + {#if tip} + + + ⚡️{s(tip)} + + {/if} +

{$t('payments.to')}

diff --git a/src/routes/(app)/sent/+page.server.js b/src/routes/(app)/sent/+page.server.js index 381ff32f..cfd43472 100644 --- a/src/routes/(app)/sent/+page.server.js +++ b/src/routes/(app)/sent/+page.server.js @@ -2,5 +2,6 @@ import { get, auth } from '$lib/utils'; export let load = async ({ cookies }) => { let { payments } = await get('/payments', auth(cookies)); + console.log("HUH", payments[0]) return { payments }; }; -- cgit v1.2.3 From 9b5f8947c05ee59225ffa100e4ebd83d2a243b57 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 11 Mar 2023 16:23:15 -0800 Subject: rm log --- src/routes/(app)/send/invoice/[id]/+page.server.js | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index c3ae0945..0d23d307 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -6,8 +6,6 @@ export async function load({ params: { id }, parent, url }) { let { amount, address, rate, prompt, tip, text, user: recipient } = await get(`/invoice/${id}`); - console.log("AMOUNT, TIP", amount, tip) - if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); return { amount, address, tip, rate, payreq: text, recipient }; @@ -19,8 +17,6 @@ export const actions = { let body = await fd(request); body.hash = hash; - console.log("SENDING BODY", body) - await post('/payments', body, auth(cookies)); } catch (e) { return fail(400, { message: e.message }); -- cgit v1.2.3 From ffb2a1c2ccfeb8d6002644e2fcefe60a7fd20d05 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 11 Mar 2023 16:36:40 -0800 Subject: prompt for tip --- src/components/About.svelte | 2 +- .../(app)/[username]/invoice/[hash]/+layout.server.js | 2 +- src/routes/(app)/send/invoice/[id]/+page.server.js | 2 +- .../(app)/send/user/[username]/[...amount]/+page.svelte | 16 +++++----------- src/routes/(app)/sent/+page.server.js | 2 +- 5 files changed, 9 insertions(+), 15 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/components/About.svelte b/src/components/About.svelte index b468750d..4292b9fd 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -12,7 +12,7 @@ { type: 'github', url: 'https://github.com/asoltys', color: 'bg-gray-800' } ] }, - { name: 'cole', socials: [] }, + { name: 'cole', socials: [] } ]; diff --git a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js index b5323d3f..7cf87e14 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js +++ b/src/routes/(app)/[username]/invoice/[hash]/+layout.server.js @@ -19,7 +19,7 @@ export async function load({ depends, params, url, parent }) { if (paid && !url.pathname.endsWith('paid')) throw redirect(307, `/${params.username}/invoice/${hash}/paid`); - let sm = Qr.drawImg(invoice.text, { size: 300 }); + let sm = Qr.drawImg(invoice.text || '', { size: 300 }); return { hash, invoice, sm, lg: sm }; } diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 0d23d307..261345fa 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -6,7 +6,7 @@ export async function load({ params: { id }, parent, url }) { let { amount, address, rate, prompt, tip, text, user: recipient } = await get(`/invoice/${id}`); - if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); + if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); return { amount, address, tip, rate, payreq: text, recipient }; } diff --git a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte index 1bb88277..af6a6368 100644 --- a/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte +++ b/src/routes/(app)/send/user/[username]/[...amount]/+page.svelte @@ -30,11 +30,15 @@ ({ hash } = await post(`/${subject.username}/invoice`, { invoice: { amount, + hash: 'internal', rate: rates[subject.currency], + prompt: subject.prompt, type: 'internal' }, user: subject })); + + goto(`/${subject.username}/invoice/${hash}`); }; let loading; @@ -56,17 +60,7 @@ {/if}
- {#if amount} -

Sending

-
-

- {f(amountFiat, currency)} -

-

{sat(amount)}

-
- {:else} - - {/if} +
diff --git a/src/routes/(app)/sent/+page.server.js b/src/routes/(app)/sent/+page.server.js index cfd43472..d949906a 100644 --- a/src/routes/(app)/sent/+page.server.js +++ b/src/routes/(app)/sent/+page.server.js @@ -2,6 +2,6 @@ import { get, auth } from '$lib/utils'; export let load = async ({ cookies }) => { let { payments } = await get('/payments', auth(cookies)); - console.log("HUH", payments[0]) + console.log('HUH', payments[0]); return { payments }; }; -- cgit v1.2.3 From f5eaf3eac19e0e2902b894effb14b58cc8c21d2d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 11 Mar 2023 17:47:15 -0800 Subject: fix param name --- src/routes/(app)/[username]/invoice/+server.js | 6 ++++-- .../(app)/[username]/invoice/[hash]/tip/+page.svelte | 4 ++++ src/routes/(app)/send/invoice/[id]/+page.server.js | 17 +++++++++++++---- src/routes/(app)/sent/+page.server.js | 1 - 4 files changed, 21 insertions(+), 7 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/invoice/+server.js b/src/routes/(app)/[username]/invoice/+server.js index 1321739e..461d380c 100644 --- a/src/routes/(app)/[username]/invoice/+server.js +++ b/src/routes/(app)/[username]/invoice/+server.js @@ -1,5 +1,7 @@ import { auth, post } from '$lib/utils'; import { json } from '@sveltejs/kit'; -export let POST = async ({ cookies: c, request: r }) => - json(await post('/invoice', await r.json(), auth(c))); +export let POST = async ({ cookies: c, request: r }) => { + let j = await r.json(); + return json(await post('/invoice', j, auth(c))); +}; diff --git a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte index 296ef9c6..9d9021a6 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[hash]/tip/+page.svelte @@ -59,6 +59,7 @@ let { invoice, id, user } = data; let { amount, + hash, type, rate, received, @@ -79,6 +80,7 @@ ({ invoice, id } = data); ({ amount, + hash, type, rate, received, @@ -110,6 +112,8 @@ + +

{$t('invoice.addTipq')}

diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.js b/src/routes/(app)/send/invoice/[id]/+page.server.js index 261345fa..c9c2b222 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.js +++ b/src/routes/(app)/send/invoice/[id]/+page.server.js @@ -4,18 +4,27 @@ import { fd, auth, get, post } from '$lib/utils'; export async function load({ params: { id }, parent, url }) { let { user } = await parent(); - let { amount, address, rate, prompt, tip, text, user: recipient } = await get(`/invoice/${id}`); + let { + amount, + address, + hash, + rate, + prompt, + tip, + text, + user: recipient + } = await get(`/invoice/${id}`); if (prompt && tip === null) throw redirect(307, `/${recipient.username}/invoice/${id}/tip`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); - return { amount, address, tip, rate, payreq: text, recipient }; + return { amount, address, hash, tip, rate, payreq: text, recipient }; } export const actions = { - default: async ({ cookies, params: { hash }, request }) => { + default: async ({ cookies, params: { id }, request }) => { try { let body = await fd(request); - body.hash = hash; + body.hash = id; await post('/payments', body, auth(cookies)); } catch (e) { diff --git a/src/routes/(app)/sent/+page.server.js b/src/routes/(app)/sent/+page.server.js index d949906a..381ff32f 100644 --- a/src/routes/(app)/sent/+page.server.js +++ b/src/routes/(app)/sent/+page.server.js @@ -2,6 +2,5 @@ import { get, auth } from '$lib/utils'; export let load = async ({ cookies }) => { let { payments } = await get('/payments', auth(cookies)); - console.log('HUH', payments[0]); return { payments }; }; -- cgit v1.2.3 From a865df6eb042bb305d2f880386fd6d9e5551ec4d Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 13 Mar 2023 00:44:43 -0700 Subject: payments page formatting --- .../[username]/payments/[...page]/+page.svelte | 32 +++++++++--------- src/routes/(app)/payment/[id]/+page.svelte | 39 +++++++++++++--------- 2 files changed, 40 insertions(+), 31 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index a502f8c3..84891b92 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -60,9 +60,11 @@ payments = payments.map((p) => ({ ...p, created: new Date(p.created), + total: p.amount + p.tip || 0, amount_fiat: f((p.amount * p.rate) / sats, p.currency), fee_fiat: p.fee ? f((p.fee * p.rate) / sats, p.currency) : null, - tip_fiat: p.tip ? f((p.tip * p.rate) / sats, p.currency) : null + tip_fiat: p.tip ? f((p.tip * p.rate) / sats, p.currency) : null, + total_fiat: f(((p.amount + p.tip || 0) * p.rate) / sats, p.currency) })); let keys = [ @@ -72,11 +74,13 @@ 'rate', 'currency', 'amount', - 'fee', 'tip', + 'total', + 'fee', 'amount_fiat', - 'fee_fiat', - 'tip_fiat' + 'tip_fiat', + 'total_fiat', + 'fee_fiat' ]; let csv = @@ -143,24 +147,20 @@
{/if} -
Amount
{f(fiat(a, rate), currency)} - {#if tip} - - + {f(fiat(tip, rate), currency)} - - {/if} - ⚡️{`${s(a)}`} - - {#if tip} - - + ⚡️{s(tip)} - - {/if} + + ⚡️{s(a)}
+ {#if tip} +
+ Tip +
+ {f(fiat(tip, rate), currency)} + + ⚡️{s(tip)} + +
+
+ +
+ Total +
+ {f(fiat(a + tip || 0, rate), currency)} + ⚡️{`${s(a + tip || 0)}`} +
+
+ {/if} +
Network fee
{f(fiat(fee, rate), currency)} - ⚡️{`${s(fee)}`} + ⚡️{`${s(fee)}`}
-- cgit v1.2.3 From cfa8570d59cbf89bc83b4ab9a6264ff776b1af90 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 13 Mar 2023 00:49:08 -0700 Subject: order of operations --- src/routes/(app)/[username]/payments/[...page]/+page.svelte | 8 ++++---- src/routes/(app)/payment/[id]/+page.svelte | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index 84891b92..aa2ad72b 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -60,11 +60,11 @@ payments = payments.map((p) => ({ ...p, created: new Date(p.created), - total: p.amount + p.tip || 0, + total: p.amount + (p.tip || 0), amount_fiat: f((p.amount * p.rate) / sats, p.currency), fee_fiat: p.fee ? f((p.fee * p.rate) / sats, p.currency) : null, tip_fiat: p.tip ? f((p.tip * p.rate) / sats, p.currency) : null, - total_fiat: f(((p.amount + p.tip || 0) * p.rate) / sats, p.currency) + total_fiat: f(((p.amount + (p.tip || 0)) * p.rate) / sats, p.currency) })); let keys = [ @@ -147,8 +147,8 @@
-
- {f((Math.abs(p.amount) + p.tip || 0) * (p.rate / sats), p.currency)} +
+ {f((Math.abs(p.amount) + (p.tip || 0)) * (p.rate / sats), p.currency)} {#if p.tip} {f(Math.abs(p.amount) * (p.rate / sats), p.currency)} + {f( diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index c3f8cdf0..34e2d327 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -61,8 +61,8 @@
Total
- {f(fiat(a + tip || 0, rate), currency)} - ⚡️{`${s(a + tip || 0)}`} + {f(fiat(a + (tip || 0), rate), currency)} + ⚡️{`${s(a + (tip || 0))}`}
{/if} -- cgit v1.2.3 From e060d628c03cce102ecdc5dd77b0d2b7a7634eae Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 13 Mar 2023 10:05:26 -0700 Subject: fix amount display --- src/routes/(app)/[username]/payments/[...page]/+page.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index aa2ad72b..4e2e6ede 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -160,7 +160,7 @@
- {sat(p.amount + p.tip)} + {sat(p.amount + (p.tip || 0))}
-- cgit v1.2.3 From 77219cc4fa9e75d2ca2f740f024c17aa5dda9129 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 13 Mar 2023 13:19:35 -0700 Subject: fix tip display --- src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte b/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte index 3a281728..4d7aae51 100644 --- a/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[hash]/paid/+page.svelte @@ -21,7 +21,7 @@ {#if received}

{$t('invoice.paymentSuccessful')}

- {f(fiat(received - tip, rate), currency)} + {f(fiat(received, rate), currency)} {#if tip} + {f(fiat(tip, rate), currency)} @@ -29,7 +29,7 @@ {/if}

- ⚡️{s(received - tip)} + ⚡️{s(received)} {#if tip} @@ -48,7 +48,7 @@ {/if}

- ⚡️{s(pending - tip)} + ⚡️{s(pending)} {#if tip} + ⚡️{s(tip)} -- cgit v1.2.3 From 45063c606338af61fce751adc99b4369956ec163 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 13 Mar 2023 20:22:37 -0700 Subject: translations update --- src/locales/en.json | 11 +------- src/locales/es.json | 29 +++++----------------- .../[username]/(profile)/followers/+page.svelte | 3 ++- .../[username]/(profile)/follows/+page.svelte | 3 ++- .../[username]/settings/[...tab]/+page.svelte | 2 +- src/routes/(app)/sent/+page.svelte | 2 +- 6 files changed, 13 insertions(+), 37 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/locales/en.json b/src/locales/en.json index 4915277a..180a15f2 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -15,20 +15,10 @@ "position": "Chief Technical Officer", "bio": "Adam is a web developer and bitcoin enthusiast who believes sound money is key to increasing global prosperity. He lives in North Vancouver with his wife Chelsea and two children." }, - "shauna": { - "name": "Shauna", - "position": "Operations & Marketing", - "bio": "Strategic & Project Management. Jack of all Trades. Can always find time to meet for coffee." - }, "cole": { "name": "Cole", "position": "Certified Bitcoin Professional", "bio": "Cole is a driven individual with a passion for freedom. He came across bitcoin in 2016 and studied it in depth. Now he wants to introduce the lightning network to as many users as possible." - }, - "john": { - "name": "John Barratt", - "position": "Full Stack Web Developer", - "bio": "When not coding you can find John out in the woods hiking all the great trails that BC has to offer." } }, "locations": { @@ -195,6 +185,7 @@ "placeholder": "Paste a bitcoin address, lightning invoice or coinos username" }, "settings": { + "saveSettings": "Save Settings", "bannerImage": "Banner Image", "profileImage": "Profile Image", "oneTimeCode": "Enter one-time code", diff --git a/src/locales/es.json b/src/locales/es.json index 8e68a5f3..5a2a5123 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -15,31 +15,10 @@ "position": "Director de Tecnología", "bio": "Adam es un desarrollador web y un entusiasta de bitcoin que cree que el dinero sólido es clave para aumentar la prosperidad global. Vive en la ciudad de North Vancouver con su esposa Chelsea y sus dos hijos." }, - "secondl1ght": { - "name": "secondl1ght", - "position": "Desarrollador Web", - "bio": "Desarrollador web autodidacta, se sumergió de cabeza en con el bitcoin y dejó su trabajo fiduciario para concentrarse en el desarrollo de bitcoin a tiempo completo. Contribuye en proyectos de código abierto, es un defensor de la privacidad y un amante de la libertad." - }, - - "karnage": { - "name": "Karnage", - "position": "Diseñador de Producto", - "bio": "Mi misión es ayudar a los fundadores de startups a tener éxito. Creo productos para lograr estos objetivos. Diseño de producto con píxeles perfectos. Haz que te lo envíen." - }, - "shauna": { - "name": "Shauna", - "position": "Operaciones y Mercadeo", - "bio": "Gestión Estratégica y de Proyectos. Sé un poco de todo. Siempre habrá tiempo para compartir un buen café." - }, "cole": { "name": "Cole", "position": "Profesional de Bitcoin", "bio": "Como profesional certificado de Bitcoin, Cole es una persona motivada y apasionada por la libertad. Conoció el bitcoin en 2016 y lo estudió en profundidad. Ahora quiere presentarle la Red Lightning a tantos usuarios como sea posible." - }, - "john": { - "name": "John Barratt", - "position": "Desarrollador Web Full Stack", - "bio": "Cuando no está programando, podemos encontrar a John en el bosque recorriendo todos los grandes senderos que British Columbia tiene para ofrecer." } }, "locations": { @@ -165,6 +144,7 @@ "invoice": "Factura", "unfollow": "Dejar de seguir", "following": "Siguiendo", + "followers": "Seguidores", "follow": "Seguir", "remove": "Eliminar", "scanToPayBTC": "Escanear para pagar con bitcoin", @@ -198,6 +178,9 @@ "placeholder": "Asigne una dirección de bitcoin, una factura lightning o un usuario de coinos" }, "settings": { + "saveSettings": "Guardar ajustes", + "tipPrompt": "Solicitar propinas", + "tipPromptDescription": "Pregunta a las personas si quieren agregar una propina antes de pagar sus facturas", "bannerImage": "Imagen del Banner", "profileImage": "Imagen de perfil", "oneTimeCode": "Ingrese el código de un solo uso", @@ -243,7 +226,7 @@ "send": "Enviar" } }, - "transactions": { + "payments": { "header": "Transacciones", "AMOUNT": "CANTIDAD", "TYPE": "TIPO", @@ -253,7 +236,7 @@ "empty": "Aún no hay transacciones.", "send": "Enviado", "next": "Siguiente", - "sendersChoice": "Sender's choice", + "sendersChoice": "Elección del remitente", "sendTo": "Enviar a", "to": "para", "pay": "Pagar", diff --git a/src/routes/(app)/[username]/(profile)/followers/+page.svelte b/src/routes/(app)/[username]/(profile)/followers/+page.svelte index 77b337b6..9c425449 100644 --- a/src/routes/(app)/[username]/(profile)/followers/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/followers/+page.svelte @@ -1,4 +1,5 @@ + + +
+ +
diff --git a/src/routes/(app)/admin/+page.server.js b/src/routes/(app)/admin/+page.server.js new file mode 100644 index 00000000..c4079a2f --- /dev/null +++ b/src/routes/(app)/admin/+page.server.js @@ -0,0 +1,10 @@ +import { get } from '$lib/utils'; +import { redirect } from '@sveltejs/kit'; + +export async function load({ parent }) { + let { user } = await parent(); + if (!user) throw redirect(307, '/login'); + + let users = (await get('/users')).sort((a, b) => b.balance - a.balance); + return { users }; +} diff --git a/src/routes/(app)/admin/+page.svelte b/src/routes/(app)/admin/+page.svelte new file mode 100644 index 00000000..1a747f1f --- /dev/null +++ b/src/routes/(app)/admin/+page.svelte @@ -0,0 +1,11 @@ + + +{#each users as { balance, username }} +
+
{username}
+
{balance}
+
+{/each} diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 34e2d327..cf30db35 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -62,7 +62,7 @@ Total
{f(fiat(a + (tip || 0), rate), currency)} - ⚡️{`${s(a + (tip || 0))}`} + ⚡️{`${s(a + (tip || 0))}`}

{/if} diff --git a/src/routes/(app)/sent/+page.svelte b/src/routes/(app)/sent/+page.svelte index 72973c50..dbd18c2e 100644 --- a/src/routes/(app)/sent/+page.svelte +++ b/src/routes/(app)/sent/+page.svelte @@ -20,7 +20,7 @@
-

{$t('payments.sent')}!

+

{$t('payments.sent')}!

{f(fiat(amount, rate), currency)} {#if tip} -- cgit v1.2.3