diff options
| author | Adam Soltys <[email protected]> | 2024-09-25 13:59:21 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-25 13:59:21 -0700 |
| commit | 7c03500caa3c594a1aa284e9d533761f47ecc6bc (patch) | |
| tree | 4adabf6aa2df9b8ca629381932e240e97fc76854 /src/routes/(app)/account | |
| parent | 08f07a777c42c10b9ebf18727a4af45161b1800d (diff) | |
| download | coinos-ui-7c03500caa3c594a1aa284e9d533761f47ecc6bc.tar.gz coinos-ui-7c03500caa3c594a1aa284e9d533761f47ecc6bc.zip | |
move nwc string
Diffstat (limited to 'src/routes/(app)/account')
| -rw-r--r-- | src/routes/(app)/account/[id]/+page.svelte | 67 |
1 files changed, 49 insertions, 18 deletions
diff --git a/src/routes/(app)/account/[id]/+page.svelte b/src/routes/(app)/account/[id]/+page.svelte index 76473a89..3f7bb900 100644 --- a/src/routes/(app)/account/[id]/+page.svelte +++ b/src/routes/(app)/account/[id]/+page.svelte @@ -9,6 +9,10 @@ import { decrypt } from "nostr-tools/nip49"; import { entropyToMnemonic, mnemonicToSeed } from "@scure/bip39"; import { wordlist } from "@scure/bip39/wordlists/english"; + import { + PUBLIC_COINOS_PUBKEY as pk, + PUBLIC_COINOS_RELAY as relay, + } from "$env/static/public"; export let data; let { account, user } = data; @@ -32,6 +36,12 @@ fail(e.message); } }; + +let nwc; + let revealNwc = () => + (nwc = `nostr+walletconnect://${pk}?relay=${encodeURIComponent( + relay + )}&secret=${user.nwc}`); </script> <div class="space-y-5"> @@ -39,17 +49,7 @@ <div class="container w-full mx-auto text-lg px-4 max-w-xl space-y-2"> <form class="space-y-5" method="POST"> - <!-- <div> --> - <!-- <label for="display" class="font-bold mb-1 block">Account name</label> --> - <!-- <input use:focus type="text" name="name" bind:value={name} /> --> - <!-- </div> --> - <!-- --> <div class="space-y-2"> - <!-- <button --> - <!-- type="submit" --> - <!-- class="rounded-2xl border py-5 font-bold mx-auto bg-black text-white px-6 w-full" --> - <!-- >{$t("accounts.save")}</button --> - <!-- > --> {#if mnemonic} <Mnemonic {mnemonic} /> @@ -70,17 +70,48 @@ <Icon icon="eye" style="w-8 my-auto" /> <div class="my-auto">{$t("accounts.revealMnemonic")}</div></button > + {:else if nwc} + <div class="break-all grow text-xl"> + {nwc} + </div> + <button + on:click={() => copy(nwc)} + type="button" + class="flex gap-2 rounded-2xl border py-5 mx-auto px-6 w-full justify-center" + > + <Icon icon="copy" style="w-8 my-auto" /> + <div class="my-auto">{$t("accounts.copy")}</div></button + > + <a href={`/qr/${encodeURIComponent(nwc)}`} class="my-auto block"> + <button + on:click={() => copy(nwc)} + type="button" + class="flex gap-2 rounded-2xl border py-5 mx-auto px-6 w-full justify-center" + > + <Icon icon="qr" style="w-8 my-auto invert" /> + <div class="my-auto">{$t("user.receive.showQR")}</div></button + > + </a> + {:else} + <button + on:click={revealNwc} + type="button" + class="flex gap-2 rounded-2xl border py-5 mx-auto px-6 w-full justify-center" + > + <Icon icon="eye" style="w-8 my-auto" /> + <div class="my-auto">{$t("accounts.revealNwc")}</div></button + > {/if} {#if seed} - <button - on:click={del} - type="button" - class="flex gap-2 rounded-2xl border py-5 mx-auto px-6 w-full justify-center" - > - <Icon icon="trash" style="w-8 my-auto" /> - <div class="my-auto">{$t("accounts.deleteAccount")}</div></button - > + <button + on:click={del} + type="button" + class="flex gap-2 rounded-2xl border py-5 mx-auto px-6 w-full justify-center" + > + <Icon icon="trash" style="w-8 my-auto" /> + <div class="my-auto">{$t("accounts.deleteAccount")}</div></button + > {/if} </div> |
