|
@@ -20,7 +20,7 @@ import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
|
import {StyledThemeTabs} from "@layout/Sidebar/styles";
|
|
import {StyledThemeTabs} from "@layout/Sidebar/styles";
|
|
|
import {useThemeProvider} from "@contexts/themeContext";
|
|
import {useThemeProvider} from "@contexts/themeContext";
|
|
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
import ToggleButton from "@mui/material/ToggleButton";
|
|
|
-import {reqLogout} from "@features/api";
|
|
|
|
|
|
|
+import {reqChangeInfo, reqLogout} from "@features/api";
|
|
|
import {REQ_STATUS} from "@api/config";
|
|
import {REQ_STATUS} from "@api/config";
|
|
|
import SmallLoading from "@components/SmallLoading";
|
|
import SmallLoading from "@components/SmallLoading";
|
|
|
import {APP_GENDER, APP_THEME} from "@constants/app";
|
|
import {APP_GENDER, APP_THEME} from "@constants/app";
|
|
@@ -31,7 +31,7 @@ const UserSettings=()=>{
|
|
|
const logoutStatus=useSelector(getLogoutStatus);
|
|
const logoutStatus=useSelector(getLogoutStatus);
|
|
|
const dispatch = useDispatch();
|
|
const dispatch = useDispatch();
|
|
|
const navigate=useNavigate();
|
|
const navigate=useNavigate();
|
|
|
- const {theme, toggleTheme} = useThemeProvider();
|
|
|
|
|
|
|
+ const {theme, toggleTheme,setIsShowLang} = useThemeProvider();
|
|
|
const renderEmpty=()=>{
|
|
const renderEmpty=()=>{
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.wrap_item}>
|
|
<div className={styles.wrap_item}>
|
|
@@ -184,7 +184,9 @@ const UserSettings=()=>{
|
|
|
}
|
|
}
|
|
|
const renderItemLang=()=>{
|
|
const renderItemLang=()=>{
|
|
|
return (
|
|
return (
|
|
|
- <button className={styles.action_item}>
|
|
|
|
|
|
|
+ <button className={styles.action_item} onClick={()=>{
|
|
|
|
|
+ setIsShowLang(true);
|
|
|
|
|
+ }}>
|
|
|
<div className={styles.action_left}>
|
|
<div className={styles.action_left}>
|
|
|
<SvgIcon className={styles.icon} herf={"icon_Language"}></SvgIcon>
|
|
<SvgIcon className={styles.icon} herf={"icon_Language"}></SvgIcon>
|
|
|
<div>{i18n.t("settings.language")}</div>
|
|
<div>{i18n.t("settings.language")}</div>
|
|
@@ -196,8 +198,14 @@ const UserSettings=()=>{
|
|
|
</button>
|
|
</button>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
- const handleTheme=()=>{
|
|
|
|
|
|
|
+ const handleTheme=(theme)=>{
|
|
|
toggleTheme();
|
|
toggleTheme();
|
|
|
|
|
+ // "DefaultLanguage": "en",
|
|
|
|
|
+ // "ThemeColor": "dark"
|
|
|
|
|
+ if (!isLogin)return;
|
|
|
|
|
+ dispatch(reqChangeInfo({
|
|
|
|
|
+ ThemeColor:theme
|
|
|
|
|
+ }));
|
|
|
}
|
|
}
|
|
|
const renderItemTheme=()=>{
|
|
const renderItemTheme=()=>{
|
|
|
return (
|
|
return (
|
|
@@ -215,8 +223,8 @@ const UserSettings=()=>{
|
|
|
height:"100%",
|
|
height:"100%",
|
|
|
alignItems:"center",
|
|
alignItems:"center",
|
|
|
justifyContent:"space-between"
|
|
justifyContent:"space-between"
|
|
|
- }} exclusive value={theme} onChange={()=>{
|
|
|
|
|
- handleTheme();
|
|
|
|
|
|
|
+ }} exclusive value={theme} onChange={(event, value)=>{
|
|
|
|
|
+ handleTheme(value);
|
|
|
}}>
|
|
}}>
|
|
|
<div className={styles.theme_bg} style={{left: `${theme === APP_THEME.DARK ? '0%' : '50%'}`}}/>
|
|
<div className={styles.theme_bg} style={{left: `${theme === APP_THEME.DARK ? '0%' : '50%'}`}}/>
|
|
|
<ToggleButton sx={{
|
|
<ToggleButton sx={{
|