diff --git a/client/shared/i18n/index.ts b/client/shared/i18n/index.ts index 858506cf..94b5b127 100644 --- a/client/shared/i18n/index.ts +++ b/client/shared/i18n/index.ts @@ -11,7 +11,7 @@ import HttpApi from 'i18next-http-backend'; // https://github.com/i18next/i18nex /** * 允许出现的语言 */ -type AllowedLanguage = 'zh-CN' | 'en-US'; +export type AllowedLanguage = 'zh-CN' | 'en-US'; i18next .use(languageDetector) diff --git a/client/shared/i18n/language.ts b/client/shared/i18n/language.ts index 44c541ca..9a2e5d24 100644 --- a/client/shared/i18n/language.ts +++ b/client/shared/i18n/language.ts @@ -1,7 +1,7 @@ import type { LanguageDetectorAsyncModule } from 'i18next'; import { useRef, useMemo, useCallback } from 'react'; import _isNil from 'lodash/isNil'; -import { setLanguage as setI18NLanguage } from './index'; +import { AllowedLanguage, setLanguage as setI18NLanguage } from './index'; import { getStorage, useStorage } from '../manager/storage'; import { LANGUAGE_KEY } from '../utils/consts'; @@ -23,7 +23,7 @@ export function useLanguage() { const originLanguageRef = useRef(); const setLanguage = useCallback( - async (newLanguage) => { + async (newLanguage: AllowedLanguage) => { if (_isNil(originLanguageRef.current)) { originLanguageRef.current = language; } diff --git a/client/web/src/routes/Main/Content/Personal/index.tsx b/client/web/src/routes/Main/Content/Personal/index.tsx index 25d2a07d..635b0dc1 100644 --- a/client/web/src/routes/Main/Content/Personal/index.tsx +++ b/client/web/src/routes/Main/Content/Personal/index.tsx @@ -1,3 +1,4 @@ +import { ErrorBoundary } from '@/components/ErrorBoundary'; import { pluginCustomPanel } from '@/plugin/common'; import React from 'react'; import { Redirect, Route, Switch } from 'react-router-dom'; @@ -10,28 +11,30 @@ import { PersonalSidebar } from './Sidebar'; export const Personal: React.FC = React.memo(() => { return ( }> - - + + + - + - + - {pluginCustomPanel - .filter((p) => p.position === 'personal') - .map((p) => ( - - ))} + {pluginCustomPanel + .filter((p) => p.position === 'personal') + .map((p) => ( + + ))} - - + + + ); });