diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index f1c6d714..89d480af 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -608,7 +608,6 @@ ui: msg: empty: Cannot be empty. login: - page_title: Welcome to {{site_name}} login_to_continue: Log in to continue info_sign: Don't have an account? <1>Sign up info_login: Already have an account? <1>Log in @@ -639,7 +638,6 @@ ui: msg: empty: Email cannot be empty. change_email: - page_title: Welcome to Answer btn_cancel: Cancel btn_update: Update email address send_success: >- @@ -650,7 +648,6 @@ ui: msg: empty: Email cannot be empty. oauth_bind_email: - page_title: Welcome to Answer subtitle: Add a recovery email to your account. btn_update: Update email address email: @@ -858,7 +855,6 @@ ui: modal_confirm: title: Error... account_result: - page_title: Welcome to Answer success: Your new account is confirmed; you will be redirected to the home page. link: Continue to homepage invalid: >- @@ -1046,12 +1042,13 @@ ui: login: Login plugins: Plugins installed_plugins: Installed Plugins + website_welcome: Welcome to {{site_name}} admin: admin_header: title: Admin dashboard: title: Dashboard - welcome: Welcome to Answer Admin! + welcome: Welcome to {{site_name}} Admin! site_statistics: Site Statistics questions: "Questions:" answers: "Answers:" @@ -1383,7 +1380,7 @@ ui: activate: Activate settings: Settings - + form: empty: cannot be empty invalid: is invalid diff --git a/i18n/zh_CN.yaml b/i18n/zh_CN.yaml index 126ebefb..08024eac 100644 --- a/i18n/zh_CN.yaml +++ b/i18n/zh_CN.yaml @@ -585,7 +585,6 @@ ui: msg: empty: 不能为空 login: - page_title: 欢迎来到 Answer info_sign: 没有账户?<1>注册 info_login: 已经有一个账户?<1>登录 agreements: 登录即表示您同意<1>隐私政策和<3>服务条款。 @@ -614,7 +613,6 @@ ui: msg: empty: 邮箱不能为空 change_email: - page_title: 欢迎来到 Answer btn_cancel: 取消 btn_update: 更新电子邮件地址 send_success: >- @@ -803,7 +801,6 @@ ui: modal_confirm: title: 发生错误... account_result: - page_title: 欢迎来到 Answer success: 你的账号已通过验证,即将返回首页。 link: 返回首页 invalid: >- @@ -976,12 +973,13 @@ ui: themes: Themes css-html: CSS/HTML login: Login + website_welcome: 欢迎来到 {{site_name}} admin: admin_header: title: 后台管理 dashboard: title: 后台管理 - welcome: 欢迎来到 Answer 后台管理! + welcome: 欢迎来到 {{site_name}} 后台管理! site_statistics: 站点统计 questions: "问题:" answers: "回答:" diff --git a/ui/src/components/Modal/LoginToContinueModal.tsx b/ui/src/components/Modal/LoginToContinueModal.tsx index e96ad71c..aff4b41a 100644 --- a/ui/src/components/Modal/LoginToContinueModal.tsx +++ b/ui/src/components/Modal/LoginToContinueModal.tsx @@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import { loginToContinueStore, siteInfoStore } from '@/stores'; +import { WelcomeTitle } from '@/components'; interface IProps { visible: boolean; @@ -32,7 +33,7 @@ const Index: React.FC = ({ visible = false }) => {
-

{t('page_title', { site_name: siteInfo.name })}

+

{siteInfo.description}

