From 80cf7e9b77dcc4cbcf7711eb63a218c3aec07ec6 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Wed, 27 Jul 2022 00:00:43 -0600 Subject: hook up receive page and more adjustments --- static/icons/info.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 static/icons/info.svg (limited to 'static') diff --git a/static/icons/info.svg b/static/icons/info.svg new file mode 100644 index 00000000..80f33b37 --- /dev/null +++ b/static/icons/info.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From a038ce9711f8ae5945eba073c82aa2aeb2bcf5c3 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Fri, 29 Jul 2022 21:29:18 -0600 Subject: start hooking up invoice screen --- package.json | 1 + pnpm-lock.yaml | 18 ++- src/components/RegisterOrLogin.svelte | 7 +- src/hooks/index.js | 18 +-- src/lib/store.js | 4 +- src/routes/__layout.svelte | 8 +- src/routes/invoice.svelte | 253 ++++++++++++++++++++++++++++++++-- src/routes/receive.svelte | 22 +-- static/icons/arrow-left.svg | 3 + static/images/invoice.svg | 4 + tailwind.config.cjs | 3 +- 11 files changed, 298 insertions(+), 43 deletions(-) create mode 100644 static/icons/arrow-left.svg create mode 100644 static/images/invoice.svg (limited to 'static') diff --git a/package.json b/package.json index 23bb6cb6..d4312d1c 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "postcss": "^8.4.14", "prettier": "^2.7.1", "prettier-plugin-svelte": "^2.7.0", + "qr-code-styling": "1.6.0-rc.1", "svelte": "^3.49.0", "svelte-preprocess": "^4.10.7", "tailwindcss": "^3.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9c34207f..69b6d84e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,7 @@ specifiers: postcss: ^8.4.14 prettier: ^2.7.1 prettier-plugin-svelte: ^2.7.0 + qr-code-styling: 1.6.0-rc.1 svelte: ^3.49.0 svelte-preprocess: ^4.10.7 tailwindcss: ^3.1.6 @@ -15,12 +16,13 @@ specifiers: devDependencies: '@sveltejs/adapter-auto': 1.0.0-next.64 - '@sveltejs/kit': 1.0.0-next.396_svelte@3.49.0+vite@3.0.3 + '@sveltejs/kit': 1.0.0-next.398_svelte@3.49.0+vite@3.0.3 autoprefixer: 10.4.7_postcss@8.4.14 cookie: 0.5.0 postcss: 8.4.14 prettier: 2.7.1 prettier-plugin-svelte: 2.7.0_o3ioganyptcsrh6x4hnxvjkpqi + qr-code-styling: 1.6.0-rc.1 svelte: 3.49.0 svelte-preprocess: 4.10.7_nxvsp6sjiltnatqa6jdm4mr6zu tailwindcss: 3.1.6 @@ -121,8 +123,8 @@ packages: - supports-color dev: true - /@sveltejs/kit/1.0.0-next.396_svelte@3.49.0+vite@3.0.3: - resolution: {integrity: sha512-bKFpuzp9QxPkOIOEIeNeedvxEMORNqBPxUmoJXDP/Se7MrSfcxYiamjBcKrG+bgGNWmV39nD3EvUox+CXno/Ig==} + /@sveltejs/kit/1.0.0-next.398_svelte@3.49.0+vite@3.0.3: + resolution: {integrity: sha512-ONjHoRurnFUe+0lv0P9rZQpDuuJy4Cr/lDneoG+lkOR5/7gcvd03TlVdxLz1ZQAWPbgovm/PpshOvIUeC4n62A==} engines: {node: '>=16.9'} hasBin: true peerDependencies: @@ -1130,6 +1132,16 @@ packages: hasBin: true dev: true + /qr-code-styling/1.6.0-rc.1: + resolution: {integrity: sha512-ModRIiW6oUnsP18QzrRYZSc/CFKFKIdj7pUs57AEVH20ajlglRpN3HukjHk0UbNMTlKGuaYl7Gt6/O5Gg2NU2Q==} + dependencies: + qrcode-generator: 1.4.4 + dev: true + + /qrcode-generator/1.4.4: + resolution: {integrity: sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw==} + dev: true + /queue-microtask/1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} dev: true diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index 2334741d..15be60cf 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -7,7 +7,8 @@ export let page; - let username = "bob", password = "pw"; + let username = 'bob', + password = 'pw'; let revealPassword = false; @@ -20,7 +21,7 @@ let r = await post(url, { username, password }); if (!r.token) r = await post('/login', { username, password }); $token = r.token; - console.log("new token", r.token) + console.log('new token', r.token); auth(); goto('/receive'); }; @@ -43,7 +44,7 @@ required class="bg-primary p-4 rounded-2xl w-full" bind:value={username} - autofocus + autofocus /> diff --git a/src/hooks/index.js b/src/hooks/index.js index 21e56052..6a9c8ec5 100644 --- a/src/hooks/index.js +++ b/src/hooks/index.js @@ -1,16 +1,16 @@ -import cookie from "cookie"; +import cookie from 'cookie'; export async function handle({ event, resolve }) { - let { request: { headers }, - } = event; + let { + request: { headers } + } = event; - const cookies = cookie.parse(headers.get("cookie") || ""); - let { token } = cookies; - event.locals = { token }; + const cookies = cookie.parse(headers.get('cookie') || ''); + let { token } = cookies; + event.locals = { token }; - return resolve(event); + return resolve(event); } - export const getSession = ({ locals: { token } }) => { - return { token }; + return { token }; }; diff --git a/src/lib/store.js b/src/lib/store.js index 62232f9d..6f4a9515 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -8,8 +8,7 @@ const persisted = (k, i) => { : i ); - s.subscribe((v) => browser && sessionStorage.setItem(k, JSON.stringify(v)) - ); + s.subscribe((v) => browser && sessionStorage.setItem(k, JSON.stringify(v))); return s; }; @@ -17,4 +16,5 @@ const persisted = (k, i) => { export const rate = writable(); export const user = writable(); export const invoiceAmount = writable(); +export const invoiceAmountFiat = writable(); export const token = persisted('token'); diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 1af9679a..6562db18 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -2,11 +2,11 @@ import '../app.css'; import { onMount } from 'svelte'; import { connect } from '$lib/socket'; - import { token } from "$lib/store"; - import { session } from "$app/stores"; - import { browser } from "$app/env"; + import { token } from '$lib/store'; + import { session } from '$app/stores'; + import { browser } from '$app/env'; - browser && ($token ||= $session.token); + browser && ($token ||= $session.token); onMount(connect); diff --git a/src/routes/invoice.svelte b/src/routes/invoice.svelte index 567aefbb..6dce84fe 100644 --- a/src/routes/invoice.svelte +++ b/src/routes/invoice.svelte @@ -1,15 +1,248 @@ -{#if $user} - {text} - {$invoiceAmount} - {$rate} - {$user.username} - {#each $user.payments as p} - {p.amount}
- {/each} -{/if} + + +
+
+ {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} + +
+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} + {tipPercent}% +
+ + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
+
+
+ +
+ + +
+ Scan to pay insert name here + +
+ +
+
+ Invoice + {invoiceAmountFiatFormatted} + {`(${invoiceAmountFormatted} SATS)`} +
+ +
+ Tip + {tipAmountFormatted} + {`(${tipAmountSats} SATS)`} +
+ +
+ Total + {totalAmountFormatted} + {`(${totalAmountSats} SATS)`} +
+
+
+ {:else} +
+
+
+ {/if} +
+
+ + diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 338bc06c..095a2ba3 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -2,7 +2,7 @@ // in the future we will want to allow users to set their fiat currency in the settings import { AppHeader, Icon } from '$comp'; import { goto } from '$app/navigation'; - import { invoiceAmount, rate } from '$lib/store'; + import { invoiceAmount, invoiceAmountFiat, rate } from '$lib/store'; let useFiat = true; let amountFiat = 0; @@ -10,6 +10,9 @@ let message = ''; $: $invoiceAmount = parseInt(amountSats === 0 ? amountFiat / ($rate / 100000000) : amountSats); + $: $invoiceAmountFiat = parseInt( + amountFiat === 0 ? amountSats * ($rate / 100000000) : amountFiat + ); $: amountSatsFormatted = new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 }).format( amountSats ); @@ -63,6 +66,7 @@ amountSats = amountSats.slice(0, amountSats.length - 1); if (amountSats.length === 0) { amountSats = 0; + amountFiat = 0; } } } else if (value !== '<' && parseInt(amountSats + value) > 100000000) { @@ -77,8 +81,8 @@ -{#if $rate} -
+
+ {#if $rate}
@@ -165,11 +169,7 @@ >
-
-{:else} -
-
-
-{/if} + {:else} +
+ {/if} +
diff --git a/static/icons/arrow-left.svg b/static/icons/arrow-left.svg new file mode 100644 index 00000000..64ded577 --- /dev/null +++ b/static/icons/arrow-left.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/images/invoice.svg b/static/images/invoice.svg new file mode 100644 index 00000000..4c9cbce9 --- /dev/null +++ b/static/images/invoice.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 86d5d1cf..4be763a3 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -6,7 +6,8 @@ module.exports = { colors: { primary: '#F5F7FA', secondary: '#858A92', - gradient: '#C3CFE2' + gradient: '#C3CFE2', + lightgrey: '#eaecef' } } }, -- cgit v1.2.3 From 8851572f78a70c7bd02a3d669dc103459323ed8d Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 06:52:55 -0600 Subject: add 404 and error page, redirect to login if trying to access w/o user --- src/components/AppHeader.svelte | 4 +- src/routes/[...path].svelte | 16 +++ src/routes/__error.svelte | 16 +++ src/routes/invoice/[amount].svelte | 232 +++++++++++++++++++------------------ src/routes/receive.svelte | 184 +++++++++++++++-------------- static/icons/error.svg | 3 + static/icons/info.svg | 2 +- static/icons/question.svg | 3 + 8 files changed, 256 insertions(+), 204 deletions(-) create mode 100644 src/routes/[...path].svelte create mode 100644 src/routes/__error.svelte create mode 100644 static/icons/error.svg create mode 100644 static/icons/question.svg (limited to 'static') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 3f8e7e87..6376e27f 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -1,7 +1,7 @@ @@ -15,7 +15,7 @@ > + import { Icon } from '$comp'; + + +
+
+ + + + + + +

