From 1e69d534ec880bfdd7df8a950a7cb16a1a20fdf8 Mon Sep 17 00:00:00 2001 From: Tristan Yang Date: Tue, 7 Mar 2023 17:31:48 +0800 Subject: [PATCH] chore: server name in login and reg page --- public/locales/en/auth.json | 4 ++-- public/locales/zh/auth.json | 4 ++-- src/routes/login/index.tsx | 4 +++- src/routes/reg/Register.tsx | 4 +++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/public/locales/en/auth.json b/public/locales/en/auth.json index a0e13ed6..7acb6a76 100644 --- a/public/locales/en/auth.json +++ b/public/locales/en/auth.json @@ -1,6 +1,6 @@ { "login": { - "title": "Login to VoceChat", + "title": "Login to {{name}}", "desc": "Please enter your details.", "google": "Sign in with Google", "github": "Sign in with GitHub", @@ -10,7 +10,7 @@ "no_account": "Don't have an account?" }, "reg": { - "title": "Sign Up to VoceChat", + "title": "Sign Up to {{name}}", "desc": "Please enter your details.", "google": "Sign Up with Google", "github": "Sign Up with GitHub", diff --git a/public/locales/zh/auth.json b/public/locales/zh/auth.json index 03aed26c..385de3e5 100644 --- a/public/locales/zh/auth.json +++ b/public/locales/zh/auth.json @@ -1,6 +1,6 @@ { "login": { - "title": "登录VoceChat", + "title": "登录{{name}}", "desc": "请输入用户名密码", "google": "谷歌登录", "github": "Github登录", @@ -10,7 +10,7 @@ "no_account": "没有账号?" }, "reg": { - "title": "注册VoceChat", + "title": "注册{{name}}", "desc": "请输入邮箱和密码", "google": "谷歌注册", "github": "Github注册", diff --git a/src/routes/login/index.tsx b/src/routes/login/index.tsx index 6db43962..a6d5917a 100644 --- a/src/routes/login/index.tsx +++ b/src/routes/login/index.tsx @@ -15,8 +15,10 @@ import { FetchBaseQueryError } from "@reduxjs/toolkit/dist/query"; import { useTranslation } from "react-i18next"; import SocialLoginButtons from "./SocialLoginButtons"; import Divider from "../../common/component/Divider"; +import { useAppSelector } from "../../app/store"; export default function LoginPage() { + const serverName = useAppSelector(store => store.server.name); const { t } = useTranslation("auth"); const { t: ct } = useTranslation(); const { data: enableSMTP, isLoading: loadingSMTPStatus } = useGetSMTPStatusQuery(); @@ -128,7 +130,7 @@ export default function LoginPage() {
logo -

{t("login.title")}

+

{t("login.title", { name: serverName })}

{t("login.desc")}
diff --git a/src/routes/reg/Register.tsx b/src/routes/reg/Register.tsx index f6c05204..1fe25c8e 100644 --- a/src/routes/reg/Register.tsx +++ b/src/routes/reg/Register.tsx @@ -13,6 +13,7 @@ import { useGetLoginConfigQuery } from "../../app/services/server"; import SocialLoginButtons from "../login/SocialLoginButtons"; import { setAuthData } from "../../app/slices/auth.data"; import { useDispatch } from "react-redux"; +import { useAppSelector } from "../../app/store"; interface AuthForm { name?: string, @@ -22,6 +23,7 @@ interface AuthForm { } export default function Register() { + const serverName = useAppSelector(store => store.server.name); const { t } = useTranslation("auth"); const { t: ct } = useTranslation(); const [sendRegMagicLink, { isLoading: signingUp, data, isSuccess }] = @@ -125,7 +127,7 @@ export default function Register() { <>
logo -

{t("reg.title")}

+

{t("reg.title", { name: serverName })}

{t("reg.desc")}