diff --git a/src/components/nostr/user-menu.tsx b/src/components/nostr/user-menu.tsx index 635563d..0075e19 100644 --- a/src/components/nostr/user-menu.tsx +++ b/src/components/nostr/user-menu.tsx @@ -1,12 +1,4 @@ -import { - User, - HardDrive, - Palette, - Wallet, - Zap, - X, - RefreshCw, -} from "lucide-react"; +import { User, HardDrive, Palette, Wallet, X, RefreshCw } from "lucide-react"; import accounts from "@/services/accounts"; import { useProfile } from "@/hooks/useProfile"; import { use$ } from "applesauce-react/hooks"; @@ -84,11 +76,19 @@ export default function UserMenu() { const [showWalletInfo, setShowWalletInfo] = useState(false); const { themeId, setTheme, availableThemes } = useTheme(); - // Get wallet service profile for display name - const walletServiceProfile = useProfile(nwcConnection?.service); + // Get wallet service profile for display name, using wallet relays as hints + const walletServiceProfile = useProfile( + nwcConnection?.service, + nwcConnection?.relays, + ); // Use wallet hook for real-time balance and methods - const { disconnect: disconnectWallet, refreshBalance, balance } = useWallet(); + const { + disconnect: disconnectWallet, + refreshBalance, + balance, + wallet, + } = useWallet(); function openProfile() { if (!account?.pubkey) return; @@ -138,6 +138,16 @@ export default function UserMenu() { ); } + function openWalletServiceProfile() { + if (!nwcConnection?.service) return; + addWindow( + "profile", + { pubkey: nwcConnection.service }, + `Profile ${nwcConnection.service.slice(0, 8)}...`, + ); + setShowWalletInfo(false); + } + return ( <> @@ -185,7 +195,27 @@ export default function UserMenu() { {/* Wallet Name */}
Wallet: - {getWalletName()} + +
+ + {/* Connection Status */} +
+ Status: +
+ + + {wallet ? "Connected" : "Disconnected"} + +
{/* Lightning Address */} @@ -276,6 +306,8 @@ export default function UserMenu() { + + {/* Wallet Section */} {nwcConnection ? ( setShowWalletInfo(true)} >
- + {balance !== undefined || nwcConnection.balance !== undefined ? ( @@ -291,9 +323,16 @@ export default function UserMenu() { ) : null}
- - {getWalletName()} - +
+ + + {getWalletName()} + +
) : ( (); const abortControllerRef = useRef(null); @@ -37,8 +41,12 @@ export function useProfile(pubkey?: string): ProfileContent | undefined { } }); - // Fetch from network - const sub = profileLoader({ kind: kinds.Metadata, pubkey }).subscribe({ + // Fetch from network with optional relay hints + const sub = profileLoader({ + kind: kinds.Metadata, + pubkey, + ...(relayHints && relayHints.length > 0 && { relays: relayHints }), + }).subscribe({ next: async (fetchedEvent) => { if (controller.signal.aborted) return; if (!fetchedEvent || !fetchedEvent.content) return; @@ -77,7 +85,7 @@ export function useProfile(pubkey?: string): ProfileContent | undefined { controller.abort(); sub.unsubscribe(); }; - }, [pubkey]); + }, [pubkey, relayHints]); return profile; }