import { Link } from 'react-router'; import * as Dropdown from '@/components/ui/dropdown-menu'; import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'; import { User, LogOut, Settings, Puzzle, Sun, Moon, Bot, UserCog, Palette } from 'lucide-react'; import { useAuth } from 'hooks/useAuth'; import { useTranslation } from '@/lib/i18n'; import { useColorMode, useTheme } from '@/components/ui/ThemeProvider'; import { useSettings } from 'state/useSettings'; const { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } = Dropdown; export function UserMenu() { const { user, isLoading } = useAuth(); const { t } = useTranslation(); const { colorMode, setColorMode } = useColorMode(); const { themeId, setTheme, themes } = useTheme(); const { settings, saveSettings } = useSettings(); if (isLoading) return null; const toggleColorMode = () => { const next = colorMode === 'dark' ? 'light' : 'dark'; setColorMode(next); saveSettings({ ...settings, appearance: { ...settings.appearance, colorMode: next } }); }; return ( {/* Every theme this build ships, listed. Deliberately the crudest possible control: the point tonight is proving the app can wear a different skin at all, not designing a picker. A real one belongs in an appearance settings screen, which does not exist yet. */} {themes.map((theme) => ( setTheme(theme.id)} className="cursor-pointer"> {theme.name} ))} {t('header.userMenu.profile')} {t('header.userMenu.systemSettings')} {/* No Resources entry. `/settings/resources` has never been a route, so this item sent you to the catch-all and out to `/` — a menu entry that looks like navigation and is a bounce. (navigation-audit M8.) */} AI Integrations {/* Owner only. This is tidiness, not access control — the route stays reachable and its endpoints are gated server-side by ownerGate, because a hidden menu item is not a permission and anything relying on it being hidden is already wrong. */} {user?.role === 'Super Admin' && ( User Management )} {colorMode === 'dark' ? : } {colorMode === 'dark' ? 'Light Mode' : 'Dark Mode'} {t('header.userMenu.signOut')} ); }