Add DEFAULT_NOSTR_NAME const

This commit is contained in:
benthecarman
2024-04-02 22:54:34 -05:00
committed by Paul Miller
parent f4cae92162
commit 77fef9857f
6 changed files with 12 additions and 6 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -71,3 +71,5 @@ export function getPrimalImageUrl(image_url?: string): string | undefined {
image_url
)}`;
}
export const DEFAULT_NOSTR_NAME = "Anon";