404

+

Page not found.

+
+
diff --git a/src/routes/__error.svelte b/src/routes/__error.svelte new file mode 100644 index 00000000..6cdeeac7 --- /dev/null +++ b/src/routes/__error.svelte @@ -0,0 +1,16 @@ + + +
+
+ + + + + + +

Error

+

Please try again or contact support.

+
+
diff --git a/src/routes/invoice/[amount].svelte b/src/routes/invoice/[amount].svelte index 4c1ec199..2cf16e37 100644 --- a/src/routes/invoice/[amount].svelte +++ b/src/routes/invoice/[amount].svelte @@ -8,6 +8,10 @@ export let text; export let amount; + if (!$user && typeof window !== 'undefined') { + window.location = '/login'; + } + let tipPercent = 0; const setRate = ($invoiceAmountFiat / $invoiceAmount) * 100000000; @@ -83,131 +87,133 @@ }); - - -
-
- {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} - -
-

Add a tip?

- -
- {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {tipPercent}% -
- - { - customTipAmount = ''; - tipPercent = e.target.value; - }} - /> - -
- {#each tipAmounts as amount} - goto('/receive')}> + + + +
+
+ {#if $invoiceAmount && $invoiceAmountFiat && $rate && text} + +
+

Add a tip?

+ +
+ {tipAmountFormatted}{`(${tipAmountSats} SATS)`} - {/each} + {tipPercent}% +
-
- $ - handleCustomTipAmount(e)} - class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" - placeholder="Other" - /> - + { + customTipAmount = ''; + tipPercent = e.target.value; + }} + /> + +
+ {#each tipAmounts as amount} + + {/each} + +
+ $ + handleCustomTipAmount(e)} + class="bg-primary rounded-2xl py-3 px-10 font-semibold mt-2 mr-1 w-full md:w-auto" + placeholder="Other" + /> + +
-
- -
- - -
- Scan to pay insert name here
-
-
- Invoice - {invoiceAmountFiatFormatted} - {`(${invoiceAmountFormatted} SATS)`} -
- -
- Tip - {tipAmountFormatted} - {`(${tipAmountSats} SATS)`} -
+ +
+ Scan to pay insert name here -
- Total - {totalAmountFormatted} - {`(${totalAmountSats} SATS)`} +
+ +
+
+ Invoice + {invoiceAmountFiatFormatted} + {`(${invoiceAmountFormatted} SATS)`} +
+ +
+ Tip + {tipAmountFormatted} + {`(${tipAmountSats} SATS)`} +
+ +
+ Total + {totalAmountFormatted} + {`(${totalAmountSats} SATS)`} +
-
- {:else} -
-
-
- {/if} + {:else} +
+
+
+ {/if} +
-
+{/if} diff --git a/static/icons/heart.svg b/static/icons/heart.svg new file mode 100644 index 00000000..f3a5f757 --- /dev/null +++ b/static/icons/heart.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From 8acc59a86b6ec049dfe07f92fd19eeda726136f3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 30 Jul 2022 09:47:08 -0700 Subject: logout function --- src/components/AppHeader.svelte | 4 +++- src/components/RegisterOrLogin.svelte | 4 ++-- src/lib/socket.js | 4 ++++ src/routes/[...path].svelte | 16 ---------------- src/routes/[username].js | 3 +++ src/routes/[username].svelte | 27 +++++++++++++++++++++++++++ src/routes/__layout.svelte | 23 +++++++++++++++++++---- src/routes/logout/done.svelte | 13 +++++++++++++ src/routes/logout/index.js | 26 ++++++++++++++++++++++++++ src/routes/logout/index.svelte | 10 ++++++++++ src/routes/receive.svelte | 4 ---- static/icons/logout.svg | 3 +++ 12 files changed, 110 insertions(+), 27 deletions(-) delete mode 100644 src/routes/[...path].svelte create mode 100644 src/routes/[username].js create mode 100644 src/routes/[username].svelte create mode 100644 src/routes/logout/done.svelte create mode 100644 src/routes/logout/index.js create mode 100644 src/routes/logout/index.svelte create mode 100644 static/icons/logout.svg (limited to 'static') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 6376e27f..b096f01e 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -14,9 +14,11 @@ - + diff --git a/src/components/RegisterOrLogin.svelte b/src/components/RegisterOrLogin.svelte index b42b8d7f..f5764a85 100644 --- a/src/components/RegisterOrLogin.svelte +++ b/src/components/RegisterOrLogin.svelte @@ -1,7 +1,7 @@ diff --git a/src/lib/socket.js b/src/lib/socket.js index 9d0c472e..14555bd3 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -46,6 +46,10 @@ export function connect() { interval = setInterval(() => send('heartbeat'), 5000); } +export function close() { + if (socket) socket.close(); +} + function onWebsocketMessage(msg) { let { type, data } = JSON.parse(msg.data); messages(data)[type] && messages(data)[type](); diff --git a/src/routes/[...path].svelte b/src/routes/[...path].svelte deleted file mode 100644 index 503316bb..00000000 --- a/src/routes/[...path].svelte +++ /dev/null @@ -1,16 +0,0 @@ - - -
-
- - - - - - -

404

-

Page not found.

-
-
diff --git a/src/routes/[username].js b/src/routes/[username].js new file mode 100644 index 00000000..39a216c2 --- /dev/null +++ b/src/routes/[username].js @@ -0,0 +1,3 @@ +export async function GET({ params }) { + return { body: params } +} diff --git a/src/routes/[username].svelte b/src/routes/[username].svelte new file mode 100644 index 00000000..fe1f7754 --- /dev/null +++ b/src/routes/[username].svelte @@ -0,0 +1,27 @@ + + +{#if $user?.username === username} + +
+
+
+ Signed in as {username} +
+ + +
+
+{/if} diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 6562db18..c01dc848 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -2,12 +2,27 @@ import '../app.css'; import { onMount } from 'svelte'; import { connect } from '$lib/socket'; - import { token } from '$lib/store'; - import { session } from '$app/stores'; + import { user, token } from '$lib/store'; + import { page, session } from '$app/stores'; import { browser } from '$app/env'; + import { goto } from '$app/navigation'; browser && ($token ||= $session.token); - onMount(connect); + let protectedRoutes = [/receive/]; + let ready = false; + + onMount(() => { + if (protectedRoutes.find((p) => $page.url.pathname.match(p))) { + if (!$token) goto('/login'); + user.subscribe((u) => (ready = true)); + } else { + ready = true; + } + + connect(); + }); - +{#if ready} + +{/if} diff --git a/src/routes/logout/done.svelte b/src/routes/logout/done.svelte new file mode 100644 index 00000000..894c7b99 --- /dev/null +++ b/src/routes/logout/done.svelte @@ -0,0 +1,13 @@ + diff --git a/src/routes/logout/index.js b/src/routes/logout/index.js new file mode 100644 index 00000000..80e65f8b --- /dev/null +++ b/src/routes/logout/index.js @@ -0,0 +1,26 @@ +import cookie from "cookie"; + +const opts = { + httpOnly: true, + sameSite: "lax", + path: "/", +}; + +export async function GET({ request: { headers } }) { + return { + status: 302, + headers: { + location: "/logout/done", + "set-cookie": [ + cookie.serialize("token", "", { + ...opts, + expires: new Date(0), + }), + cookie.serialize("refresh_token", "", { + ...opts, + expires: new Date(0), + }), + ], + }, + }; +} diff --git a/src/routes/logout/index.svelte b/src/routes/logout/index.svelte new file mode 100644 index 00000000..2c6a7085 --- /dev/null +++ b/src/routes/logout/index.svelte @@ -0,0 +1,10 @@ + diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 760733a3..0329dea4 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -4,10 +4,6 @@ import { goto } from '$app/navigation'; import { invoiceAmount, invoiceAmountFiat, rate, user } from '$lib/store'; - if (!$user && typeof window !== 'undefined') { - window.location = '/login'; - } - let useFiat = true; let amountFiat = 0; let amountSats = 0; diff --git a/static/icons/logout.svg b/static/icons/logout.svg new file mode 100644 index 00000000..495d6574 --- /dev/null +++ b/static/icons/logout.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From 2bca310acc4ca22960c5902b402c2ae23d0f7755 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 18:58:25 -0600 Subject: hook up all nav buttons, add dropdown menu, add routes... --- src/components/AppHeader.svelte | 65 ++++++++++++++++++++++++++----- src/components/LandingHeader.svelte | 28 ++++++++----- src/lib/socket.js | 2 +- src/routes/[username]/customers.svelte | 5 +++ src/routes/[username]/dashboard.svelte | 5 +++ src/routes/[username]/settings.svelte | 5 +++ src/routes/[username]/support.svelte | 5 +++ src/routes/[username]/transactions.svelte | 5 +++ src/routes/__layout.svelte | 2 +- static/icons/customers.svg | 3 ++ static/icons/dash.svg | 3 ++ static/icons/logout.svg | 4 +- static/icons/settings.svg | 4 ++ static/icons/support.svg | 3 ++ 14 files changed, 116 insertions(+), 23 deletions(-) create mode 100644 src/routes/[username]/customers.svelte create mode 100644 src/routes/[username]/dashboard.svelte create mode 100644 src/routes/[username]/settings.svelte create mode 100644 src/routes/[username]/support.svelte create mode 100644 src/routes/[username]/transactions.svelte create mode 100644 static/icons/customers.svg create mode 100644 static/icons/dash.svg create mode 100644 static/icons/settings.svg create mode 100644 static/icons/support.svg (limited to 'static') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 1c6f639c..9f73adbf 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -4,26 +4,65 @@ import { user } from '$lib/store'; import { goto } from '$app/navigation'; import { Icon } from '$comp'; + + const menuButtons = [ + { title: 'Customers', icon: 'customers', goto: 'customers' }, + { title: 'Dashboard', icon: 'dash', goto: 'dashboard' }, + { title: 'Settings', icon: 'settings', goto: 'settings' }, + { title: 'Support', icon: 'support', goto: 'support' }, + { title: 'Sign out', icon: 'logout', goto: 'logout' } + ]; + + let showMenu = false; + + const handleMenuItemClick = (item) => { + if (item === 'logout') { + goto('/logout'); + } else { + goto(`/${$user.username + '/' + item}`); + } + };
+ + diff --git a/src/components/LandingHeader.svelte b/src/components/LandingHeader.svelte index 4da9a17e..927c8749 100644 --- a/src/components/LandingHeader.svelte +++ b/src/components/LandingHeader.svelte @@ -2,6 +2,7 @@ import { goto } from '$app/navigation'; import { scroll } from '$lib/utils'; import { Icon } from '$comp'; + import { user } from '$lib/store'; export let howItWorks; export let faq; @@ -17,15 +18,24 @@ - - + {#if !$user} + + + {:else} + + {/if}
diff --git a/src/lib/socket.js b/src/lib/socket.js index 36d41ea8..c7c541e1 100644 --- a/src/lib/socket.js +++ b/src/lib/socket.js @@ -18,7 +18,7 @@ export const messages = (data) => ({ }, payment() { - console.log(data); + console.log(data, 'payment'); }, connected: auth, diff --git a/src/routes/[username]/customers.svelte b/src/routes/[username]/customers.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/customers.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/dashboard.svelte b/src/routes/[username]/dashboard.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/dashboard.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/settings.svelte b/src/routes/[username]/settings.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/settings.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/support.svelte b/src/routes/[username]/support.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/support.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/[username]/transactions.svelte b/src/routes/[username]/transactions.svelte new file mode 100644 index 00000000..1935b156 --- /dev/null +++ b/src/routes/[username]/transactions.svelte @@ -0,0 +1,5 @@ + + + diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index d26ccfed..736f38e8 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -18,7 +18,7 @@ if (protectedRoutes.find((p) => $page.url.pathname.match(p))) { if (!$token) { goto('/login'); - toast.push('Please login to continue.'); + toast.push('Please sign in to continue.'); } user.subscribe((u) => (ready = true)); } else { diff --git a/static/icons/customers.svg b/static/icons/customers.svg new file mode 100644 index 00000000..0b6081ba --- /dev/null +++ b/static/icons/customers.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/dash.svg b/static/icons/dash.svg new file mode 100644 index 00000000..acb39ab9 --- /dev/null +++ b/static/icons/dash.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/logout.svg b/static/icons/logout.svg index 495d6574..a614cfc0 100644 --- a/static/icons/logout.svg +++ b/static/icons/logout.svg @@ -1,3 +1,3 @@ - - + + diff --git a/static/icons/settings.svg b/static/icons/settings.svg new file mode 100644 index 00000000..2fac5bea --- /dev/null +++ b/static/icons/settings.svg @@ -0,0 +1,4 @@ + + + + diff --git a/static/icons/support.svg b/static/icons/support.svg new file mode 100644 index 00000000..47b935b5 --- /dev/null +++ b/static/icons/support.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From 27cbd543cece74228680d74f276eca89e13b557b Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 20:45:19 -0600 Subject: add user public page --- src/components/AppHeader.svelte | 84 ++++++++++++++++++--------------- src/lib/utils.js | 4 ++ src/routes/[username]/index.svelte | 96 ++++++++++++++++++++++++++++++++------ src/routes/__layout.svelte | 11 ++++- static/icons/copy.svg | 3 ++ static/icons/minus.svg | 3 ++ static/icons/plus.svg | 3 ++ 7 files changed, 152 insertions(+), 52 deletions(-) create mode 100644 static/icons/copy.svg create mode 100644 static/icons/minus.svg create mode 100644 static/icons/plus.svg (limited to 'static') diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 9f73adbf..d0123650 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -5,6 +5,8 @@ import { goto } from '$app/navigation'; import { Icon } from '$comp'; + export let avatarPosition = 'left-[calc(50vw-48px)]'; + const menuButtons = [ { title: 'Customers', icon: 'customers', goto: 'customers' }, { title: 'Dashboard', icon: 'dash', goto: 'dashboard' }, @@ -24,48 +26,54 @@ }; -
+
- -
-
    - {#each menuButtons as button} -
  • - -
  • - {/each} -
+ {#if $user} + + + + + + + + + +
+ +
+
    + {#each menuButtons as button} +
  • + +
  • + {/each} +
+
-
+ {:else} + + + + {/if}
diff --git a/src/lib/utils.js b/src/lib/utils.js index 22c88522..7831c519 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -17,3 +17,7 @@ export const post = (url, body) => body: JSON.stringify(body), headers: { accept: 'application/json', 'content-type': 'application/json' } }).then((r) => r.json()); + +export const copy = (text) => { + navigator.clipboard.writeText(text); +}; diff --git a/src/routes/[username]/index.svelte b/src/routes/[username]/index.svelte index 90d0c04a..a53b94cc 100644 --- a/src/routes/[username]/index.svelte +++ b/src/routes/[username]/index.svelte @@ -1,24 +1,94 @@ -{#if $user?.username === username} - -
-
-
- Signed in as {username} + +{#if username} + + +
+
+
+

{username}

+ +

Address goes here

+ +
-
- - - +
+
+
+
+ +

Scan to pay with Bitcoin

+ +
+ {lightning} + +
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 736f38e8..b2cb8aae 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -30,8 +30,17 @@ {#if ready} - + {:else} {/if} + + diff --git a/static/icons/copy.svg b/static/icons/copy.svg new file mode 100644 index 00000000..38b43e02 --- /dev/null +++ b/static/icons/copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/minus.svg b/static/icons/minus.svg new file mode 100644 index 00000000..65450cf4 --- /dev/null +++ b/static/icons/minus.svg @@ -0,0 +1,3 @@ + + + diff --git a/static/icons/plus.svg b/static/icons/plus.svg new file mode 100644 index 00000000..310c79d5 --- /dev/null +++ b/static/icons/plus.svg @@ -0,0 +1,3 @@ + + + -- cgit v1.2.3 From c5f0e9838ea1fc6d66026f139b955ea2ac181ef9 Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Sat, 30 Jul 2022 23:48:55 -0600 Subject: add about section to landing page --- src/components/About.svelte | 82 ++++++++++++++++++++++++++++++++++++++++++++ src/components/index.js | 1 + src/routes/index.svelte | 15 ++++++-- static/icons/github.svg | 3 ++ static/icons/twitter.svg | 3 ++ static/images/swoosh.png | Bin 0 -> 4382 bytes 6 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src/components/About.svelte create mode 100644 static/icons/github.svg create mode 100644 static/icons/twitter.svg create mode 100644 static/images/swoosh.png (limited to 'static') diff --git a/src/components/About.svelte b/src/components/About.svelte new file mode 100644 index 00000000..eb8e9a82 --- /dev/null +++ b/src/components/About.svelte @@ -0,0 +1,82 @@ + + +
+

About

+
+

+ Coinos is an open source bitcoin web wallet, point of sale, ecommerce marketplace and exchange + platform. Development started in Vancouver in September 2012 as a way to provide local + merchants with a convenient way to accept bitcoin payments. +

+ The feature set has grown over the years to accomodate a wide variety of use cases with the goal + of making it as easy as possible for anyone to get started using Bitcoin quickly, cheaply, and + securely. +

+ Anyone can download the source code and host their own instance of the platform backed by their + own bitcoin, liquid or lightning nodes, or reach out and we'll gladly set this up for you. + +

+

+ Once signed in, you can create both custodial and non-custodial wallets within your account. + The default custodial wallet allows funds to be deposited on any of the bitcoin, liquid or + lightning networks and seamlessly withdrawn over any other network without any conversion + process or fee. +

+ Using a non-custodial wallet means keys are generated client-side in your browser so we never have + access to the funds. Transactions from these accounts are subject to on-chain transaction fees + and Lightning Network payments are not supported but we advise using this account type or a paper + wallet for storing larger amounts. +

+ Intra-account transfers between custodial wallets of different users on our server are completely + free, instant, and unlimited. +

+
+ +
+
+

The Founder

+ + + +
+ Adam Soltys + Chief Technical Officer +
+ +
+ + +
+
+ +
    +
  • Running Bitcoin since 2011
  • +
  • 20+ years web development experience in government and industry
  • +
  • Early Bitcoin Vancouver meetup organizer
  • +
  • Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver
  • +
  • Yogi, permaculturist, anarchist, decentralist
  • +
  • Husband, father, brother, son
  • +
+
+
diff --git a/src/components/index.js b/src/components/index.js index 53f0fe99..afa4790c 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -9,3 +9,4 @@ export { default as RegisterOrLogin } from './RegisterOrLogin.svelte'; export { default as AppHeader } from './AppHeader.svelte'; export { default as LoadingSplash } from './LoadingSplash.svelte'; export { default as PageNotFound } from './404.svelte'; +export { default as About } from './About.svelte'; diff --git a/src/routes/index.svelte b/src/routes/index.svelte index cda885a3..5a9a0275 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,5 +1,13 @@

About

@@ -68,11 +77,8 @@
    -
  • Running Bitcoin since 2011
  • -
  • 20+ years web development experience in government and industry
  • -
  • Early Bitcoin Vancouver meetup organizer
  • -
  • Founder of The Bitcoin Co-op and early supporter of Decentral Vancouver
  • -
  • Yogi, permaculturist, anarchist, decentralist
  • -
  • Husband, father, brother, son
  • + {#each aboutAdam as about} +
  • {about}
  • + {/each}
diff --git a/src/components/Footer.svelte b/src/components/Footer.svelte new file mode 100644 index 00000000..0c682179 --- /dev/null +++ b/src/components/Footer.svelte @@ -0,0 +1,39 @@ + + +
+ + +
+

Follow Us

+ +
+ +
+

Company

+ +
+ + +
diff --git a/src/components/index.js b/src/components/index.js index afa4790c..dade4c2c 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -10,3 +10,4 @@ export { default as AppHeader } from './AppHeader.svelte'; export { default as LoadingSplash } from './LoadingSplash.svelte'; export { default as PageNotFound } from './404.svelte'; export { default as About } from './About.svelte'; +export { default as Footer } from './Footer.svelte'; diff --git a/src/routes/community.svelte b/src/routes/community.svelte new file mode 100644 index 00000000..e69de29b diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 2164c58b..c823f668 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -6,7 +6,8 @@ HowItWorksCard, FaqCard, Image, - About + About, + Footer } from '$comp'; let howItWorks; @@ -112,3 +113,5 @@
+ +