aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/utils.js1
-rw-r--r--src/routes/(app)/[username]/card/[serial]/+page.server.js21
-rw-r--r--src/routes/(app)/[username]/card/[serial]/+page.svelte38
-rw-r--r--src/routes/(app)/pot/[name]/+page.svelte54
-rw-r--r--static/icons/nfc.svg1
-rw-r--r--static/images/moneypot.jpgbin0 -> 34030 bytes
6 files changed, 91 insertions, 24 deletions
diff --git a/src/lib/utils.js b/src/lib/utils.js
index be26ee45..a91ef639 100644
--- a/src/lib/utils.js
+++ b/src/lib/utils.js
@@ -26,7 +26,6 @@ export let g = (url, fetch, headers) =>
});
export let get = (url, headers = {}) => {
- console.log("GETTING", browser, base, url);
return fetch(base + url, { headers })
.then(async (r) => {
if (r.ok) return r.text();
diff --git a/src/routes/(app)/[username]/card/[serial]/+page.server.js b/src/routes/(app)/[username]/card/[serial]/+page.server.js
index 49d7504c..72ce96d5 100644
--- a/src/routes/(app)/[username]/card/[serial]/+page.server.js
+++ b/src/routes/(app)/[username]/card/[serial]/+page.server.js
@@ -1,3 +1,18 @@
-export let load = async ({ params }) => {
- return params;
-}
+import { auth, get } from '$lib/utils';
+import { redirect } from "@sveltejs/kit"
+
+export let load = async ({ cookies, params }) => {
+ let { serial } = params;
+ let pot;
+ try {
+ pot = await get(`/pot/${serial}`, auth(cookies));
+ } catch (e) {
+ console.log(e);
+ }
+
+ console.log('POT', pot);
+
+ if (pot) throw redirect(307, `/pot/${serial}`);
+
+ return params;
+};
diff --git a/src/routes/(app)/[username]/card/[serial]/+page.svelte b/src/routes/(app)/[username]/card/[serial]/+page.svelte
index e40554f2..aee3be28 100644
--- a/src/routes/(app)/[username]/card/[serial]/+page.svelte
+++ b/src/routes/(app)/[username]/card/[serial]/+page.svelte
@@ -1,9 +1,35 @@
<script>
- export let data;
- let { serial } = data;
- let balance = 0;
+ import { Card, Icon } from '$comp';
+ export let data;
+ let { serial } = data;
+ let balance = 0;
</script>
-Card {serial}
-
-Balance {balance}
+<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"
+ >
+ <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)/pot/[name]/+page.svelte b/src/routes/(app)/pot/[name]/+page.svelte
index 7b3d890b..653166c7 100644
--- a/src/routes/(app)/pot/[name]/+page.svelte
+++ b/src/routes/(app)/pot/[name]/+page.svelte
@@ -20,6 +20,9 @@
$: amountFiat = parseFloat(((amount * rate) / sats).toFixed(2));
$loginRedirect = $page.url.pathname;
+
+ let show;
+ let toggle = () => (show = !show);
</script>
<div class="container px-4 max-w-xl mx-auto mt-10 space-y-5">
@@ -31,12 +34,15 @@
<div class="flex justify-center items-center text-center">
<div class="shadow-xl rounded-3xl px-10 pt-5 pb-10 space-y-5 w-full mx-5">
- <div class="relative">
+ <div class="relative flex justify-center gap-2">
<!-- <p class="absolute right-0 top-1 underline"><Icon icon="settings" /></p> -->
- <h1 class="text-2xl md:text-3xl font-semibold">Public Pot</h1>
+ <img src="/images/moneypot.jpg" class="w-24" />
+ <h1 class="text-2xl md:text-3xl font-semibold my-auto">Money Pot</h1>
</div>
<p class="text-secondary">Anyone who knows the URL to this pot can add or take out funds</p>
- <img {src} class="mx-auto" alt={name} />
+ {#if show}
+ <img {src} class="mx-auto" alt={name} />
+ {/if}
<div class="flex justify-center gap-4">
<div class="my-auto">
<h2 class="text-2xl md:text-3xl font-semibold">
@@ -47,17 +53,37 @@
</h3>
</div>
</div>
- <div class="mx-auto my-auto flex gap-2 justify-center" data-sveltekit-prefetch="off">
- <a href={`/send/pot/${name}`}>
- <button class="text-lg rounded-full border py-3 px-7 font-bold hover:opacity-80">
- Chip in
- </button>
- </a>
- <a href={`/pot/${name}/withdraw`}>
- <button class="text-lg rounded-full border py-3 px-7 font-bold hover:opacity-80">
- Dip in
- </button>
- </a>
+ <div class="flex gap-2" data-sveltekit-prefetch="off">
+ <div class="grow">
+ <a href={`/send/pot/${name}`}>
+ <button
+ class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center"
+ >
+ <Icon icon="down" />
+ Chip in
+ </button>
+ </a>
+ </div>
+ <div class="grow">
+ <a href={`/pot/${name}/withdraw`}>
+ <button
+ class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center"
+ >
+ <Icon icon="down" style="rotate-180" />
+ Dip in
+ </button>
+ </a>
+ </div>
+ </div>
+ <div class="flex gap-2" data-sveltekit-prefetch="off">
+ <button class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center" on:click={toggle}>
+ <Icon icon="qr" style="invert" />
+ QR
+ </button>
+ <button class="rounded-full border py-3 px-2 font-bold hover:opacity-80 flex gap-1 w-full justify-center">
+ <Icon icon="settings" />
+ Settings
+ </button>
</div>
<div class="text-base">
{#each payments as p}
diff --git a/static/icons/nfc.svg b/static/icons/nfc.svg
new file mode 100644
index 00000000..3fa2de48
--- /dev/null
+++ b/static/icons/nfc.svg
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 88.5 122.88" style="enable-background:new 0 0 88.5 122.88" xml:space="preserve"><g><path d="M3.93,95.55h7.75l10.08,14.84V95.55h7.85v26.88h-7.85l-10.02-14.76v14.76H3.93V95.55L3.93,95.55z M4.35,60.42 c-2.47-3.71-3.94-9.36-4.28-14.98c-0.34-5.59,0.45-11.33,2.48-15.3l2.06-4.02l3.52,2.82L41.6,55.8c1.36-5.03,1.79-10.07,1.38-14.83 c-0.55-6.44-3.36-13.42-6.69-17.98l6.34-3.7c4.14,5.66,7.04,13.29,7.71,21.07c0.63,7.33-0.44,15.24-3.5,22.97l-1.84,4.63 l-3.89-3.12L7.72,38.06c-0.35,2.13-0.44,4.53-0.29,6.95c0.27,4.43,1.32,8.72,3.06,11.34L4.35,60.42L4.35,60.42z M68.05,85.83 c8.26-12.91,13.1-29.35,13.09-42.13c-0.01-16.05-5.04-30.56-11.44-40.04L76.14,0C83.13,10.48,88.5,26.32,88.5,43.7 c0,14.05-5.49,32.42-14.59,46.63L68.05,85.83L68.05,85.83z M52.77,73.9c5.89-8.46,9.4-19.93,9.34-30.61 C62.05,32.67,59,21.97,52.97,13.35l6.38-3.7c6.74,9.75,10.05,21.73,10.12,33.61c0.07,12.15-4.11,25.45-10.87,35.16L52.77,73.9 L52.77,73.9z M33.98,95.55h20.53v5.78h-12.2v4.69h10.44v5.44H42.31v10.96h-8.33V95.55L33.98,95.55z M75.7,111.43l7.28,2.2 c-0.49,2.04-1.26,3.75-2.31,5.11c-1.05,1.37-2.35,2.4-3.92,3.1c-1.56,0.69-3.54,1.04-5.95,1.04c-2.93,0-5.31-0.43-7.17-1.27 c-1.85-0.85-3.45-2.35-4.79-4.48c-1.35-2.13-2.02-4.87-2.02-8.2c0-4.44,1.18-7.86,3.55-10.25c2.37-2.38,5.72-3.58,10.05-3.58 c3.38,0,6.05,0.68,7.99,2.05c1.93,1.37,3.38,3.47,4.32,6.31l-7.32,1.62c-0.26-0.81-0.53-1.41-0.81-1.78 c-0.47-0.63-1.04-1.12-1.71-1.46c-0.68-0.34-1.43-0.51-2.26-0.51c-1.89,0-3.33,0.76-4.34,2.26c-0.76,1.12-1.14,2.88-1.14,5.28 c0,2.98,0.45,5.01,1.36,6.12c0.91,1.1,2.18,1.65,3.82,1.65c1.59,0,2.79-0.44,3.6-1.34C74.74,114.42,75.33,113.13,75.7,111.43 L75.7,111.43z"/></g></svg> \ No newline at end of file
diff --git a/static/images/moneypot.jpg b/static/images/moneypot.jpg
new file mode 100644
index 00000000..2084a99a
--- /dev/null
+++ b/static/images/moneypot.jpg
Binary files differ