aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/qr/create
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-20 15:43:01 -0700
committerAdam Soltys <[email protected]>2024-09-20 15:44:21 -0700
commit200c5ff1f4e41ed907a1dd4a0337d8ee0a94b8be (patch)
treed91132e87c0a5ae7c76ba68caa3016729945e996 /src/routes/(app)/qr/create
parentfb8510db273f78317a02ca151f7f24a9b8de29ab (diff)
downloadcoinos-ui-200c5ff1f4e41ed907a1dd4a0337d8ee0a94b8be.tar.gz
coinos-ui-200c5ff1f4e41ed907a1dd4a0337d8ee0a94b8be.zip
qr page
Diffstat (limited to 'src/routes/(app)/qr/create')
-rw-r--r--src/routes/(app)/qr/create/+page.svelte60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/routes/(app)/qr/create/+page.svelte b/src/routes/(app)/qr/create/+page.svelte
new file mode 100644
index 00000000..fd99a54b
--- /dev/null
+++ b/src/routes/(app)/qr/create/+page.svelte
@@ -0,0 +1,60 @@
+<script>
+ import { goto } from "$app/navigation";
+ import { browser } from "$app/environment";
+ import { t } from "$lib/translations";
+ import Icon from "$comp/Icon.svelte";
+ let el, text, pasted;
+
+ let keypress = (e) =>
+ e.key === "Enter" ? e.preventDefault() || el.click() : (pasted = false);
+
+ let paste = async () => {
+ text = await navigator.clipboard.readText();
+ pasted = true;
+ };
+
+ let submit = () => goto(`/qr/${encodeURIComponent(text)}`);
+
+ $: if (browser && pasted && text) el.click() && (pasted = false);
+</script>
+
+<div class="container px-4 max-w-lg mx-auto space-y-5 mt-20">
+ <h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">
+ Create QR
+ </h1>
+
+ <form on:submit|preventDefault={submit} class="space-y-2 text-xl">
+ <div class="mb-2">
+ <textarea
+ use:focus
+ name="text"
+ placeholder="Enter some text or a URL to put in a QR"
+ on:keypress={keypress}
+ class="w-full p-4 border rounded-xl h-32 text-xl"
+ bind:value={text}
+ on:paste={() => (pasted = true)}
+ autocapitalize="none"
+ />
+ </div>
+
+ <div class="flex gap-2">
+ <button
+ type="button"
+ class="flex border rounded-2xl px-6 py-5 font-bold hover:opacity-80 w-full bg-primary justify-center gap-2"
+ on:click={paste}
+ >
+ <Icon icon="paste" style="w-8 my-auto" />
+ <div class="my-auto">{$t("user.send.paste")}</div>
+ </button>
+
+ <button
+ bind:this={el}
+ type="submit"
+ class="flex bg-black text-white border rounded-2xl px-6 py-5 w-full font-bold gap-2 justify-center"
+ >
+ <Icon icon="send" style="w-8 my-auto invert" />
+ <div class="my-auto">{$t("user.dashboard.go")}</div>
+ </button>
+ </div>
+ </form>
+</div>