From fd8c54e702647b5ffe8804c5ada9ce565a554a78 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Thu, 19 Jan 2023 08:39:57 +0800 Subject: [PATCH] chore: i18n in toast --- public/locales/en/common.json | 12 ++++ public/locales/zh/common.json | 12 ++++ src/common/component/AutoDeleteMessages.tsx | 3 +- src/common/component/GoogleLoginButton.tsx | 3 +- src/common/component/ImagePreviewModal.tsx | 14 +---- src/common/component/Loading.tsx | 56 ++++++------------- src/common/component/ManageMembers/index.tsx | 2 +- src/common/component/ServerVersionChecker.tsx | 19 +++++-- src/common/hook/useConfig.ts | 4 +- src/common/hook/useUserOperation.ts | 4 +- src/routes/callback/GithubCallback.tsx | 4 +- src/routes/login/SocialLoginButtons.tsx | 4 +- src/routes/login/index.tsx | 3 +- src/routes/oauth/index.tsx | 4 +- .../onboarding/steps/UpdateFrontendURL.tsx | 2 +- src/routes/reg/RegWithUsername.tsx | 4 +- src/routes/setting/APIConfig.tsx | 2 +- .../setting/BotConfig/DeleteAPIKeyModal.tsx | 2 +- src/routes/setting/BotConfig/DeleteModal.tsx | 2 +- src/routes/setting/BotConfig/WebhookModal.tsx | 2 +- src/routes/setting/BotConfig/index.tsx | 2 +- .../setting/License/UpdateLicenseModal.tsx | 2 +- src/routes/setting/LogoutConfirmModal.tsx | 2 +- src/routes/setting/MyAccount.tsx | 2 +- src/routes/setting/Overview/FrontendURL.tsx | 2 +- src/routes/setting/Overview/server.tsx | 3 +- src/routes/setting/ProfileBasicEditModal.tsx | 2 +- .../setting/RemoveAccountConfirmModal.tsx | 1 - src/routes/setting/UpdatePasswordModal.tsx | 3 +- src/routes/setting/config/Logins.tsx | 5 +- src/routes/setting/navs.tsx | 2 +- .../settingChannel/DeleteConfirmModal.tsx | 2 +- src/routes/settingChannel/Overview.tsx | 5 +- src/routes/settingDM/DeleteConfirmModal.tsx | 2 +- 34 files changed, 107 insertions(+), 86 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 7d878b63..b49aa591 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -47,6 +47,12 @@ "status": { "uploading": "Uploading" }, + "tip": { + "update": "Update Successfully!", + "delete": "Delete Successfully!", + "login": "Login Successfully!", + "logout": "Logout Successfully!" + }, "new_version": "<0>New Version Available", "mobile_app": "Check out our <0>Mobile APP", "price": { @@ -58,5 +64,11 @@ "title": "VoceChat Supreme", "desc": "User Limit: No Limit" } + }, + "server_update": { + "version_needed": "This function needs server version:<0>{{version}} at least 🚨", + "current_version": "Your current version:<0>{{version}}", + "update_tip": "Please upgrade the Server!", + "howto": "How to Update VoceChat Server" } } diff --git a/public/locales/zh/common.json b/public/locales/zh/common.json index 9de959d5..38524c1d 100644 --- a/public/locales/zh/common.json +++ b/public/locales/zh/common.json @@ -49,6 +49,12 @@ "status": { "uploading": "上传中" }, + "tip": { + "update": "更新成功!", + "delete": "删除成功!", + "login": "登录成功!", + "logout": "退出成功!" + }, "new_version": "有<0>新版本", "mobile_app": "欢迎下载使用<0>手机APP", "price": { @@ -60,5 +66,11 @@ "title": "VoceChat 终极版", "desc": "用户数限制: 无限制" } + }, + "server_update": { + "version_needed": "支持该特性的最低Server版本:<0>{{version}}", + "current_version": "当前的Server版本:<0>{{version}}", + "update_tip": "请升级后端服务!", + "howto": "如何升级后端服务" } } diff --git a/src/common/component/AutoDeleteMessages.tsx b/src/common/component/AutoDeleteMessages.tsx index 3634ecb1..ece4eeed 100644 --- a/src/common/component/AutoDeleteMessages.tsx +++ b/src/common/component/AutoDeleteMessages.tsx @@ -21,6 +21,7 @@ const AutoDeleteMessages = ({ id, type = "channel" }: Props) => { const [updateSetting, { isSuccess }] = useUpdateAutoDeleteMsgMutation(); const [value, setValue] = useState(setting?.expires_in ?? 0); const { t } = useTranslation("setting", { keyPrefix: "auto_delete_msg" }); + const { t: ct } = useTranslation(); const options = [ { title: t("off"), value: 0 }, { title: t("5_min"), value: 5 * 60 }, @@ -41,7 +42,7 @@ const AutoDeleteMessages = ({ id, type = "channel" }: Props) => { }; useEffect(() => { if (isSuccess) { - toast.success("Update Successfully!"); + toast.success(ct("tip.update")); } }, [isSuccess]); const originalVal = setting?.expires_in ?? 0; diff --git a/src/common/component/GoogleLoginButton.tsx b/src/common/component/GoogleLoginButton.tsx index 77279ebe..051f2837 100644 --- a/src/common/component/GoogleLoginButton.tsx +++ b/src/common/component/GoogleLoginButton.tsx @@ -61,12 +61,13 @@ interface Props { const GoogleLoginInner: FC = ({ type = "login", loaded, loadError }) => { const { t } = useTranslation("auth"); + const { t: ct } = useTranslation(); const [login, { isSuccess, isLoading, error }] = useLoginMutation(); //拿本地存的magic token const magic_token = localStorage.getItem(KEY_LOCAL_MAGIC_TOKEN); useEffect(() => { if (isSuccess) { - toast.success("Login Successfully"); + toast.success(ct("tip.login")); // navigateTo("/"); } }, [isSuccess]); diff --git a/src/common/component/ImagePreviewModal.tsx b/src/common/component/ImagePreviewModal.tsx index b035af73..e214b708 100644 --- a/src/common/component/ImagePreviewModal.tsx +++ b/src/common/component/ImagePreviewModal.tsx @@ -49,17 +49,6 @@ const StyledWrapper = styled.div` &.loading .image img { filter: blur(2px); } - - .origin { - font-weight: bold; - font-size: 14px; - color: #aaa; - - &:hover { - text-decoration: underline; - color: #fff; - } - } } `; @@ -117,13 +106,12 @@ const ImagePreviewModal: FC = ({ download = true, data, closeModal }) => preview {download && ( = ({ reload = false, fullscreen = false }) => { + const [reloadVisible, setReloadVisible] = useState(false); const { clearLocalData } = useLogout(); const handleReload = () => { clearLocalData(); location.reload(); }; + useEffect(() => { + let inter = 0; + if (reload) { + inter = window.setTimeout(() => { + setReloadVisible(true); + }, 30 * 1000); + + } + return () => { + clearTimeout(inter); + }; + }, [reload]); return ( - +
- - +
); }; diff --git a/src/common/component/ManageMembers/index.tsx b/src/common/component/ManageMembers/index.tsx index b5cbcba0..fee2d3b0 100644 --- a/src/common/component/ManageMembers/index.tsx +++ b/src/common/component/ManageMembers/index.tsx @@ -33,7 +33,7 @@ const ManageMembers: FC = ({ cid }) => { useEffect(() => { if (updateSuccess) { - toast.success("Update Successfully"); + toast.success(ct("tip.update")); } }, [updateSuccess]); diff --git a/src/common/component/ServerVersionChecker.tsx b/src/common/component/ServerVersionChecker.tsx index 49db2355..e82b0761 100644 --- a/src/common/component/ServerVersionChecker.tsx +++ b/src/common/component/ServerVersionChecker.tsx @@ -1,4 +1,5 @@ import { ReactElement } from 'react'; +import { Trans, useTranslation } from 'react-i18next'; import { useGetServerVersionQuery } from '../../app/services/server'; import { compareVersion } from '../utils'; @@ -9,14 +10,24 @@ type Props = { } const ServerVersionChecker = ({ empty = false, version, children }: Props) => { + const { t } = useTranslation(); const { data: currentVersion, isSuccess } = useGetServerVersionQuery(); if (!isSuccess) return null; const res = compareVersion(currentVersion, version); if (res < 0) return empty ? null :
- This function needs server version:{version} at least 🚨 - Your current version:{currentVersion} - Please upgrade the Server! - How to Update VoceChat Server 📖 + + + {{ version }} + + + + + {{ version: currentVersion }} + + + {t("server_update.update_tip")} + + {t("server_update.howto")} 📖
; return children; }; diff --git a/src/common/hook/useConfig.ts b/src/common/hook/useConfig.ts index aef95172..885badd6 100644 --- a/src/common/hook/useConfig.ts +++ b/src/common/hook/useConfig.ts @@ -12,6 +12,7 @@ import { useLazyGetLoginConfigQuery } from "../../app/services/server"; import { AgoraConfig, FirebaseConfig, LoginConfig, SMTPConfig } from "../../types/server"; +import { useTranslation } from "react-i18next"; // config: smtp agora login firebase type ConfigType = "smtp" | "agora" | "login" | "firebase"; type ConfigMap = Record; @@ -19,6 +20,7 @@ type valuesOf = T[keyof T]; let originalValue: valuesOf | undefined = undefined; // type valueOf = T[config]; export default function useConfig(config: keyof ConfigMap = "smtp") { + const { t: ct } = useTranslation(); const [changed, setChanged] = useState(false); const [values, setValues] = useState | undefined>(undefined); const [updateLoginConfig, { isSuccess: LoginUpdated, isLoading: LoginUpdating }] = useUpdateLoginConfigMutation(); @@ -77,7 +79,7 @@ export default function useConfig(config: keyof ConfigMap = "smtp") { useEffect(() => { if (updated) { - toast.success("Configuration Updated!"); + toast.success(ct("tip.update")); // setChanged(false); refetch(); } diff --git a/src/common/hook/useUserOperation.ts b/src/common/hook/useUserOperation.ts index 4e86b2d5..27e8ddaa 100644 --- a/src/common/hook/useUserOperation.ts +++ b/src/common/hook/useUserOperation.ts @@ -8,12 +8,14 @@ import { useLazyDeleteUserQuery } from "../../app/services/user"; // import useConfig from "./useConfig"; import useCopy from "./useCopy"; import { useAppSelector } from "../../app/store"; +import { useTranslation } from "react-i18next"; // import { AgoraConfig } from "../../types/server"; interface IProps { uid?: number; cid?: number; } const useUserOperation = ({ uid, cid }: IProps) => { + const { t: ct } = useTranslation(); const [passedUid, setPassedUid] = useState(undefined); const isUserDetailPath = useMatch(`/users/${uid}`); const [removeUser, { isSuccess: removeUserSuccess }] = useLazyDeleteUserQuery(); @@ -34,7 +36,7 @@ const useUserOperation = ({ uid, cid }: IProps) => { useEffect(() => { if (removeSuccess || removeUserSuccess) { - toast.success("Remove Successfully"); + toast.success(ct("tip.delete")); if (removeUserSuccess && isUserDetailPath) { navigateTo(`/users`); } diff --git a/src/routes/callback/GithubCallback.tsx b/src/routes/callback/GithubCallback.tsx index ea0cffaa..61175117 100644 --- a/src/routes/callback/GithubCallback.tsx +++ b/src/routes/callback/GithubCallback.tsx @@ -3,12 +3,14 @@ import { KEY_LOCAL_MAGIC_TOKEN } from "../../app/config"; import { useLoginMutation } from "../../app/services/auth"; import toast from "react-hot-toast"; import { FetchBaseQueryError } from "@reduxjs/toolkit/dist/query"; +import { useTranslation } from 'react-i18next'; export type GithubLoginSource = "widget" | "webapp" type Props = { code: string, from?: GithubLoginSource } const GithubCallback: FC = ({ code, from = "webapp" }) => { + const { t: ct } = useTranslation(); //拿本地存的magic token const magic_token = localStorage.getItem(KEY_LOCAL_MAGIC_TOKEN); const [login, { isLoading, isSuccess, error }] = useLoginMutation(); @@ -23,7 +25,7 @@ const GithubCallback: FC = ({ code, from = "webapp" }) => { }, [code]); useEffect(() => { if (isSuccess) { - toast.success("Login Successfully"); + toast.success(ct("tip.login")); // 通知widget if (from == 'widget') { localStorage.setItem("widget", `${new Date().getTime()}`); diff --git a/src/routes/login/SocialLoginButtons.tsx b/src/routes/login/SocialLoginButtons.tsx index 35d48a09..91902c82 100644 --- a/src/routes/login/SocialLoginButtons.tsx +++ b/src/routes/login/SocialLoginButtons.tsx @@ -10,12 +10,14 @@ import OidcLoginButton from "./OidcLoginButton"; import { useLoginMutation } from '../../app/services/auth'; import { LoginConfig } from '../../types/server'; import { AuthType } from '../../types/common'; +import { useTranslation } from 'react-i18next'; type Props = { type?: AuthType } const SocialLoginButtons = ({ type = "login" }: Props) => { + const { t: ct } = useTranslation(); const [login, { isSuccess }] = useLoginMutation(); const { config: githubAuthConfig } = useGithubAuthConfig(); const { data: loginConfig, isSuccess: loginConfigSuccess } = useGetLoginConfigQuery(); @@ -23,7 +25,7 @@ const SocialLoginButtons = ({ type = "login" }: Props) => { useEffect(() => { if (isSuccess) { - toast.success("Login Successfully"); + toast.success(ct("tip.login")); // navigateTo("/"); } }, [isSuccess]); diff --git a/src/routes/login/index.tsx b/src/routes/login/index.tsx index 6ed9a542..384d81cc 100644 --- a/src/routes/login/index.tsx +++ b/src/routes/login/index.tsx @@ -18,6 +18,7 @@ import SocialLoginButtons from "./SocialLoginButtons"; export default function LoginPage() { const { t } = useTranslation("auth"); + const { t: ct } = useTranslation(); const { data: enableSMTP } = useGetSMTPStatusQuery(); const [login, { isSuccess, isLoading, error }] = useLoginMutation(); const { clientId } = useGoogleAuthConfig(); @@ -82,7 +83,7 @@ export default function LoginPage() { }, [error]); useEffect(() => { if (isSuccess) { - toast.success("Login Successfully"); + toast.success(ct("tip.login")); // navigateTo("/"); } }, [isSuccess]); diff --git a/src/routes/oauth/index.tsx b/src/routes/oauth/index.tsx index 0affafbb..25844192 100644 --- a/src/routes/oauth/index.tsx +++ b/src/routes/oauth/index.tsx @@ -6,8 +6,10 @@ import { useNavigate, useParams } from "react-router-dom"; import { useLoginMutation } from "../../app/services/auth"; import toast from "react-hot-toast"; import { setAuthData } from "../../app/slices/auth.data"; +import { useTranslation } from "react-i18next"; export default function OAuthPage() { + const { t: ct } = useTranslation(); const [login, { data, isSuccess, isError }] = useLoginMutation(); const { token } = useParams(); const [loading, setLoading] = useState(true); @@ -36,7 +38,7 @@ export default function OAuthPage() { if (isSuccess && data) { setLoading(false); // 更新本地认证信息 - toast.success("Login Successfully"); + toast.success(ct("tip.login")); dispatch(setAuthData(data)); navigateTo("/"); } diff --git a/src/routes/onboarding/steps/UpdateFrontendURL.tsx b/src/routes/onboarding/steps/UpdateFrontendURL.tsx index 317eb916..1dff1e60 100644 --- a/src/routes/onboarding/steps/UpdateFrontendURL.tsx +++ b/src/routes/onboarding/steps/UpdateFrontendURL.tsx @@ -31,7 +31,7 @@ const UpdateFrontendURL = ({ refreshInviteLink }: Props) => { useEffect(() => { if (isSuccess) { refreshInviteLink(); - toast.success("Update Successfully!"); + toast.success(ct("tip.update")); } }, [isSuccess]); return ( diff --git a/src/routes/reg/RegWithUsername.tsx b/src/routes/reg/RegWithUsername.tsx index 42c70c33..fd9c5460 100644 --- a/src/routes/reg/RegWithUsername.tsx +++ b/src/routes/reg/RegWithUsername.tsx @@ -8,8 +8,10 @@ import Button from "../../common/component/styled/Button"; import { useLoginMutation, useCheckMagicTokenValidMutation } from "../../app/services/auth"; import ExpiredTip from "./ExpiredTip"; import { useRegisterMutation } from "../../app/services/auth"; +import { useTranslation } from "react-i18next"; const RegWithUsername: FC = () => { + const { t: ct } = useTranslation(); const [checkTokenInvalid, { data: isTokenValid, isLoading: checkingToken }] = useCheckMagicTokenValidMutation(); const [ @@ -62,7 +64,7 @@ const RegWithUsername: FC = () => { const data = loginData || regData; if (isSuccess && data) { // 更新本地认证信息 - toast.success("Login Successfully"); + toast.success(ct("tip.login")); dispatch(setAuthData(data)); // tricky location.href = `/#/`; diff --git a/src/routes/setting/APIConfig.tsx b/src/routes/setting/APIConfig.tsx index f9dbfea7..ca097fac 100644 --- a/src/routes/setting/APIConfig.tsx +++ b/src/routes/setting/APIConfig.tsx @@ -72,7 +72,7 @@ export default function APIConfig() { useEffect(() => { if (isSuccess) { hideAll(); - toast.success("Update API Secret Successfully!"); + toast.success(ct("tip.update")); } }, [isSuccess]); const handleToggle = (val: { third_party: boolean }) => { diff --git a/src/routes/setting/BotConfig/DeleteAPIKeyModal.tsx b/src/routes/setting/BotConfig/DeleteAPIKeyModal.tsx index dc6a4507..f145ffac 100644 --- a/src/routes/setting/BotConfig/DeleteAPIKeyModal.tsx +++ b/src/routes/setting/BotConfig/DeleteAPIKeyModal.tsx @@ -21,7 +21,7 @@ const DeleteAPIKeyModal = ({ closeModal, uid, kid }: Props) => { }; useEffect(() => { if (isSuccess) { - toast.success("Delete API Key Successfully!"); + toast.success(ct("tip.delete")); closeModal(); } }, [isSuccess]); diff --git a/src/routes/setting/BotConfig/DeleteModal.tsx b/src/routes/setting/BotConfig/DeleteModal.tsx index 47cebe38..3ed206a7 100644 --- a/src/routes/setting/BotConfig/DeleteModal.tsx +++ b/src/routes/setting/BotConfig/DeleteModal.tsx @@ -21,7 +21,7 @@ const DeleteModal = ({ closeModal, uid, name }: Props) => { }; useEffect(() => { if (isSuccess) { - toast.success("Delete Bot Successfully!"); + toast.success(ct("tip.delete")); closeModal(); } }, [isSuccess]); diff --git a/src/routes/setting/BotConfig/WebhookModal.tsx b/src/routes/setting/BotConfig/WebhookModal.tsx index 999bba8d..b5ae9f1f 100644 --- a/src/routes/setting/BotConfig/WebhookModal.tsx +++ b/src/routes/setting/BotConfig/WebhookModal.tsx @@ -38,7 +38,7 @@ const WebhookModal = ({ uid, webhook, closeModal }: Props) => { }; useEffect(() => { if (isSuccess) { - toast.success("Update Webhook URL Successfully!"); + toast.success(ct("tip.update")); closeModal(); } }, [isSuccess]); diff --git a/src/routes/setting/BotConfig/index.tsx b/src/routes/setting/BotConfig/index.tsx index 1093b30a..a50813c8 100644 --- a/src/routes/setting/BotConfig/index.tsx +++ b/src/routes/setting/BotConfig/index.tsx @@ -53,7 +53,7 @@ export default function BotConfig() { }; useEffect(() => { if (updateAvatarSuccess) { - toast.success("Update Bot Avatar Successfully!"); + toast.success(ct("tip.update")); } }, [updateAvatarSuccess]); diff --git a/src/routes/setting/License/UpdateLicenseModal.tsx b/src/routes/setting/License/UpdateLicenseModal.tsx index 66888614..32579f70 100644 --- a/src/routes/setting/License/UpdateLicenseModal.tsx +++ b/src/routes/setting/License/UpdateLicenseModal.tsx @@ -28,7 +28,7 @@ const UpdateLicenseModal: FC = ({ closeModal, updateLicense, updating, up }; useEffect(() => { if (updated) { - toast.success("Update Successfully!"); + toast.success(ct("tip.update")); closeModal(); } }, [updated]); diff --git a/src/routes/setting/LogoutConfirmModal.tsx b/src/routes/setting/LogoutConfirmModal.tsx index a4dccf8c..19a6850e 100644 --- a/src/routes/setting/LogoutConfirmModal.tsx +++ b/src/routes/setting/LogoutConfirmModal.tsx @@ -50,7 +50,7 @@ const LogoutConfirmModal: FC = ({ closeModal }) => { if (clearLocal) { clearLocalData(); } - toast.success("Logout Successfully"); + toast.success(ct("tip.logout")); } }, [exited, clearLocal]); diff --git a/src/routes/setting/MyAccount.tsx b/src/routes/setting/MyAccount.tsx index 33260640..26b0545e 100644 --- a/src/routes/setting/MyAccount.tsx +++ b/src/routes/setting/MyAccount.tsx @@ -127,7 +127,7 @@ export default function MyAccount() { useEffect(() => { if (uploadSuccess) { - toast.success("update avatar successfully!"); + toast.success(ct("tip.update")); } }, [uploadSuccess]); diff --git a/src/routes/setting/Overview/FrontendURL.tsx b/src/routes/setting/Overview/FrontendURL.tsx index f2e1b046..1d4f781f 100644 --- a/src/routes/setting/Overview/FrontendURL.tsx +++ b/src/routes/setting/Overview/FrontendURL.tsx @@ -22,7 +22,7 @@ const Index = () => { const [updateUrl, { isLoading, isSuccess }] = useUpdateFrontendUrlMutation(); useEffect(() => { if (isSuccess) { - toast.success("Update Successfully!"); + toast.success(ct("tip.update")); } }, [isSuccess]); useEffect(() => { diff --git a/src/routes/setting/Overview/server.tsx b/src/routes/setting/Overview/server.tsx index ec327692..e243a472 100644 --- a/src/routes/setting/Overview/server.tsx +++ b/src/routes/setting/Overview/server.tsx @@ -12,6 +12,7 @@ import { useAppSelector } from '../../../app/store'; const Index = () => { const { t } = useTranslation("setting"); + const { t: ct } = useTranslation(); const { loginUser, server } = useAppSelector((store) => { return { loginUser: store.authData.user, server: store.server }; }); @@ -42,7 +43,7 @@ const Index = () => { }, [server]); useEffect(() => { if (uploadSuccess) { - toast.success("Update logo successfully!"); + toast.success(ct("tip.update")); } }, [uploadSuccess]); useEffect(() => { diff --git a/src/routes/setting/ProfileBasicEditModal.tsx b/src/routes/setting/ProfileBasicEditModal.tsx index 783a7b8a..183d11ae 100644 --- a/src/routes/setting/ProfileBasicEditModal.tsx +++ b/src/routes/setting/ProfileBasicEditModal.tsx @@ -47,7 +47,7 @@ const ProfileBasicEditModal: FC = ({ useEffect(() => { if (isSuccess) { // todo - toast.success("update user info successfully"); + toast.success(t("tip.update")); closeModal(); } }, [isSuccess]); diff --git a/src/routes/setting/RemoveAccountConfirmModal.tsx b/src/routes/setting/RemoveAccountConfirmModal.tsx index 1e5e26c5..6fb55848 100644 --- a/src/routes/setting/RemoveAccountConfirmModal.tsx +++ b/src/routes/setting/RemoveAccountConfirmModal.tsx @@ -16,7 +16,6 @@ const RemoveConfirmModal: FC = ({ closeModal }) => { const handleRemove = async () => { try { await removeCurrentAccount(); - // toast.success("Remove Account Successfully!"); } catch (error) { toast.error("Remove Account Failed!"); } diff --git a/src/routes/setting/UpdatePasswordModal.tsx b/src/routes/setting/UpdatePasswordModal.tsx index 89a4d10e..463ec212 100644 --- a/src/routes/setting/UpdatePasswordModal.tsx +++ b/src/routes/setting/UpdatePasswordModal.tsx @@ -36,6 +36,7 @@ interface BaseForm { const ProfileBasicEditModal: FC = ({ closeModal }) => { const { t } = useTranslation("member"); + const { t: ct } = useTranslation(); const { data } = useGetCredentialsQuery(); const [input, setInput] = useState({ current: "", @@ -63,7 +64,7 @@ const ProfileBasicEditModal: FC = ({ closeModal }) => { useEffect(() => { if (isSuccess) { // todo - toast.success("update password successfully"); + toast.success(ct("tip.update")); closeModal(); } }, [isSuccess]); diff --git a/src/routes/setting/config/Logins.tsx b/src/routes/setting/config/Logins.tsx index 47c12101..72a9b1c3 100644 --- a/src/routes/setting/config/Logins.tsx +++ b/src/routes/setting/config/Logins.tsx @@ -15,6 +15,7 @@ import { useTranslation } from "react-i18next"; export default function Logins() { const { t } = useTranslation("setting", { keyPrefix: "login" }); + const { t: ct } = useTranslation(); const { changed: clientIdChanged, clientId, @@ -37,14 +38,14 @@ export default function Logins() { // 更新google client id await updateClientIdToServer(); if (!changed) { - toast.success("Configuration Updated!"); + toast.success(ct("tip.update")); } } if (github && githubChanged) { // github config await updateGithubAuthConfigToServer(); if (!changed) { - toast.success("Configuration Updated!"); + toast.success(ct("tip.update")); } } }; diff --git a/src/routes/setting/navs.tsx b/src/routes/setting/navs.tsx index 747d6f85..456f2ff6 100644 --- a/src/routes/setting/navs.tsx +++ b/src/routes/setting/navs.tsx @@ -39,7 +39,7 @@ const navs = [ items: [ { name: "bot", - component: , + component: , admin: true }, { diff --git a/src/routes/settingChannel/DeleteConfirmModal.tsx b/src/routes/settingChannel/DeleteConfirmModal.tsx index c632c023..c1f82844 100644 --- a/src/routes/settingChannel/DeleteConfirmModal.tsx +++ b/src/routes/settingChannel/DeleteConfirmModal.tsx @@ -23,7 +23,7 @@ const DeleteConfirmModal: FC = ({ id, closeModal }) => { useEffect(() => { if (isSuccess) { - toast.success("delete channel successfully!"); + toast.success(ct("tip.delete")); closeModal(); navigateTo("/chat"); } diff --git a/src/routes/settingChannel/Overview.tsx b/src/routes/settingChannel/Overview.tsx index 405ccfca..c5e70234 100644 --- a/src/routes/settingChannel/Overview.tsx +++ b/src/routes/settingChannel/Overview.tsx @@ -50,6 +50,7 @@ const StyledWrapper = styled.div` `; export default function Overview({ id = 0 }) { const { t } = useTranslation("setting", { keyPrefix: "channel" }); + const { t: ct } = useTranslation(); const { loginUser, channel } = useAppSelector((store) => { return { loginUser: store.authData.user, @@ -105,13 +106,13 @@ export default function Overview({ id = 0 }) { useEffect(() => { if (updated) { - toast.success("Channel updated!"); + toast.success(ct("tip.update")); refetch(); } }, [updated]); useEffect(() => { if (changeTypeSuccess) { - toast.success("Change channel visibility successfully!"); + toast.success(ct("tip.update")); } }, [changeTypeSuccess]); diff --git a/src/routes/settingDM/DeleteConfirmModal.tsx b/src/routes/settingDM/DeleteConfirmModal.tsx index f859dfca..94049401 100644 --- a/src/routes/settingDM/DeleteConfirmModal.tsx +++ b/src/routes/settingDM/DeleteConfirmModal.tsx @@ -23,7 +23,7 @@ const DeleteConfirmModal: FC = ({ id, closeModal }) => { useEffect(() => { if (isSuccess) { - toast.success("delete user successfully!"); + toast.success(ct("tip.delete")); closeModal(); navigateTo("/chat"); }