diff options
| author | Adam Soltys <[email protected]> | 2025-06-24 11:07:55 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-06-24 11:07:55 -0700 |
| commit | 3c0dfa5e26f54b5d2c2f69ba6c3eb176666a20d4 (patch) | |
| tree | 74e79afec098569ad219597cfa0a34544b2d8a70 /src/routes/(app)/accepted/create | |
| parent | 55d1ef3413306e1e4379ca69e5034240c29f6ec3 (diff) | |
| download | coinos-ui-3c0dfa5e26f54b5d2c2f69ba6c3eb176666a20d4.tar.gz coinos-ui-3c0dfa5e26f54b5d2c2f69ba6c3eb176666a20d4.zip | |
bitcoin accepted page
Diffstat (limited to 'src/routes/(app)/accepted/create')
| -rw-r--r-- | src/routes/(app)/accepted/create/+page.svelte | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/routes/(app)/accepted/create/+page.svelte b/src/routes/(app)/accepted/create/+page.svelte new file mode 100644 index 00000000..74316ba9 --- /dev/null +++ b/src/routes/(app)/accepted/create/+page.svelte @@ -0,0 +1,64 @@ +<script> + import { run, preventDefault } from 'svelte/legacy'; + + import { goto } from "$app/navigation"; + import { browser } from "$app/environment"; + import { t } from "$lib/translations"; + import Icon from "$comp/Icon.svelte"; + let el = $state(), text = $state(), pasted = $state(); + + 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)}`); + + run(() => { + 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 onsubmit={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" + onkeypress={keypress} + class="w-full p-4 border rounded-xl h-32 text-xl" + bind:value={text} + onpaste={() => (pasted = true)} + autocapitalize="none" +></textarea> + </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" + onclick={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> |
