diff --git a/apps/nextjs/src/components/layout/header/user.tsx b/apps/nextjs/src/components/layout/header/user.tsx index 376b31e3d..7bbc7fee1 100644 --- a/apps/nextjs/src/components/layout/header/user.tsx +++ b/apps/nextjs/src/components/layout/header/user.tsx @@ -1,11 +1,14 @@ import { UnstyledButton } from "@homarr/ui"; import { UserAvatar } from "~/components/user-avatar"; +import { UserAvatarMenu } from "~/components/user-avatar-menu"; export const UserButton = () => { return ( - - - + + + + + ); }; diff --git a/apps/nextjs/src/components/user-avatar-menu.tsx b/apps/nextjs/src/components/user-avatar-menu.tsx new file mode 100644 index 000000000..1745eb847 --- /dev/null +++ b/apps/nextjs/src/components/user-avatar-menu.tsx @@ -0,0 +1,61 @@ +"use client"; + +import type { ReactNode } from "react"; +import Link from "next/link"; + +import { useScopedI18n } from "@homarr/translation/client"; +import { + IconDashboard, + IconLogout, + IconMoon, + IconSun, + IconTool, + Menu, + useMantineColorScheme, +} from "@homarr/ui"; + +interface UserAvatarMenuProps { + children: ReactNode; +} + +export const UserAvatarMenu = ({ children }: UserAvatarMenuProps) => { + const t = useScopedI18n("common.userAvatar.menu"); + const { colorScheme, toggleColorScheme } = useMantineColorScheme(); + + const ColorSchemeIcon = colorScheme === "dark" ? IconSun : IconMoon; + + const colorSchemeText = + colorScheme === "dark" ? t("switchToLightMode") : t("switchToDarkMode"); + + return ( + + + } + > + {colorSchemeText} + + } + > + {t("navigateDefaultBoard")} + + } + > + {t("management")} + + + } color="red"> + {t("logout")} + + + {children} + + ); +}; diff --git a/packages/translation/src/lang/en.ts b/packages/translation/src/lang/en.ts index 62acddd59..ea712acad 100644 --- a/packages/translation/src/lang/en.ts +++ b/packages/translation/src/lang/en.ts @@ -155,6 +155,15 @@ export default { placeholder: "Search for anything...", nothingFound: "Nothing found", }, + userAvatar: { + menu: { + switchToDarkMode: "Switch to dark mode", + switchToLightMode: "Switch to light mode", + management: "Management", + logout: "Logout", + navigateDefaultBoard: "Navigate to default board", + }, + }, noResults: "No results found", }, section: {