diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json
new file mode 100644
index 00000000..fc718a97
--- /dev/null
+++ b/frontend/.eslintrc.json
@@ -0,0 +1,34 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true,
+ "node": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:react/recommended",
+ "plugin:@typescript-eslint/recommended",
+ "prettier"
+ ],
+ "parser": "@typescript-eslint/parser",
+ "parserOptions": {
+ "ecmaFeatures": {
+ "jsx": true
+ },
+ "ecmaVersion": "latest",
+ "sourceType": "module"
+ },
+ "plugins": ["react", "@typescript-eslint", "prettier"],
+ "rules": {
+ "react/react-in-jsx-scope": "off",
+ "prettier/prettier": "error",
+ "@typescript-eslint/no-explicit-any": "warn",
+ "no-unused-vars": "off",
+ "@typescript-eslint/no-unused-vars": ["warn"]
+ },
+ "settings": {
+ "react": {
+ "version": "detect"
+ }
+ }
+}
diff --git a/frontend/.prettierrc.json b/frontend/.prettierrc.json
new file mode 100644
index 00000000..0260651f
--- /dev/null
+++ b/frontend/.prettierrc.json
@@ -0,0 +1,10 @@
+{
+ "semi": true,
+ "singleQuote": true,
+ "trailingComma": "es5",
+ "tabWidth": 2,
+ "printWidth": 100,
+ "bracketSpacing": true,
+ "arrowParens": "avoid",
+ "jsxSingleQuote": false
+}
diff --git a/frontend/packages/common/src/components/aoplatform/LanguageSetting.tsx b/frontend/packages/common/src/components/aoplatform/LanguageSetting.tsx
index b03f0a81..49cf8308 100644
--- a/frontend/packages/common/src/components/aoplatform/LanguageSetting.tsx
+++ b/frontend/packages/common/src/components/aoplatform/LanguageSetting.tsx
@@ -4,69 +4,88 @@ import { memo, useEffect, useMemo } from 'react';
import { useGlobalContext } from '@common/contexts/GlobalStateContext';
import { Icon } from '@iconify/react/dist/iconify.js';
-const LanguageSetting = ({mode = 'light'}:{mode?:'dark'|'light'}) => {
- const { dispatch,state} = useGlobalContext()
- const items = [
- {
- key: 'en-US',
- label:,
- title:'English'
- },
- {
- key: 'ja-JP',
- label:
+ ),
+ title: '日本語',
+ },
+ {
+ key: 'zh-TW',
+ label: (
+
+ 繁體中文
+
+ ),
+ title: '繁體中文',
+ },
+ {
+ key: 'zh-CN',
+ label: (
+
+ 简体中文
+
+ ),
+ title: '简体中文',
+ },
];
- const langLabel = useMemo(()=>items.find((item) => item?.key === state.language)?.title,[state.language])
+ const langLabel = useMemo(
+ () => items.find(item => item?.key === state.language)?.title,
+ [state.language]
+ );
- useEffect(()=>{
- const savedLang = sessionStorage.getItem('i18nextLng')
- const browserLang = navigator.language || navigator.userLanguage
- if(savedLang){
- dispatch({ type: 'UPDATE_LANGUAGE', language: savedLang });
- }else{
- dispatch({ type: 'UPDATE_LANGUAGE', language: browserLang });
- }
- },[
- ])
+ useEffect(() => {
+ const savedLang = sessionStorage.getItem('i18nextLng');
+ const browserLang = navigator.language || navigator.userLanguage;
+ if (savedLang) return;
+
+ dispatch({ type: 'UPDATE_LANGUAGE', language: browserLang });
+ }, []);
return (
{
+ style: { minWidth: '80px' },
+ onClick: e => {
const { key } = e;
- dispatch({ type: 'UPDATE_LANGUAGE', language: key });
+ dispatch({ type: 'UPDATE_LANGUAGE', language: key });
i18n.changeLanguage(key);
- }
+ },
}}
>
-
- {langLabel}
-
+
+
+ {' '}
+
+ {langLabel}
+
+
);
};
export default memo(LanguageSetting);
-