From cbc1fc272af8c157973e973eace0e0c110a67752 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Tue, 20 Jan 2026 19:14:25 +0100 Subject: [PATCH] feat(user-menu): make relays and blossom servers collapsible dropdowns (#177) * feat(user-menu): make relays and blossom servers collapsible dropdowns Convert the relays and blossom servers sections in the user menu from always-expanded lists to collapsible dropdown submenus. Each section now shows a count next to the title and expands on click to show the full list. This saves vertical space in the menu when users have many relays or servers configured. * refactor(user-menu): reorganize menu items for better UX Reorder menu sections by logical grouping: - Identity (user profile) at top - Account config (wallet, relays, blossom) grouped together - App preferences (theme) in consistent location - Promotional (support grimoire) separated - Session actions (login/logout) at bottom This provides a more intuitive flow and consistent placement regardless of login state. * refactor(user-menu): revert dropdowns, add login/logout icons - Revert relays and blossom servers back to flat lists (not dropdowns) - Move login to first option for logged out users - Add LogIn/LogOut icons from lucide-react - Keep the reorganized menu structure * style(user-menu): clean up icons and font consistency - Make theme icon muted like other icons - Remove HardDrive icons from blossom servers section - Make blossom label consistent with relays (plain text) - Remove unused HardDrive import * fix(user-menu): close menu when clicking relays, blossom, or donate Wrap RelayLink items in DropdownMenuItem with asChild to properly trigger menu close on click. Convert Support Grimoire section from a raw div to DropdownMenuItem so it also closes the menu. * fix(user-menu): properly close menu when clicking relay items Use pointer-events-none on RelayLink to make it purely presentational, and handle the click on DropdownMenuItem instead. This ensures the menu closes properly when clicking a relay. --------- Co-authored-by: Claude --- src/components/nostr/user-menu.tsx | 170 +++++++++++++++-------------- 1 file changed, 88 insertions(+), 82 deletions(-) diff --git a/src/components/nostr/user-menu.tsx b/src/components/nostr/user-menu.tsx index 65b694d..5a7667c 100644 --- a/src/components/nostr/user-menu.tsx +++ b/src/components/nostr/user-menu.tsx @@ -1,6 +1,5 @@ import { User, - HardDrive, Palette, Wallet, X, @@ -8,6 +7,8 @@ import { Eye, EyeOff, Zap, + LogIn, + LogOut, } from "lucide-react"; import accounts from "@/services/accounts"; import { useProfile } from "@/hooks/useProfile"; @@ -370,6 +371,18 @@ export default function UserMenu() { + {/* Login first for logged out users */} + {!account && ( + <> + setShowLogin(true)}> + + Log in + + + + )} + + {/* User Profile - Identity section */} {account && ( <> @@ -385,7 +398,7 @@ export default function UserMenu() { )} - {/* Wallet Section - Always show */} + {/* Wallet Section */} {nwcConnection ? ( )} - {/* Support Grimoire Section */} - - -
-
- - Support Grimoire -
- -
- - - {formatSats(monthlyDonations)} - - {" / "} - {formatSats(MONTHLY_GOAL_SATS)} - - - {goalProgress.toFixed(0)}% - -
-
-
- + {/* Account Configuration - Relays & Blossom */} {account && ( <> {relays && relays.length > 0 && ( - <> - - - - Relays - - {relays.map((relay) => ( + + + Relays + + {relays.map((relay) => ( + addWindow("relay", { url: relay.url })} + > - ))} - - +
+ ))} +
)} {blossomServers && blossomServers.length > 0 && ( - <> - - - - - Blossom Servers - - {blossomServers.map((server) => ( - { - addWindow( - "blossom", - { subcommand: "list", serverUrl: server }, - `Files on ${server}`, - ); - }} - > - - {server} - - ))} - - + + + Blossom Servers + + {blossomServers.map((server) => ( + { + addWindow( + "blossom", + { subcommand: "list", serverUrl: server }, + `Files on ${server}`, + ); + }} + > + {server} + + ))} + )} - - - - Log out - )} - {!account && ( - <> - - setShowLogin(true)}> - Log in - - - )} - - {/* Theme Section - Always show */} + {/* App Preferences - Theme */} - + Theme @@ -544,6 +514,42 @@ export default function UserMenu() { ))} + + {/* Support Grimoire */} + + +
+ + Support Grimoire +
+ +
+ + + {formatSats(monthlyDonations)} + + {" / "} + {formatSats(MONTHLY_GOAL_SATS)} + + + {goalProgress.toFixed(0)}% + +
+
+ + {/* Logout at bottom for logged in users */} + {account && ( + <> + + + + Log out + + + )}