- {isCollapsed ? (
-
-
-
-
-
- ) : (
-
- )}
+
+
+
);
};
diff --git a/apps/apollo-vertex/registry/shell/shell-user-profile.tsx b/apps/apollo-vertex/registry/shell/shell-user-profile.tsx
index 482053322..81009e127 100644
--- a/apps/apollo-vertex/registry/shell/shell-user-profile.tsx
+++ b/apps/apollo-vertex/registry/shell/shell-user-profile.tsx
@@ -1,26 +1,68 @@
"use client";
import { AnimatePresence, motion } from "framer-motion";
-import { LogOut } from "lucide-react";
+import { Globe, LogOut, Monitor, Moon, Sun } from "lucide-react";
+import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuSub,
+ DropdownMenuSubContent,
+ DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
+import { SUPPORTED_LOCALES, type SupportedLocale } from "@/lib/i18n";
import { useAuth } from "./shell-auth-provider";
+import { Text } from "./shell-text";
+import { useTheme } from "./shell-theme-provider";
+import type { TranslationKey } from "./shell-translation-key";
import { useUser } from "./shell-user-provider";
+const MAP_LOCALE_TO_TRANSLATION_KEY: Record
= {
+ en: "english",
+ de: "german",
+ es: "spanish",
+ "es-MX": "spanish-mx",
+ fr: "french",
+ ja: "japanese",
+ ko: "korean",
+ pt: "portuguese",
+ "pt-BR": "portuguese-br",
+ ro: "romanian",
+ ru: "russian",
+ tr: "turkish",
+ "zh-CN": "chinese-cn",
+ "zh-TW": "chinese-tw",
+};
+
+const LOCALE_OPTIONS = SUPPORTED_LOCALES.map((locale) => ({
+ code: locale,
+ translationKey: MAP_LOCALE_TO_TRANSLATION_KEY[locale],
+}));
+
interface UserProfileProps {
isCollapsed: boolean;
}
export const UserProfile = ({ isCollapsed }: UserProfileProps) => {
- const { t } = useTranslation();
+ const { t, i18n } = useTranslation();
const { user } = useUser();
const { logout } = useAuth();
+ const { theme, setTheme } = useTheme();
+ const [language, setLanguageState] = useState(i18n.language);
+
+ const setLanguage = useCallback((code: string) => {
+ setLanguageState(code);
+ document.dispatchEvent(
+ new CustomEvent("languageChanged", {
+ detail: { selectedLanguageId: code },
+ }),
+ );
+ }, []);
const userInitials = user
? user.name
@@ -56,8 +98,8 @@ export const UserProfile = ({ isCollapsed }: UserProfileProps) => {
mass: 0.5,
}}
>
-
-
+
+
{userInitials}
@@ -79,6 +121,46 @@ export const UserProfile = ({ isCollapsed }: UserProfileProps) => {