import { Option, Select } from "@mui/joy"; import { useTranslation } from "react-i18next"; import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service"; import useUserStore from "../../stores/v1/user"; import BetaBadge from "../BetaBadge"; const PreferenceSection: React.FC = () => { const { t } = useTranslation(); const userStore = useUserStore(); const userSetting = userStore.getCurrentUserSetting(); const language = userSetting.locale; const colorTheme = userSetting.colorTheme; const languageOptions = [ { value: UserSetting_Locale.LOCALE_EN, label: "English", }, { value: UserSetting_Locale.LOCALE_ZH, label: "中文", }, ]; const colorThemeOptions = [ { value: UserSetting_ColorTheme.COLOR_THEME_SYSTEM, label: "System", }, { value: UserSetting_ColorTheme.COLOR_THEME_LIGHT, label: "Light", }, { value: UserSetting_ColorTheme.COLOR_THEME_DARK, label: "Dark", }, ]; const handleSelectLanguage = async (locale: UserSetting_Locale) => { await userStore.updateUserSetting( { ...userSetting, locale: locale, } as UserSetting, ["locale"] ); }; const handleSelectColorTheme = async (colorTheme: UserSetting_ColorTheme) => { await userStore.updateUserSetting( { ...userSetting, colorTheme: colorTheme, } as UserSetting, ["color_theme"] ); }; return ( <>
{t("settings.preference.self")}