|
@@ -9,9 +9,11 @@ import LazyImage from "@components/LazyImage";
|
|
|
import USD from "@assets/lvicon/USD.black.png";
|
|
import USD from "@assets/lvicon/USD.black.png";
|
|
|
import {numFormatter} from "@utils/helpers";
|
|
import {numFormatter} from "@utils/helpers";
|
|
|
import SvgIcon from "@components/SvgIcon";
|
|
import SvgIcon from "@components/SvgIcon";
|
|
|
-import {ReactComponent as Male} from '@assets/gener/male.svg';
|
|
|
|
|
-import {ReactComponent as FeMale} from '@assets/gener/female.svg';
|
|
|
|
|
-import {ReactComponent as GenderIcon} from '@assets/gener/gender.svg';
|
|
|
|
|
|
|
+import {ReactComponent as Male} from '@assets/singlesvg/gener/male.svg';
|
|
|
|
|
+import {ReactComponent as FeMale} from '@assets/singlesvg/gener/female.svg';
|
|
|
|
|
+import {ReactComponent as GenderIcon} from '@assets/singlesvg/gener/gender.svg';
|
|
|
|
|
+import {ReactComponent as MobileIcon} from '@assets/singlesvg/mobile.svg';
|
|
|
|
|
+import {ReactComponent as EmailIcon} from '@assets/singlesvg/email.svg';
|
|
|
import {CopyToClipboard} from 'react-copy-to-clipboard';
|
|
import {CopyToClipboard} from 'react-copy-to-clipboard';
|
|
|
import {toast} from "react-toastify";
|
|
import {toast} from "react-toastify";
|
|
|
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
import ToggleButtonGroup from "@mui/material/ToggleButtonGroup";
|
|
@@ -21,6 +23,7 @@ import ToggleButton from "@mui/material/ToggleButton";
|
|
|
import {reqLogout} from "@features/api";
|
|
import {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";
|
|
|
const i18n=global.i18n;
|
|
const i18n=global.i18n;
|
|
|
const UserSettings=()=>{
|
|
const UserSettings=()=>{
|
|
|
const isLogin=useSelector(isLogined);
|
|
const isLogin=useSelector(isLogined);
|
|
@@ -33,7 +36,7 @@ const UserSettings=()=>{
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.wrap_item}>
|
|
<div className={styles.wrap_item}>
|
|
|
<div className={styles.user_info}>
|
|
<div className={styles.user_info}>
|
|
|
- <EmptyAvatar className={styles.avatar_empty}></EmptyAvatar>
|
|
|
|
|
|
|
+ <EmptyAvatar className={styles.avatar_empty}/>
|
|
|
<div className={styles.empty_info}>
|
|
<div className={styles.empty_info}>
|
|
|
<span className={styles.welcome}>
|
|
<span className={styles.welcome}>
|
|
|
{i18n.t("settings.user_info.welcome")}
|
|
{i18n.t("settings.user_info.welcome")}
|
|
@@ -58,35 +61,94 @@ const UserSettings=()=>{
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+ const getPhone=()=>{
|
|
|
|
|
+ let loc=user.RegisterLocation;
|
|
|
|
|
+ let phone=user.Phone;
|
|
|
|
|
+ if (phone.startsWith(loc)){
|
|
|
|
|
+ phone=phone.replace(loc,"");
|
|
|
|
|
+ }
|
|
|
|
|
+ return phone;
|
|
|
|
|
+ }
|
|
|
|
|
+ const getEmail=()=>{
|
|
|
|
|
+ let email=user.Email;
|
|
|
|
|
+ if (email==null||email==""){
|
|
|
|
|
+ return "--";
|
|
|
|
|
+ }
|
|
|
|
|
+ return email;
|
|
|
|
|
+ }
|
|
|
|
|
+ const renderPhone=()=>{
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className={styles.action_item}>
|
|
|
|
|
+ <div className={styles.action_left}>
|
|
|
|
|
+ <MobileIcon className={styles.icon}></MobileIcon>
|
|
|
|
|
+ <div>{i18n.t("settings.phone")}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className={styles.action_right}>
|
|
|
|
|
+ <div>{"+"+user.RegisterLocation}</div>
|
|
|
|
|
+ <div>{getPhone()}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ const renderEmail=()=>{
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className={styles.action_item}>
|
|
|
|
|
+ <div className={styles.action_left}>
|
|
|
|
|
+ <EmailIcon className={styles.icon}></EmailIcon>
|
|
|
|
|
+ <div>{i18n.t("settings.email")}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className={styles.action_right}>
|
|
|
|
|
+ <div>{getEmail()}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
const renderUser=()=>{
|
|
const renderUser=()=>{
|
|
|
|
|
+ let gender=(<></>);
|
|
|
|
|
+ if (user.Gender===APP_GENDER.FEMALE){
|
|
|
|
|
+ gender=(<FeMale className={styles.female}/>);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if (user.Gender===APP_GENDER.MALE){
|
|
|
|
|
+ gender=(<Male className={styles.male}/>);
|
|
|
|
|
+ }
|
|
|
return (
|
|
return (
|
|
|
<div className={styles.wrap_item}>
|
|
<div className={styles.wrap_item}>
|
|
|
- <div className={styles.user_info}>
|
|
|
|
|
- <LazyImage wrapperClassName={styles.avatar} src={user.img} alt={"avatar"}></LazyImage>
|
|
|
|
|
- <div className={`${styles.user_info} ${styles.info}`}>
|
|
|
|
|
- <div className={styles.info_item}>
|
|
|
|
|
- <div className={styles.name}>{user.NickName}</div>
|
|
|
|
|
- {
|
|
|
|
|
- user.Gender===1?(<FeMale className={styles.female}></FeMale>):(<Male className={styles.male}></Male>)
|
|
|
|
|
- }
|
|
|
|
|
- </div>
|
|
|
|
|
- <CopyToClipboard text={user.UserID} onCopy={()=>{
|
|
|
|
|
- toast.success(i18n.t("copy_success"));
|
|
|
|
|
- }}>
|
|
|
|
|
|
|
+ <div className={styles.user_con}>
|
|
|
|
|
+ <div className={styles.user_info}>
|
|
|
|
|
+ <LazyImage wrapperClassName={styles.avatar} src={user.img} alt={"avatar"}></LazyImage>
|
|
|
|
|
+ <div className={`${styles.user_info} ${styles.info}`}>
|
|
|
|
|
+ <div className={styles.info_item}>
|
|
|
|
|
+ <div className={styles.name}>{user.NickName}</div>
|
|
|
|
|
+ {gender}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <CopyToClipboard text={user.UserID} onCopy={()=>{
|
|
|
|
|
+ toast.success(i18n.t("copy_success"));
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <div className={styles.info_item}>
|
|
|
|
|
+ <div className={styles.text}>{i18n.t("settings.user_info.id")}</div>
|
|
|
|
|
+ <div className={styles.text}>{user.UserID}</div>
|
|
|
|
|
+ <button>
|
|
|
|
|
+ <SvgIcon className={styles.icon_copy} herf={"icon_Copy"}></SvgIcon>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </CopyToClipboard>
|
|
|
<div className={styles.info_item}>
|
|
<div className={styles.info_item}>
|
|
|
- <div className={styles.text}>{i18n.t("settings.user_info.id")}</div>
|
|
|
|
|
- <div className={styles.text}>{user.UserID}</div>
|
|
|
|
|
- <button>
|
|
|
|
|
- <SvgIcon className={styles.icon_copy} herf={"icon_Copy"}></SvgIcon>
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ <img className={styles.icon_golds} src={USD}/>
|
|
|
|
|
+ <div className={styles.golds}>{"$"+numFormatter(user.Score)}</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </CopyToClipboard>
|
|
|
|
|
- <div className={styles.info_item}>
|
|
|
|
|
- <img className={styles.icon_golds} src={USD}/>
|
|
|
|
|
- <div className={styles.golds}>{"$"+numFormatter(user.Score)}</div>
|
|
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div className={styles.user_edit_con}>
|
|
|
|
|
+ <button className={styles.edit_btn} onClick={()=>{
|
|
|
|
|
+ navigate(ROUTE_PATH.EDIT_PROFILE);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <SvgIcon className={styles.icon} herf={"icon_Edit"}></SvgIcon>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ {/*<div className={styles.card_line}></div>*/}
|
|
|
|
|
+ {/*{renderPhone()}*/}
|
|
|
|
|
+ {/*{renderEmail()}*/}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
@@ -99,9 +161,30 @@ const UserSettings=()=>{
|
|
|
</>
|
|
</>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+ const renderItemSecurity=()=>{
|
|
|
|
|
+ return (
|
|
|
|
|
+ <>
|
|
|
|
|
+ {
|
|
|
|
|
+ isLogin?(
|
|
|
|
|
+ <button className={styles.action_item} onClick={()=>{
|
|
|
|
|
+ navigate(ROUTE_PATH.EDIT_PWD);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <div className={styles.action_left}>
|
|
|
|
|
+ <SvgIcon className={styles.icon} herf={"icon_Locked"}></SvgIcon>
|
|
|
|
|
+ <div>{i18n.t("settings.security")}</div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className={styles.action_right}>
|
|
|
|
|
+ <SvgIcon className={styles.icon} herf={"icon_Arrow"}></SvgIcon>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </button>
|
|
|
|
|
+ ):(<></>)
|
|
|
|
|
+ }
|
|
|
|
|
+ </>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
const renderItemLang=()=>{
|
|
const renderItemLang=()=>{
|
|
|
return (
|
|
return (
|
|
|
- <div className={styles.action_item}>
|
|
|
|
|
|
|
+ <button className={styles.action_item}>
|
|
|
<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>
|
|
@@ -110,12 +193,15 @@ const UserSettings=()=>{
|
|
|
<div>{i18n.getCurrLangName()}</div>
|
|
<div>{i18n.getCurrLangName()}</div>
|
|
|
<SvgIcon className={styles.icon} herf={"icon_Arrow"}></SvgIcon>
|
|
<SvgIcon className={styles.icon} herf={"icon_Arrow"}></SvgIcon>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </button>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
+ const handleTheme=()=>{
|
|
|
|
|
+ toggleTheme();
|
|
|
|
|
+ }
|
|
|
const renderItemTheme=()=>{
|
|
const renderItemTheme=()=>{
|
|
|
return (
|
|
return (
|
|
|
- <div className={styles.action_item}>
|
|
|
|
|
|
|
+ <button className={styles.action_item}>
|
|
|
<div className={styles.action_left}>
|
|
<div className={styles.action_left}>
|
|
|
<SvgIcon className={styles.icon} herf={"icon_Exchange"}></SvgIcon>
|
|
<SvgIcon className={styles.icon} herf={"icon_Exchange"}></SvgIcon>
|
|
|
<div>{i18n.t("settings.theme")}</div>
|
|
<div>{i18n.t("settings.theme")}</div>
|
|
@@ -130,9 +216,9 @@ const UserSettings=()=>{
|
|
|
alignItems:"center",
|
|
alignItems:"center",
|
|
|
justifyContent:"space-between"
|
|
justifyContent:"space-between"
|
|
|
}} exclusive value={theme} onChange={()=>{
|
|
}} exclusive value={theme} onChange={()=>{
|
|
|
- toggleTheme();
|
|
|
|
|
|
|
+ handleTheme();
|
|
|
}}>
|
|
}}>
|
|
|
- <div className={styles.theme_bg} style={{left: `${theme == "dark" ? '0%' : '50%'}`}}/>
|
|
|
|
|
|
|
+ <div className={styles.theme_bg} style={{left: `${theme === APP_THEME.DARK ? '0%' : '50%'}`}}/>
|
|
|
<ToggleButton sx={{
|
|
<ToggleButton sx={{
|
|
|
display:"flex",
|
|
display:"flex",
|
|
|
position: "relative",
|
|
position: "relative",
|
|
@@ -145,8 +231,8 @@ const UserSettings=()=>{
|
|
|
".Mui-selected:hover":{
|
|
".Mui-selected:hover":{
|
|
|
backgroundColor: 'transparent !important;',
|
|
backgroundColor: 'transparent !important;',
|
|
|
}
|
|
}
|
|
|
- }} value={"dark"}>
|
|
|
|
|
- <SvgIcon className={`${styles.theme_icon} ${theme=="dark"?styles.active:''}`} herf={"icon_Dark"}/>
|
|
|
|
|
|
|
+ }} value={APP_THEME.DARK}>
|
|
|
|
|
+ <SvgIcon className={`${styles.theme_icon} ${theme===APP_THEME.DARK?styles.active:''}`} herf={"icon_Dark"}/>
|
|
|
</ToggleButton>
|
|
</ToggleButton>
|
|
|
<ToggleButton sx={{
|
|
<ToggleButton sx={{
|
|
|
display:"flex",
|
|
display:"flex",
|
|
@@ -161,12 +247,12 @@ const UserSettings=()=>{
|
|
|
backgroundColor: 'transparent !important;',
|
|
backgroundColor: 'transparent !important;',
|
|
|
}
|
|
}
|
|
|
}} value={"light"}>
|
|
}} value={"light"}>
|
|
|
- <SvgIcon className={`${styles.theme_icon} ${theme=="light"?styles.active:''}`} herf={"icon_Light"}/>
|
|
|
|
|
|
|
+ <SvgIcon className={`${styles.theme_icon} ${theme===APP_THEME.LIGHT?styles.active:''}`} herf={"icon_Light"}/>
|
|
|
</ToggleButton>
|
|
</ToggleButton>
|
|
|
</ToggleButtonGroup>
|
|
</ToggleButtonGroup>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
|
+ </button>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
const renderItemGender=()=>{
|
|
const renderItemGender=()=>{
|
|
@@ -178,7 +264,7 @@ const UserSettings=()=>{
|
|
|
</div>
|
|
</div>
|
|
|
<div className={styles.action_right}>
|
|
<div className={styles.action_right}>
|
|
|
{
|
|
{
|
|
|
- user.Gender===1?(<FeMale className={styles.gender}></FeMale>):(<Male className={styles.gender}></Male>)
|
|
|
|
|
|
|
+ user.Gender===APP_GENDER.FEMALE?(<FeMale className={styles.gender}></FeMale>):(<Male className={styles.gender}></Male>)
|
|
|
}
|
|
}
|
|
|
<SvgIcon className={styles.icon} herf={"icon_Arrow"}></SvgIcon>
|
|
<SvgIcon className={styles.icon} herf={"icon_Arrow"}></SvgIcon>
|
|
|
</div>
|
|
</div>
|
|
@@ -188,8 +274,9 @@ const UserSettings=()=>{
|
|
|
const renderSetting=()=>{
|
|
const renderSetting=()=>{
|
|
|
return (
|
|
return (
|
|
|
<div className={`${styles.wrap_item} ${styles.action_wrap}`}>
|
|
<div className={`${styles.wrap_item} ${styles.action_wrap}`}>
|
|
|
|
|
+ {renderItemSecurity()}
|
|
|
{renderItemLang()}
|
|
{renderItemLang()}
|
|
|
- {renderItemGender()}
|
|
|
|
|
|
|
+ {/*{renderItemGender()}*/}
|
|
|
{renderItemTheme()}
|
|
{renderItemTheme()}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|