From eb2e383cc70a6b1097e453f9160b1dddc20ea392 Mon Sep 17 00:00:00 2001
From: Archer <545436317@qq.com>
Date: Wed, 13 Sep 2023 19:54:29 +0800
Subject: [PATCH] perf: document icon and language select (#299)
---
client/public/locales/en/common.json | 1 +
client/public/locales/zh/common.json | 1 +
client/src/components/Layout/navbar.tsx | 17 ++++++--
client/src/pages/account/components/Info.tsx | 44 ++++++++++++++++++--
4 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/client/public/locales/en/common.json b/client/public/locales/en/common.json
index 5bdfd3797..9da148367 100644
--- a/client/public/locales/en/common.json
+++ b/client/public/locales/en/common.json
@@ -231,6 +231,7 @@
"Copy invite url": "Copy invitation link",
"Invite Url": "Invite Url",
"Invite url tip": "Friends who register through this link will be permanently bound to you, and you will get a certain balance reward when they recharge. In addition, when friends register with their mobile phone number, you will get 5 yuan reward immediately.",
+ "Language": "Language",
"Notice": "Notice",
"Old password is error": "Old password is error",
"OpenAI Account Setting": "OpenAI Account Setting",
diff --git a/client/public/locales/zh/common.json b/client/public/locales/zh/common.json
index e4a84628c..3c9b52c6c 100644
--- a/client/public/locales/zh/common.json
+++ b/client/public/locales/zh/common.json
@@ -231,6 +231,7 @@
"Copy invite url": "复制邀请链接",
"Invite Url": "邀请链接",
"Invite url tip": "通过该链接注册的好友将永久与你绑定,其充值时你会获得一定余额奖励。\n此外,好友使用手机号注册时,你将立即获得 5 元奖励。",
+ "Language": "语言",
"Notice": "通知",
"Old password is error": "旧密码错误",
"OpenAI Account Setting": "OpenAI 账号配置",
diff --git a/client/src/components/Layout/navbar.tsx b/client/src/components/Layout/navbar.tsx
index 8480963bb..135439d23 100644
--- a/client/src/components/Layout/navbar.tsx
+++ b/client/src/components/Layout/navbar.tsx
@@ -9,7 +9,6 @@ import NextLink from 'next/link';
import Badge from '../Badge';
import Avatar from '../Avatar';
import MyIcon from '../Icon';
-import Language from '../Language';
import { useTranslation } from 'next-i18next';
import { useGlobalStore } from '@/store/global';
import MyTooltip from '../MyTooltip';
@@ -167,8 +166,20 @@ const Navbar = ({ unread }: { unread: number }) => {
)}
-
-
+ {feConfigs?.show_doc && (
+
+ {
+ window.open(`https://doc.fastgpt.run/docs/intro`);
+ }}
+ >
+
+
+
+ )}
{feConfigs?.show_git && (
import('./PayModal'), {
loading: () => ,
@@ -32,7 +48,8 @@ const OpenAIAccountModal = dynamic(() => import('./OpenAIAccountModal'), {
const UserInfo = () => {
const theme = useTheme();
- const { t } = useTranslation();
+ const router = useRouter();
+ const { t, i18n } = useTranslation();
const { userInfo, updateUserInfo, initUserInfo } = useUserStore();
const timezones = useRef(timezoneList());
const { reset } = useForm({
@@ -57,6 +74,8 @@ const UserInfo = () => {
multiple: false
});
+ const [language, setLanguage] = useState<`${LangEnum}`>(getLangStore());
+
const onclickSave = useCallback(
async (data: UserType) => {
await updateUserInfo({
@@ -149,6 +168,25 @@ const UserInfo = () => {
{t('user.Account')}:
{userInfo?.username}
+
+ {t('user.Language')}:
+
+ ({
+ label: lang.label,
+ value: key
+ }))}
+ onchange={(val: any) => {
+ const lang = val;
+ setLangStore(lang);
+ setLanguage(lang);
+ i18n?.changeLanguage?.(lang);
+ router.reload();
+ }}
+ />
+
+
{t('user.Timezone')}: