aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/components/Account.svelte2
-rw-r--r--src/locales/en.json2
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.svelte31
-rw-r--r--src/routes/(app)/account/[id]/+page.svelte67
4 files changed, 51 insertions, 51 deletions
diff --git a/src/components/Account.svelte b/src/components/Account.svelte
index a57fff12..4f615c49 100644
--- a/src/components/Account.svelte
+++ b/src/components/Account.svelte
@@ -21,13 +21,11 @@
<Icon icon="clock" style="w-8 my-auto" />
</button>
</a>
- {#if seed}
<a href={`/account/${id}`} class="contents">
<button class="flex gap-1 mb-auto pb-4 pl-4">
<Icon icon="settings" style="w-8 my-auto" />
</button>
</a>
- {/if}
</div>
<div class="flex justify-center w-full text-lg gap-2">
diff --git a/src/locales/en.json b/src/locales/en.json
index 8e2c93c3..fe67a2b7 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1,5 +1,7 @@
{
"accounts": {
+ "showQR": "Show QR",
+ "revealNwc": "Reveal NWC",
"finish": "Finish",
"back": "Back",
"next": "Next",
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte
index cd6a44a7..c6dc6569 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.svelte
+++ b/src/routes/(app)/[username]/(profile)/+layout.svelte
@@ -6,10 +6,6 @@
import { sign, send } from "$lib/nostr";
import { bech32m } from "@scure/base";
import { page } from "$app/stores";
- import {
- PUBLIC_COINOS_PUBKEY as pk,
- PUBLIC_COINOS_RELAY as relay,
- } from "$env/static/public";
export let data;
@@ -27,12 +23,6 @@
$: lnaddr = `${stripped}@${$page.url.host}`;
$: profile = `${$page.url.host}/${stripped}`;
- $: nwc =
- user &&
- `nostr+walletconnect://${pk}?relay=${encodeURIComponent(relay)}&secret=${
- user.nwc
- }`;
-
let follow = async () => {
user.follows.push(["p", subject.pubkey, "wss://nostr.coinos.io", stripped]);
update();
@@ -174,27 +164,6 @@
</div>
</div>
</div>
- {#if user.id === subject.id}
- <div>
- <div class="text-secondary">{$t("user.nwc")}</div>
- <div class="flex gap-4">
- <div class="break-all grow text-xl">
- {nwc}
- </div>
- <div class="flex my-auto gap-1">
- <button class="my-auto" on:click={() => copy(nwc)}
- ><Icon
- icon="copy"
- style="max-w-max w-8 min-w-[32px]"
- /></button
- >
- <a href={`/qr/${encodeURIComponent(nwc)}`} class="my-auto">
- <Icon icon="qr" style="invert max-w-max min-w-[32px]" />
- </a>
- </div>
- </div>
- </div>
- {/if}
</div>
{/if}
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>