diff options
| author | Adam Soltys <[email protected]> | 2023-10-08 00:17:32 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-10-08 00:17:32 -0700 |
| commit | 0212fe0032eb0c5d6bfb74ebaab42543b73d6d6b (patch) | |
| tree | 56bffdb4556c10bde68d5aed3bea389197e9965c | |
| parent | 222bbc9080fbb15861cc5c0802449fcf06a53532 (diff) | |
| download | coinos-ui-0212fe0032eb0c5d6bfb74ebaab42543b73d6d6b.tar.gz coinos-ui-0212fe0032eb0c5d6bfb74ebaab42543b73d6d6b.zip | |
payments fixes
34 files changed, 173 insertions, 168 deletions
diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 8f1fe947..798073fb 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -121,7 +121,7 @@ </OutClick> </div> {:else} - <a href={`/login?redirect=${$page.url.pathname}`}> + <a href={`/login?redirect=${$page.url.pathname}`}> <button class="bg-white px-5 py-2 rounded-xl font-semibold text-sm" >{$t('nav.signIn')}</button > diff --git a/src/components/Balance.svelte b/src/components/Balance.svelte index 96edf630..0e4f2ec2 100644 --- a/src/components/Balance.svelte +++ b/src/components/Balance.svelte @@ -9,14 +9,14 @@ </script> {#if show && user.haspin && $pin?.length !== 6} - <Pin cancel={() => (show = false)} /> + <Pin cancel={() => (show = false)} /> {/if} <div class="space-y-2"> {#if user.haspin && !$pin} <button class="text-sm md:text-lg rounded-full border py-2 px-4 hover:opacity-80 min-w-[72px] bg-black text-white" - on:click={() => (show = true)}>{$t('user.showBalance')}</button + on:click={() => (show = true)}>{$t('user.showBalance')}</button > {:else} <div class="text-5xl font-bold tabular-nums"> diff --git a/src/components/Code.svelte b/src/components/Code.svelte index dd0cecf2..ffca98a4 100644 --- a/src/components/Code.svelte +++ b/src/components/Code.svelte @@ -9,9 +9,7 @@ <div class="overflow-x-scroll max-w-full scrollbar-hide"> <div class="break-all min-w-[800px]">{samples[sample]}</div> </div> - <button - class="ml-auto my-auto invert opacity-90" - on:click={() => copy(samples[sample])} + <button class="ml-auto my-auto invert opacity-90" on:click={() => copy(samples[sample])} ><Icon icon="copy" style="w-10 max-w-none" /></button > </div> diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte index 9dfbc3de..eda26526 100644 --- a/src/components/Footer.svelte +++ b/src/components/Footer.svelte @@ -10,7 +10,7 @@ const companyLinks = [ { url: '/docs', titleID: 'documentation' }, - { url: '/support', titleID: 'support' }, + { url: '/support', titleID: 'support' } ]; </script> diff --git a/src/components/LocationsMap.svelte b/src/components/LocationsMap.svelte index f927331c..7876659a 100644 --- a/src/components/LocationsMap.svelte +++ b/src/components/LocationsMap.svelte @@ -127,8 +127,8 @@ } :global(.maplibregl-ctrl-attrib) { - display: none; - } + display: none; + } :global(.maplibregl-popup-content) { padding: 0.5em 1em; diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index d8475340..57e0eeed 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -88,7 +88,11 @@ {/if} <form class="space-y-5" on:submit|preventDefault={handleSubmit} method="POST"> - <input type="hidden" name="loginRedirect" value={$loginRedirect || $page.url.searchParams.get('redirect')} /> + <input + type="hidden" + name="loginRedirect" + value={$loginRedirect || $page.url.searchParams.get('redirect')} + /> <input type="hidden" name="token" value={token} /> <div> diff --git a/src/lib/invoice.js b/src/lib/invoice.js index 23ce1757..218972c6 100644 --- a/src/lib/invoice.js +++ b/src/lib/invoice.js @@ -21,16 +21,16 @@ export default async ({ cookies, request, url }) => { let user = { username: form.get('username'), currency: form.get('currency') }; invoice = await post('/invoice', { invoice, user }, auth(cookies)); - let { hash } = invoice; + let { id } = invoice; if (request_id) { if (url.pathname.endsWith('tip')) { - throw redirect(307, `/send/invoice/${hash}`); + throw redirect(307, `/send/invoice/${id}`); } throw redirect(307, `/${user.username}/request/${request_id}`); } - if (invoice.prompt) throw redirect(307, `/${user.username}/invoice/${hash}/tip`); - else throw redirect(307, `/${user.username}/invoice/${hash}`); + if (invoice.prompt) throw redirect(307, `/${user.username}/invoice/${id}/tip`); + else throw redirect(307, `/${user.username}/invoice/${id}`); }; diff --git a/src/lib/socket.js b/src/lib/socket.js index e8859fa6..96fde317 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -1,5 +1,5 @@ import { get } from 'svelte/store'; -import { event, invoice, request, newPayment, last, rate, payments, user } from '$lib/store'; +import { event, invoice, request, newPayment, last, rate, user } from '$lib/store'; import { success, sat } from '$lib/utils'; import { PUBLIC_SOCKET } from '$env/static/public'; import { invalidate } from '$app/navigation'; @@ -34,23 +34,13 @@ export const messages = (data) => ({ }, async payment() { - let { amount, invoice } = data; + let { amount, confirmed } = data; + invalidate('app:user'); invalidate('app:invoice'); - - let p = get(payments); - let i = p.findIndex((p) => p.id === data.id); - - if (~i) { - p[i] = data; - payments.set(p); - } else newPayment.set(true); - - invalidate((url) => url.pathname === '/payments'); + invalidate('app:payments'); if (amount > 0) { - success(`${data.confirmed ? 'Received' : 'Detected'} ${sat(amount)}!`); - } else { - // success(`Sent ${sat(amount)}!`); + success(`${confirmed ? 'Received' : 'Detected'} ${sat(amount)}!`); } }, diff --git a/src/lib/store.js b/src/lib/store.js index 923bda52..64cf015e 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -45,7 +45,6 @@ export const decrypted = persistLocal('decrypted', {}); export const newPayment = persistLocal('newPayment'); export const password = persistLocal('password'); export const passwordPrompt = writable(); -export const payments = persistLocal('transactions', []); export const pin = writable(); export const rate = writable(); export const request = writable(); diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte index ed8a90f3..331161bb 100644 --- a/src/routes/(app)/[username]/(profile)/+layout.svelte +++ b/src/routes/(app)/[username]/(profile)/+layout.svelte @@ -51,16 +51,16 @@ <div class="w-[240px] lg:absolute space-y-5 left-20 mx-auto lg:mr-10"> <h1 class="text-3xl font-bold text-center mx-auto">{display || username}</h1> - {#if subject.address} - <div - class="text-secondary mx-auto text-center lg:text-left lg:mx-0" - class:line-clamp-3={hideBio} - on:click={toggleBio} - on:keydown={toggleBio} - > - {subject.address} - </div> - {/if} + {#if subject.address} + <div + class="text-secondary mx-auto text-center lg:text-left lg:mx-0" + class:line-clamp-3={hideBio} + on:click={toggleBio} + on:keydown={toggleBio} + > + {subject.address} + </div> + {/if} <div class="flex justify-around"> <a href={`/${subject.pubkey}/follows`} diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte index 2de58873..84aa4425 100644 --- a/src/routes/(app)/[username]/(profile)/+page.svelte +++ b/src/routes/(app)/[username]/(profile)/+page.svelte @@ -95,7 +95,9 @@ <div class="flex flex-wrap gap-4 justify-center w-full"> <a href={`/${user.username}/receive`} class="w-full md:w-60"> - <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-full md:w-60"> + <button + class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-full md:w-60" + > <div class="mx-auto flex"> <Icon icon="numpad" style="my-auto h-6 mr-2" /> <div class="my-auto mt-1">{$t('user.requestPayment')}</div> @@ -103,7 +105,9 @@ </button> </a> <a href={`/scan`} class="w-full md:w-60"> - <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-full md:w-60"> + <button + class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-full md:w-60" + > <div class="mx-auto flex"> <Icon icon="scan" style="my-auto h-6 mr-2" /> <div class="my-auto mt-1">{$t('user.send.scan')}</div> diff --git a/src/routes/(app)/[username]/card/[serial]/+page.svelte b/src/routes/(app)/[username]/card/[serial]/+page.svelte index aee3be28..afdaf65d 100644 --- a/src/routes/(app)/[username]/card/[serial]/+page.svelte +++ b/src/routes/(app)/[username]/card/[serial]/+page.svelte @@ -6,30 +6,30 @@ </script> <div class="space-y-5"> -<div class="relative flex justify-center gap-2"> - <h1 class="text-2xl md:text-3xl font-semibold my-auto">Card {serial}</h1> -</div> -<div class="flex justify-center"> - <a href={`/send/pot/${serial}`}> - <button - class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60 bg-black text-white justify-center gap-2" - > - <svg - xmlns="http://www.w3.org/2000/svg" - class="invert text-black peer-placeholder-shown:text-gray-300 h-6 w-6 my-auto" - fill="none" - viewBox="0 0 24 24" - stroke="currentColor" + <div class="relative flex justify-center gap-2"> + <h1 class="text-2xl md:text-3xl font-semibold my-auto">Card {serial}</h1> + </div> + <div class="flex justify-center"> + <a href={`/send/pot/${serial}`}> + <button + class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60 bg-black text-white justify-center gap-2" > - <path - stroke-linecap="round" - stroke-linejoin="round" - stroke-width="2" - d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" - /> - </svg> - <div class="my-auto">Add Funds</div> - </button> - </a> -</div> + <svg + xmlns="http://www.w3.org/2000/svg" + class="invert text-black peer-placeholder-shown:text-gray-300 h-6 w-6 my-auto" + fill="none" + viewBox="0 0 24 24" + stroke="currentColor" + > + <path + stroke-linecap="round" + stroke-linejoin="round" + stroke-width="2" + d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z" + /> + </svg> + <div class="my-auto">Add Funds</div> + </button> + </a> + </div> </div> diff --git a/src/routes/(app)/[username]/generate/+page.svelte b/src/routes/(app)/[username]/generate/+page.svelte index 33bf64c4..b9274434 100644 --- a/src/routes/(app)/[username]/generate/+page.svelte +++ b/src/routes/(app)/[username]/generate/+page.svelte @@ -14,10 +14,10 @@ let gen = async () => { if (!browser) return; - if (user.pubkey) { - goto($loginRedirect || `/${user.username}`, { invalidateAll: true }); - return; - } + if (user.pubkey) { + goto($loginRedirect || `/${user.username}`, { invalidateAll: true }); + return; + } if (!$password) $passwordPrompt = true; diff --git a/src/routes/(app)/[username]/invoice/[id]/+page.svelte b/src/routes/(app)/[username]/invoice/[id]/+page.svelte index 508550ba..2d204255 100644 --- a/src/routes/(app)/[username]/invoice/[id]/+page.svelte +++ b/src/routes/(app)/[username]/invoice/[id]/+page.svelte @@ -101,12 +101,12 @@ let toggleType = async () => { invoice.type = invoice.type === types.lightning ? types.bitcoin : types.lightning; - ({ hash } = await post(`/${username}/invoice`, { + ({ id } = await post(`/${username}/invoice`, { invoice, user: { username, currency } })); - goto(`./${hash}`, { invalidateAll: true }); + goto(`./${id}`, { invalidateAll: true }); }; </script> diff --git a/src/routes/(app)/[username]/map/+page.svelte b/src/routes/(app)/[username]/map/+page.svelte index b5e4dfad..99c822d3 100644 --- a/src/routes/(app)/[username]/map/+page.svelte +++ b/src/routes/(app)/[username]/map/+page.svelte @@ -1,6 +1,6 @@ <script> - import { LocationsMap } from "$comp"; - export let data; + import { LocationsMap } from '$comp'; + export let data; let { locations } = data; </script> diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.server.js b/src/routes/(app)/[username]/payments/[...page]/+page.server.js index cb94d71d..a3b0ad6f 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.server.js +++ b/src/routes/(app)/[username]/payments/[...page]/+page.server.js @@ -2,7 +2,9 @@ import { get, auth } from '$lib/utils'; let limit = 25; -export async function load({ cookies, params, request }) { +export async function load({ cookies, depends, params, request }) { + depends('app:payments'); + let parts = params.page.split('/'); let start, end, page; diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index 69f51f37..2ea225ad 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -2,7 +2,7 @@ import { Avatar, Icon } from '$comp'; import { onMount } from 'svelte'; import { format } from 'date-fns'; - import { newPayment, payments } from '$lib/store'; + import { newPayment } from '$lib/store'; import { t } from '$lib/translations'; import { get, f, s, sat, sats, types } from '$lib/utils'; import { page } from '$app/stores'; @@ -11,7 +11,7 @@ export let data; - let { start, end, user, rates } = data; + let { start, end, user, rates, payments } = data; let change = ({ target: { value } }) => goto(value); let link = (p) => { @@ -34,7 +34,7 @@ let p, totals, pages = []; - $: data && ({ page: p, pages, start, end, totals, payments: $payments } = data); + $: data && ({ page: p, pages, start, end, totals, payments } = data); $: $page && ($newPayment = false); $: $newPayment && invalidate(`/users/${user.username}`); @@ -136,7 +136,7 @@ </div> <div class="text-base"> - {#each $payments as p} + {#each payments as p} <a href={`/payment/${p.id}`}> <div class="grid grid-cols-3 border-b h-24 hover:bg-gray-100 px-4"> <div class="whitespace-nowrap my-auto"> @@ -216,7 +216,7 @@ </div> <div class="grid grid-cols-3 w-full text-center"> - <span class="text-lg text-secondary">{$t('payments.total')}</span> + <span class="text-lg text-secondary">{$t('payments.total')}</span> <span class="text-lg text-secondary">{$t('payments.presentValue')}</span> <span class="text-lg text-secondary">{$t('payments.gainLoss')}</span> @@ -226,7 +226,9 @@ {@const gain = (pv * 100) / total - 100} <span class="text-lg"><b>{f(total, c)}</b></span> <span class="text-lg"><b>{f(pv, c)}</b></span> - <span class="text-lg" class:text-red-800={gain < 0}><b>{Math.abs(gain).toFixed(2)}%</b></span> + <span class="text-lg" class:text-red-800={gain < 0} + ><b>{Math.abs(gain).toFixed(2)}%</b></span + > {/each} </div> diff --git a/src/routes/(app)/[username]/receive/[...param]/+page.svelte b/src/routes/(app)/[username]/receive/[...param]/+page.svelte index a97dc776..d7001079 100644 --- a/src/routes/(app)/[username]/receive/[...param]/+page.svelte +++ b/src/routes/(app)/[username]/receive/[...param]/+page.svelte @@ -5,7 +5,6 @@ import { page } from '$app/stores'; import { requestRedirect } from '$lib/store'; import { browser } from '$app/environment'; - import { goto } from '$app/navigation'; export let data; let type = 'lightning'; diff --git a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte index 842c2eba..762e836e 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte @@ -138,7 +138,9 @@ <div class="font-bold flex justify-around items-center border-b pb-3 text-secondary"> {#each tabs.filter((t) => t.name !== 'shopify') as { name, key }} <a href={`/${user.username}/settings/${name}`}> - <button class="hover:opacity-80" class:text-black={tab === name || (tab === "shopify" && name === "pos")} + <button + class="hover:opacity-80" + class:text-black={tab === name || (tab === 'shopify' && name === 'pos')} >{$t(`user.settings.${key}`)}</button > </a> diff --git a/src/routes/(app)/[username]/settings/[...tab]/_account.svelte b/src/routes/(app)/[username]/settings/[...tab]/_account.svelte index 34399ad5..47c4c4c6 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/_account.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/_account.svelte @@ -64,28 +64,32 @@ $: url = `${$page.url.host}/${user.username}`; $: full = `${$page.url.protocol}//${url}`; - $: addr = `${user.username}@${$page.url.host}`; + $: addr = `${user.username}@${$page.url.host}`; </script> <div> <label for="username" class="font-bold mb-1 block">{$t('user.settings.username')}</label> <div class="flex mb-2"> - <input - type="text" - name="username" - bind:value={user.username} - class="border-r-0 rounded-r-none w-auto min-w-0 pr-1 grow" - /> - <div class="text-gray-600 p-4 my-auto bg-gray-100 border border-r-0 pl-1">@{$page.url.host}</div> - <div class="text-gray-600 border-l-0 bg-gray-100 rounded-r-2xl p-4 my-auto border w-16" > - <a href={`/qr/${encodeURIComponent(addr)}`}> - <Icon icon="qr" style="invert" /> - </a> + <input + type="text" + name="username" + bind:value={user.username} + class="border-r-0 rounded-r-none w-auto min-w-0 pr-1 grow" + /> + <div class="text-gray-600 p-4 my-auto bg-gray-100 border border-r-0 pl-1"> + @{$page.url.host} + </div> + <div class="text-gray-600 border-l-0 bg-gray-100 rounded-r-2xl p-4 my-auto border w-16"> + <a href={`/qr/${encodeURIComponent(addr)}`}> + <Icon icon="qr" style="invert" /> + </a> </div> </div> <div class="flex mb-2"> - <div class="text-gray-600 rounded-l-2xl p-4 my-auto border bg-gray-100 pr-1">{$page.url.host}/</div> + <div class="text-gray-600 rounded-l-2xl p-4 my-auto border bg-gray-100 pr-1"> + {$page.url.host}/ + </div> <input type="text" name="username" @@ -93,9 +97,9 @@ class="grow border-l-0 rounded-l-none border-r-0 rounded-r-none w-auto pl-1 min-w-0" /> <div class="text-gray-600 rounded-r-2xl p-4 my-auto border bg-gray-100 w-16"> - <a href={`/qr/${encodeURIComponent(full)}`}> - <Icon icon="qr" style="invert" /> - </a> + <a href={`/qr/${encodeURIComponent(full)}`}> + <Icon icon="qr" style="invert" /> + </a> </div> </div> </div> diff --git a/src/routes/(app)/[username]/settings/[...tab]/_pos.svelte b/src/routes/(app)/[username]/settings/[...tab]/_pos.svelte index ef5b7869..057d8c20 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/_pos.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/_pos.svelte @@ -33,7 +33,9 @@ </div> <a href="./shopify"> - <button class="flex rounded-full border py-2 px-4 font-bold hover:opacity-80 w-full gap-2 my-5 justify-center"> + <button + class="flex rounded-full border py-2 px-4 font-bold hover:opacity-80 w-full gap-2 my-5 justify-center" + > <img src="/icons/shopify.svg" class="w-8" /> <div class="my-auto">Shopify Integration</div> </button> diff --git a/src/routes/(app)/[username]/settings/[...tab]/_security.svelte b/src/routes/(app)/[username]/settings/[...tab]/_security.svelte index a08785f6..c01db734 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/_security.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/_security.svelte @@ -52,12 +52,12 @@ return true; }; -let disablingPin = false; + let disablingPin = false; let togglePin = async () => { if (user.haspin) { try { - disablingPin = true; + disablingPin = true; await tick(); submit.click(); } catch (e) { @@ -122,7 +122,7 @@ let disablingPin = false; }; </script> -<input type="hidden" name="newpin" value={disablingPin ? "delete" : pin} /> +<input type="hidden" name="newpin" value={disablingPin ? 'delete' : pin} /> <input type="hidden" name="confirm" bind:value={password} /> <div class="relative mb-5"> diff --git a/src/routes/(app)/login/+page.svelte b/src/routes/(app)/login/+page.svelte index dce523cb..84ecc3ad 100644 --- a/src/routes/(app)/login/+page.svelte +++ b/src/routes/(app)/login/+page.svelte @@ -4,7 +4,7 @@ import { animatedRate, pin } from '$lib/store'; onMount(() => { - $animatedRate = 0; + $animatedRate = 0; $pin = undefined; localStorage.clear(); sessionStorage.clear(); diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 5037eec2..12bb1c2d 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -45,10 +45,10 @@ {#if p.type === types.pot} <div> <span class="text-lg text-secondary my-auto mr-2">{amount > 0 ? 'From' : 'To'}</span> - <a href={`/pot/${p.memo}`}> + <a href={`/pot/${p.memo}`}> <div class="flex"> <div class="my-auto"> - <img src="/images/moneypot.png" class="w-12" alt="Pot" /> + <img src="/images/moneypot.png" class="w-12" alt="Pot" /> </div> <div class="my-auto ml-1">{p.memo}</div> </div> @@ -126,7 +126,7 @@ </div> {/if} - {#if ['laughingbean', 'burnabyartigiano', 'milanowestend', 'eotl', 'bigbite', 'edgemontartigiano'].includes(user.username.toLowerCase()) } + {#if ['laughingbean', 'burnabyartigiano', 'milanowestend', 'eotl', 'bigbite', 'edgemontartigiano'].includes(user.username.toLowerCase())} <button class="text-sm md:text-lg rounded-full border py-2 px-4 hover:opacity-80 min-w-[72px] bg-black text-white" on:click={print}>Print Receipt</button diff --git a/src/routes/(app)/pot/[name]/+page.svelte b/src/routes/(app)/pot/[name]/+page.svelte index 31e439d3..ea1e45f2 100644 --- a/src/routes/(app)/pot/[name]/+page.svelte +++ b/src/routes/(app)/pot/[name]/+page.svelte @@ -30,14 +30,14 @@ <div class="md:shadow-xl rounded-3xl md:px-10 pt-5 pb-10 space-y-5 w-full md:mx-5"> <div class="relative flex justify-center gap-2"> <!-- <p class="absolute right-0 top-1 underline"><Icon icon="settings" /></p> --> - {#if name.split('-').length === 4} - <h1 class="text-2xl md:text-3xl font-semibold my-auto">Card {name}</h1> + {#if name.split('-').length === 4} + <h1 class="text-2xl md:text-3xl font-semibold my-auto">Card {name}</h1> {:else} <img src="/images/moneypot.jpg" class="w-24" alt="Pot" /> - <div class="my-auto"> - <h1 class="text-2xl font-semibold my-auto">{$t('payments.moneyPot')}</h1> - <h1 class="text-secondary my-auto">{name}</h1> - </div> + <div class="my-auto"> + <h1 class="text-2xl font-semibold my-auto">{$t('payments.moneyPot')}</h1> + <h1 class="text-secondary my-auto">{name}</h1> + </div> {/if} </div> {#if show} @@ -60,7 +60,7 @@ class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center" > <Icon icon="plus" /> - {$t('payments.addFunds')} + {$t('payments.addFunds')} </button> </a> </div> @@ -70,7 +70,7 @@ class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center" > <Icon icon="minus" style="rotate-180" /> - {$t('payments.takeFunds')} + {$t('payments.takeFunds')} </button> </a> </div> @@ -85,10 +85,10 @@ </button> <button class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center" - on:click={() => copy($page.url.host + $page.url.pathname)} + on:click={() => copy($page.url.host + $page.url.pathname)} > <Icon icon="copy" style="w-6" /> - {$t('payments.copyLink')} + {$t('payments.copyLink')} </button> </div> <div class="text-base"> diff --git a/src/routes/(app)/pot/[name]/sweep/+page.svelte b/src/routes/(app)/pot/[name]/sweep/+page.svelte index 17d707cc..9b473af3 100644 --- a/src/routes/(app)/pot/[name]/sweep/+page.svelte +++ b/src/routes/(app)/pot/[name]/sweep/+page.svelte @@ -4,14 +4,13 @@ import { Icon } from '$comp'; import { t } from '$lib/translations'; - export let data; + export let data; - let { amount, name, user, rates } = data; - let { currency } = user; - $: rate = rates[currency]; + let { amount, name, user, rates } = data; + let { currency } = user; + $: rate = rates[currency]; </script> - <div class="container px-4 max-w-xl mx-auto mt-10 space-y-5 text-center"> <div class="w-full flex"> <a href="/" class="mx-auto"> @@ -19,17 +18,17 @@ </a> </div> - <div class="flex w-full py-5 max-w-[200px] mx-auto" in:scale={{ start: 0.5 }}> - <Icon icon="check" style="mx-auto" /> - </div> - <h1 class="text-3xl md:text-4xl font-bold mb-6">{$t('payments.fundsClaimed')}</h1> - <h2 class="text-2xl md:text-3xl font-semibold"> - {f(fiat(amount, rate), currency)} - </h2> - <h3 class="text-secondary md:text-lg mb-6 mt-1"> - ⚡️{s(amount)} - </h3> - </div> + <div class="flex w-full py-5 max-w-[200px] mx-auto" in:scale={{ start: 0.5 }}> + <Icon icon="check" style="mx-auto" /> + </div> + <h1 class="text-3xl md:text-4xl font-bold mb-6">{$t('payments.fundsClaimed')}</h1> + <h2 class="text-2xl md:text-3xl font-semibold"> + {f(fiat(amount, rate), currency)} + </h2> + <h3 class="text-secondary md:text-lg mb-6 mt-1"> + ⚡️{s(amount)} + </h3> +</div> <a href={`/${user.username}/payments`}> <div class="opacity-0 w-screen h-screen fixed top-0 left-0 z-50" /> diff --git a/src/routes/(app)/pot/[name]/withdraw/+page.svelte b/src/routes/(app)/pot/[name]/withdraw/+page.svelte index da564709..7be643a9 100644 --- a/src/routes/(app)/pot/[name]/withdraw/+page.svelte +++ b/src/routes/(app)/pot/[name]/withdraw/+page.svelte @@ -9,7 +9,7 @@ export let data; export let form; - let { rates } = data; + let { rates } = data; let { amount, name } = $page.params; let { currency } = data.user; let loading; @@ -35,7 +35,7 @@ {/if} <div class="container px-4 mt-20 max-w-xl mx-auto"> - <Numpad bind:amount bind:currency bind:rate {submit} /> + <Numpad bind:amount bind:currency bind:rate {submit} /> <form method="POST" use:enhance on:submit={submit}> <input name="name" value={name} type="hidden" /> diff --git a/src/routes/(app)/qr/[text]/+page.svelte b/src/routes/(app)/qr/[text]/+page.svelte index d903da0e..9e56ab29 100644 --- a/src/routes/(app)/qr/[text]/+page.svelte +++ b/src/routes/(app)/qr/[text]/+page.svelte @@ -7,5 +7,5 @@ <Qr {src} /> <div class="text-center w-full font-bold"> - {text} + {text} </div> diff --git a/src/routes/(app)/send/invoice/[id]/+page.svelte b/src/routes/(app)/send/invoice/[id]/+page.svelte index a71c697a..a558895c 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.svelte +++ b/src/routes/(app)/send/invoice/[id]/+page.svelte @@ -29,7 +29,7 @@ let external = async () => { let invoice = { type: 'lightning', amount, currency }; - let {id }= await post(`/${recipient.username}/invoice`, { + let { id } = await post(`/${recipient.username}/invoice`, { invoice, user: { username: recipient.username } }); diff --git a/src/routes/(static)/bounties/+page.svelte b/src/routes/(static)/bounties/+page.svelte index b2f86964..729cf5dd 100644 --- a/src/routes/(static)/bounties/+page.svelte +++ b/src/routes/(static)/bounties/+page.svelte @@ -2,14 +2,14 @@ <h1 class="text-3xl mb-6 pt-28 md:pt-12">Bounties</h1> <p> - We're offering ⚡️1,000,000 to the first 10 people that help us onboard these businesses in Vancouver - to take bitcoin payments. + We're offering ⚡️1,000,000 to the first 10 people that help us onboard these businesses in + Vancouver to take bitcoin payments. </p> <ul class="text-center text-lg space-y-3"> <li>Grocery / Produce Store</li> <li class="leading-3"> - <span class="line-through">Cafe</span><br/> + <span class="line-through">Cafe</span><br /> <span class="text-xs" ><a href="/reverendhodl">ReverendHodl</a> for <a href="/laughingbean">Laughing Bean Coffee Co.</a></span @@ -17,7 +17,7 @@ </li> <li>Bakery</li> <li class="leading-3"> - <span class="line-through">Butcher Shop</span><br /> + <span class="line-through">Butcher Shop</span><br /> <span class="text-xs" ><a href="/danielle">danielle</a> for <a href="/butchersguild">All Natural & Exotic Meats</a></span @@ -26,7 +26,7 @@ <li>Laundromat / Dry Cleaner</li> <li>Dollar Store / Book Store / Gift Shop</li> <li class="leading-3"> - <span class="line-through">Sushi Restaurant</span><br /> + <span class="line-through">Sushi Restaurant</span><br /> <span class="text-xs" ><a href="/ica547">ica547</a> for <a href="/metallmash">VanLove Sushi</a></span > @@ -36,15 +36,14 @@ <li>Bubble Tea / Ice Cream Parlour</li> </ul> - <p> - Eligible businesses: - </p> + <p>Eligible businesses:</p> <ul class="text-sm ml-4 space-y-2"> - <li>Have a physical location in Vancouver, North Vancouver, West Vancouver, Burnaby, New + <li> + Have a physical location in Vancouver, North Vancouver, West Vancouver, Burnaby, New Westminster, or Richmond </li> - <li>Take walk-in customers</li> + <li>Take walk-in customers</li> <li>Have regular hours and a website with contact info</li> <li>Have a 3 star or better rating on Google</li> <li> @@ -53,14 +52,12 @@ <li>Use Coinos</li> </ul> - <p>Each business category can be claimed only once</p> - <p>One bounty per person</p> + <p>Each business category can be claimed only once</p> + <p>One bounty per person</p> <p>The businesses can expect free ongoing support and promotion from us and our community.</p> - <p> - The prize money will be offered to the person who makes the referral. - </p> + <p>The prize money will be offered to the person who makes the referral.</p> <p> <b>⚡️250,000</b> will be awarded once the business has met with us and is ready to take payments diff --git a/src/routes/(static)/docs/+page.svelte b/src/routes/(static)/docs/+page.svelte index 86be02f0..63173173 100644 --- a/src/routes/(static)/docs/+page.svelte +++ b/src/routes/(static)/docs/+page.svelte @@ -14,7 +14,10 @@ <p class="text-secondary"> Coinos has a simple REST API that can be used to register accounts and make payments and - queries. The following examples show how you can call the API with <a href="https://curl.se/" class="font-bold">curl</a> from your command line. + queries. The following examples show how you can call the API with <a + href="https://curl.se/" + class="font-bold">curl</a + > from your command line. </p> <h2 class="text-2xl">API Base URL</h2> @@ -30,10 +33,11 @@ {#if user && token} This token authorizes you to use the API as <b>{user.username}</b>. {:else} - <a href="/login" class="font-bold">Sign in</a> to view your auth token here, or get one from the /login endpoint. + <a href="/login" class="font-bold">Sign in</a> to view your auth token here, or get one from the + /login endpoint. {/if} - Save it in a variable called <b>$token</b> to run the examples. + Save it in a variable called <b>$token</b> to run the examples. </p> <div class="bg-black text-white rounded-lg p-4 flex gap-4"> @@ -68,18 +72,17 @@ </div> </div> - <p>Get a lightning invoice to receive funds</p> + <p>Get a lightning invoice to receive funds</p> <Code sample="lightningInvoice" /> - <p>Get a bitcoin address to receive funds</p> + <p>Get a bitcoin address to receive funds</p> <Code sample="bitcoinAddress" /> <p>Sample response</p> <Code sample="invoiceResponse" /> <p>You can check the <b>received</b> field to see how much has been paid</p> - - <p>Specify a webhook to be called when an invoice is paid</p> + <p>Specify a webhook to be called when an invoice is paid</p> <Code sample="webhook" /> <h2 class="text-2xl">GET /invoice/:hash</h2> diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 6dc84349..7e9cb755 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,8 +1,8 @@ <script> import '../app.css'; - export let data; - let { host, pathname } = data; + export let data; + let { host, pathname } = data; </script> <svelte:head> diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index ab49f91d..ec9f55b7 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -20,11 +20,11 @@ $: update(data); let howItWorks; - let faq; + let faq; let about; let log = console.log; - let faqs = {}; + let faqs = {}; const howItWorksSteps = [ { image: 'hand', stepID: 'step1' }, @@ -33,7 +33,7 @@ ]; onMount(async () => { - faqs = (await import('../locales/en.json')).default.faq; + faqs = (await import('../locales/en.json')).default.faq; close(); @@ -90,7 +90,7 @@ <div> <div class="space-y-10"> <h3 class="text-5xl font-medium text-center">{$t('faq.header')}</h3> - {#each Object.keys(faqs).filter(f => f !== "header") as faqID} + {#each Object.keys(faqs).filter((f) => f !== 'header') as faqID} <FaqCard questionID={faqID} /> {/each} </div> diff --git a/src/routes/map/+page.svelte b/src/routes/map/+page.svelte index b5e4dfad..99c822d3 100644 --- a/src/routes/map/+page.svelte +++ b/src/routes/map/+page.svelte @@ -1,6 +1,6 @@ <script> - import { LocationsMap } from "$comp"; - export let data; + import { LocationsMap } from '$comp'; + export let data; let { locations } = data; </script> |
