import type { CSSProperties } from "react"; import { BookOpen, Keyboard, Puzzle, Settings2 } from "lucide-react"; import { useTranslation } from "react-i18next"; import { AnimatedThemeToggler } from "@/components/ui/animated-theme-toggler"; import { GitHubLink } from "@/components/layout/github-link"; import { VersionReleaseModal } from "@/components/layout/version-release-modal"; import { DOCS_URL } from "@/constant/env"; import { changeAppLocale, type AppLocale } from "@/i18n"; import { cn } from "@/lib/utils"; import { canvasThemes } from "@/lib/canvas-theme"; import { useConfigStore } from "@/stores/use-config-store"; import { useThemeStore } from "@/stores/use-theme-store"; type UserStatusActionsProps = { showConfig?: boolean; variant?: "default" | "canvas"; onOpenShortcuts?: () => void; onOpenPlugins?: () => void; }; export function UserStatusActions({ showConfig = true, variant = "default", onOpenShortcuts, onOpenPlugins }: UserStatusActionsProps) { const { i18n, t } = useTranslation(); const theme = useThemeStore((state) => state.theme); const setTheme = useThemeStore((state) => state.setTheme); const openConfigDialog = useConfigStore((state) => state.openConfigDialog); const canvasTheme = canvasThemes[theme]; const naturalIconClass = "inline-flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-stone-600 transition-colors hover:bg-black/5 hover:text-stone-950 dark:text-stone-300 dark:hover:bg-white/10 dark:hover:text-white [&_svg]:size-4"; const iconStyle: CSSProperties | undefined = variant === "canvas" ? { color: canvasTheme.node.text } : undefined; const versionStyle = iconStyle; const gitHubClassName = "size-7 text-base"; const gitHubStyle = iconStyle; const locale = i18n.resolvedLanguage as AppLocale; const nextLocale = locale === "zh-CN" ? "en-US" : "zh-CN"; const languageLabel = t("topNav.switchLanguage", { language: t(nextLocale === "zh-CN" ? "locale.zhCN" : "locale.enUS") }); return (
); }