diff --git a/ui/src/components/WelcomeTitle/index.tsx b/ui/src/components/WelcomeTitle/index.tsx new file mode 100644 index 00000000..47f7771a --- /dev/null +++ b/ui/src/components/WelcomeTitle/index.tsx @@ -0,0 +1,23 @@ +import React, { FC, memo } from 'react'; +import { useTranslation } from 'react-i18next'; + +import classnames from 'classnames'; + +import { siteInfoStore } from '@/stores'; + +interface Props { + as?: React.ElementType; + className?: string; +} + +const Index: FC = ({ as: Component = 'h3', className = 'mb-5' }) => { + const { t } = useTranslation(); + const { name: siteName } = siteInfoStore((_) => _.siteInfo); + return ( + + {t('website_welcome', { site_name: siteName })} + + ); +}; + +export default memo(Index); diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts index 2a475e8b..2696e511 100644 --- a/ui/src/components/index.ts +++ b/ui/src/components/index.ts @@ -32,6 +32,7 @@ import CustomizeTheme from './CustomizeTheme'; import PageTags from './PageTags'; import QuestionListLoader from './QuestionListLoader'; import TagsLoader from './TagsLoader'; +import WelcomeTitle from './WelcomeTitle'; export { Avatar, @@ -70,5 +71,6 @@ export { PageTags, QuestionListLoader, TagsLoader, + WelcomeTitle, }; export type { EditorRef, JSONSchema, UISchema }; diff --git a/ui/src/pages/Admin/Dashboard/index.tsx b/ui/src/pages/Admin/Dashboard/index.tsx index 0b6834f9..e79eaf9f 100644 --- a/ui/src/pages/Admin/Dashboard/index.tsx +++ b/ui/src/pages/Admin/Dashboard/index.tsx @@ -2,6 +2,7 @@ import { FC } from 'react'; import { Row, Col } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; +import { siteInfoStore } from '@/stores'; import { useDashBoard } from '@/services'; import { @@ -13,6 +14,7 @@ import { const Dashboard: FC = () => { const { t } = useTranslation('translation', { keyPrefix: 'admin.dashboard' }); + const { name: siteName } = siteInfoStore((_) => _.siteInfo); const { data } = useDashBoard(); if (!data) { @@ -22,7 +24,7 @@ const Dashboard: FC = () => { return ( <>

{t('title')}

-

{t('welcome')}

+

{t('welcome', { site_name: siteName })}

diff --git a/ui/src/pages/Users/ActivationResult/index.tsx b/ui/src/pages/Users/ActivationResult/index.tsx index 77cdd52b..62f1e8cf 100644 --- a/ui/src/pages/Users/ActivationResult/index.tsx +++ b/ui/src/pages/Users/ActivationResult/index.tsx @@ -4,6 +4,7 @@ import { Link, useLocation } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { usePageTags } from '@/hooks'; +import { WelcomeTitle } from '@/components'; const Index: FC = () => { const { t } = useTranslation('translation', { keyPrefix: 'account_result' }); @@ -15,7 +16,7 @@ const Index: FC = () => { -

{t('page_title')}

+ {location.pathname?.includes('success') && ( <>

{t('success')}

diff --git a/ui/src/pages/Users/ChangeEmail/index.tsx b/ui/src/pages/Users/ChangeEmail/index.tsx index 33fcd8d3..16235db4 100644 --- a/ui/src/pages/Users/ChangeEmail/index.tsx +++ b/ui/src/pages/Users/ChangeEmail/index.tsx @@ -3,6 +3,7 @@ import { Container, Col } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; import { usePageTags } from '@/hooks'; +import { WelcomeTitle } from '@/components'; import SendEmail from './components/sendEmail'; @@ -13,7 +14,7 @@ const Index: FC = () => { }); return ( -

{t('page_title')}

+ diff --git a/ui/src/pages/Users/Login/index.tsx b/ui/src/pages/Users/Login/index.tsx index 0b510a3e..4e843bbd 100644 --- a/ui/src/pages/Users/Login/index.tsx +++ b/ui/src/pages/Users/Login/index.tsx @@ -11,13 +11,9 @@ import type { ImgCodeRes, FormDataType, } from '@/common/interface'; -import { Unactivate } from '@/components'; +import { Unactivate, WelcomeTitle } from '@/components'; import { PluginOauth } from '@/plugins'; -import { - loggedUserInfoStore, - loginSettingStore, - siteInfoStore, -} from '@/stores'; +import { loggedUserInfoStore, loginSettingStore } from '@/stores'; import { guard, floppyNavigation, handleFormError } from '@/utils'; import { login, checkImgCode } from '@/services'; import { PicAuthCodeModal } from '@/components/Modal'; @@ -28,7 +24,6 @@ const Index: React.FC = () => { const navigate = useNavigate(); const [searchParams] = useSearchParams(); const [refresh, setRefresh] = useState(0); - const { name: siteName } = siteInfoStore((_) => _.siteInfo); const { user: storeUser, update: updateUser } = loggedUserInfoStore((_) => _); const loginSetting = loginSettingStore((state) => state.login); const [formData, setFormData] = useState({ @@ -175,9 +170,7 @@ const Index: React.FC = () => { }); return ( -

- {t('page_title', { site_name: siteName })} -

+ {step === 1 && ( diff --git a/ui/src/pages/Users/OauthBindEmail/index.tsx b/ui/src/pages/Users/OauthBindEmail/index.tsx index 3a70fd26..dfc113d2 100644 --- a/ui/src/pages/Users/OauthBindEmail/index.tsx +++ b/ui/src/pages/Users/OauthBindEmail/index.tsx @@ -3,7 +3,7 @@ import { Container, Col, Form, Button } from 'react-bootstrap'; import { useTranslation, Trans } from 'react-i18next'; import { useSearchParams, useNavigate } from 'react-router-dom'; -import { Modal } from '@/components'; +import { Modal, WelcomeTitle } from '@/components'; import type { FormDataType } from '@/common/interface'; import { usePageTags } from '@/hooks'; import { loggedUserInfoStore } from '@/stores'; @@ -135,7 +135,7 @@ const Index: FC = () => { }, []); return ( -

{t('page_title')}

+ {showResult ? (

diff --git a/ui/src/pages/Users/Register/index.tsx b/ui/src/pages/Users/Register/index.tsx index fbf8b861..2dc52388 100644 --- a/ui/src/pages/Users/Register/index.tsx +++ b/ui/src/pages/Users/Register/index.tsx @@ -3,15 +3,13 @@ import { Container } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; import { usePageTags } from '@/hooks'; -import { Unactivate } from '@/components'; -import { siteInfoStore } from '@/stores'; +import { Unactivate, WelcomeTitle } from '@/components'; import SignUpForm from './components/SignUpForm'; const Index: React.FC = () => { const [showForm, setShowForm] = useState(true); const { t } = useTranslation('translation', { keyPrefix: 'login' }); - const { name: siteName } = siteInfoStore((_) => _.siteInfo); const onStep = () => { setShowForm((bol) => !bol); }; @@ -20,9 +18,7 @@ const Index: React.FC = () => { }); return ( -

- {t('page_title', { site_name: siteName })} -

+ {showForm ? ( ) : (