From bcdf195a7f92d145dc1c57ac49a57f15a20f3de3 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 12 Jan 2026 20:01:47 +0000 Subject: [PATCH] refactor: show wallet pubkey username instead of disconnect option - Remove disconnect wallet option from user menu - Display wallet owner's profile name/username instead of generic alias - Use profile lookup with getDisplayName for better UX - Consolidate balance formatting into WalletMenuItem component --- src/components/nostr/user-menu.tsx | 73 ++++++++++++++++-------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/src/components/nostr/user-menu.tsx b/src/components/nostr/user-menu.tsx index c57d8b8..6901039 100644 --- a/src/components/nostr/user-menu.tsx +++ b/src/components/nostr/user-menu.tsx @@ -52,6 +52,41 @@ function UserLabel({ pubkey }: { pubkey: string }) { ); } +function WalletMenuItem({ + walletPubkey, + balance, + onClick, +}: { + walletPubkey: string; + balance: number; + onClick: () => void; +}) { + const profile = useProfile(walletPubkey); + + function formatBalance(msats: number): string { + const sats = Math.floor(msats / 1000); + if (sats >= 1000000) { + return `${(sats / 1000000).toFixed(2)}M`; + } else if (sats >= 1000) { + return `${(sats / 1000).toFixed(2)}K`; + } + return sats.toString(); + } + + return ( + + +
+ {getDisplayName(walletPubkey, profile)} + + + {formatBalance(balance)} sats + +
+
+ ); +} + export default function UserMenu() { const account = use$(accounts.active$); const walletState = use$(walletManager.state$); @@ -79,20 +114,6 @@ export default function UserMenu() { addWindow("wallet", {}, "Wallet"); } - function disconnectWallet() { - walletManager.disconnect(); - } - - function formatBalance(msats: number): string { - const sats = Math.floor(msats / 1000); - if (sats >= 1000000) { - return `${(sats / 1000000).toFixed(2)}M`; - } else if (sats >= 1000) { - return `${(sats / 1000).toFixed(2)}K`; - } - return sats.toString(); - } - return ( <> @@ -157,27 +178,11 @@ export default function UserMenu() { Wallet - - -
- - {walletState.info.alias || "Connected Wallet"} - - - - {formatBalance(walletState.info.balance)} sats - -
-
- - Disconnect Wallet - + /> ) : (