From 77fef9857fa15b0c052a6925e194c9960eb3b69a Mon Sep 17 00:00:00 2001 From: benthecarman Date: Tue, 2 Apr 2024 22:54:34 -0500 Subject: [PATCH] Add DEFAULT_NOSTR_NAME const --- src/routes/EditProfile.tsx | 3 ++- src/routes/Main.tsx | 3 ++- src/routes/Profile.tsx | 4 ++-- src/routes/setup/ImportProfile.tsx | 3 ++- src/routes/setup/NewProfile.tsx | 3 ++- src/utils/nostr.ts | 2 ++ 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/routes/EditProfile.tsx b/src/routes/EditProfile.tsx index 3479f14..bc5e705 100644 --- a/src/routes/EditProfile.tsx +++ b/src/routes/EditProfile.tsx @@ -11,6 +11,7 @@ import { NavBar } from "~/components"; import { useMegaStore } from "~/state/megaStore"; +import { DEFAULT_NOSTR_NAME } from "~/utils"; export function EditProfile() { const [state, _actions] = useMegaStore(); @@ -23,7 +24,7 @@ export function EditProfile() { const profile = state.mutiny_wallet?.get_nostr_profile(); return { - name: profile?.display_name || profile?.name || "Anon", + name: profile?.display_name || profile?.name || DEFAULT_NOSTR_NAME, picture: profile?.picture || undefined, lud16: profile?.lud16 || undefined, nip05: profile?.nip05 || undefined diff --git a/src/routes/Main.tsx b/src/routes/Main.tsx index 7b787e8..8fd9a58 100644 --- a/src/routes/Main.tsx +++ b/src/routes/Main.tsx @@ -16,6 +16,7 @@ import { } from "~/components"; import { Fab } from "~/components/Fab"; import { useMegaStore } from "~/state/megaStore"; +import { DEFAULT_NOSTR_NAME } from "~/utils"; export function WalletHeader(props: { loading: boolean }) { const navigate = useNavigate(); @@ -25,7 +26,7 @@ export function WalletHeader(props: { loading: boolean }) { const profile = state.mutiny_wallet?.get_nostr_profile(); return { - name: profile?.display_name || profile?.name || "Anon", + name: profile?.display_name || profile?.name || DEFAULT_NOSTR_NAME, picture: profile?.picture || undefined, // TODO: this but for real lud16: profile?.lud16 || undefined diff --git a/src/routes/Profile.tsx b/src/routes/Profile.tsx index 73ea6b3..e78de64 100644 --- a/src/routes/Profile.tsx +++ b/src/routes/Profile.tsx @@ -17,7 +17,7 @@ import { } from "~/components"; import { useI18n } from "~/i18n/context"; import { useMegaStore } from "~/state/megaStore"; -import { useCopy } from "~/utils"; +import { DEFAULT_NOSTR_NAME, useCopy } from "~/utils"; export function Profile() { const [state, _actions] = useMegaStore(); @@ -31,7 +31,7 @@ export function Profile() { console.log("profile", profile); return { - name: profile?.display_name || profile?.name || "Anon", + name: profile?.display_name || profile?.name || DEFAULT_NOSTR_NAME, picture: profile?.picture || undefined, lud16: profile?.lud16 || undefined, deleted: profile?.deleted || false diff --git a/src/routes/setup/ImportProfile.tsx b/src/routes/setup/ImportProfile.tsx index 551956f..90cb5d6 100644 --- a/src/routes/setup/ImportProfile.tsx +++ b/src/routes/setup/ImportProfile.tsx @@ -3,6 +3,7 @@ import { Show } from "solid-js"; import { Button, ButtonLink, DefaultMain, ImportNsecForm } from "~/components"; import { useMegaStore } from "~/state/megaStore"; +import { DEFAULT_NOSTR_NAME } from "~/utils"; export function ImportProfile() { const [state, _actions] = useMegaStore(); @@ -11,7 +12,7 @@ export function ImportProfile() { async function handleSkip() { // set up an empty profile so we at least have some kind0 event await state.mutiny_wallet?.edit_nostr_profile( - "Anon", + DEFAULT_NOSTR_NAME, undefined, undefined, undefined diff --git a/src/routes/setup/NewProfile.tsx b/src/routes/setup/NewProfile.tsx index 74ce679..ee6dae4 100644 --- a/src/routes/setup/NewProfile.tsx +++ b/src/routes/setup/NewProfile.tsx @@ -8,6 +8,7 @@ import { EditProfileForm } from "~/components"; import { useMegaStore } from "~/state/megaStore"; +import { DEFAULT_NOSTR_NAME } from "~/utils"; export function NewProfile() { const [state, _actions] = useMegaStore(); @@ -19,7 +20,7 @@ export function NewProfile() { async function handleSkip() { // set up an empty profile so we at least have some kind0 event const profile = await state.mutiny_wallet?.edit_nostr_profile( - "Anon", + DEFAULT_NOSTR_NAME, undefined, undefined, undefined diff --git a/src/utils/nostr.ts b/src/utils/nostr.ts index c841764..79bf527 100644 --- a/src/utils/nostr.ts +++ b/src/utils/nostr.ts @@ -71,3 +71,5 @@ export function getPrimalImageUrl(image_url?: string): string | undefined { image_url )}`; } + +export const DEFAULT_NOSTR_NAME = "Anon";