@lobehub/chat 0.82.9 → 0.83.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/locales/en_US/error.json +2 -1
  3. package/locales/en_US/plugin.json +1 -0
  4. package/locales/en_US/setting.json +2 -1
  5. package/locales/ru_RU/error.json +2 -1
  6. package/locales/ru_RU/plugin.json +1 -0
  7. package/locales/ru_RU/setting.json +2 -1
  8. package/locales/zh_CN/error.json +1 -0
  9. package/locales/zh_CN/plugin.json +2 -1
  10. package/locales/zh_CN/setting.json +2 -1
  11. package/locales/zh_TW/error.json +2 -1
  12. package/locales/zh_TW/plugin.json +1 -0
  13. package/locales/zh_TW/setting.json +2 -1
  14. package/package.json +6 -5
  15. package/src/app/chat/components/SessionList/List/Item/index.tsx +2 -2
  16. package/src/app/home/index.tsx +15 -11
  17. package/src/app/layout.tsx +4 -1
  18. package/src/app/settings/agent/Agent.tsx +3 -3
  19. package/src/app/settings/agent/page.tsx +19 -5
  20. package/src/app/settings/common/Common.tsx +109 -117
  21. package/src/app/settings/common/page.tsx +18 -5
  22. package/src/app/settings/features/SideBar/List.tsx +11 -5
  23. package/src/app/settings/llm/LLM/index.tsx +2 -2
  24. package/src/app/settings/llm/page.tsx +18 -5
  25. package/src/config/client.ts +13 -0
  26. package/src/const/locale.ts +9 -0
  27. package/src/const/settings.ts +1 -1
  28. package/src/const/url.ts +1 -6
  29. package/src/helpers/export.ts +2 -2
  30. package/src/layout/GlobalLayout/Locale.tsx +44 -0
  31. package/src/layout/GlobalLayout/LocaleLoading.tsx +21 -0
  32. package/src/layout/GlobalLayout/StoreHydration.tsx +28 -0
  33. package/src/layout/GlobalLayout/index.tsx +29 -41
  34. package/src/locales/create.ts +43 -26
  35. package/src/locales/default/setting.ts +2 -1
  36. package/src/locales/options.ts +6 -5
  37. package/src/services/agentMarket.ts +6 -4
  38. package/src/services/pluginMarket.ts +2 -2
  39. package/src/store/global/hooks/useSwitchSettingsOnInit.ts +5 -2
  40. package/src/store/global/{selectors.test.ts → selectors/settings.test.ts} +11 -11
  41. package/src/store/global/selectors/settings.ts +44 -0
  42. package/src/store/global/selectors.ts +1 -36
  43. package/src/store/global/slices/common.ts +3 -4
  44. package/src/types/locale.ts +4 -0
  45. package/src/types/settings.ts +2 -2
  46. package/src/utils/env.ts +2 -0
  47. package/src/utils/responsive.ts +1 -1
  48. package/src/utils/switchLang.ts +5 -1
  49. package/src/app/settings/agent/index.tsx +0 -20
  50. package/src/app/settings/common/index.tsx +0 -20
  51. package/src/app/settings/llm/index.tsx +0 -20
  52. package/src/layout/GlobalLayout/style.ts +0 -18
  53. /package/src/{components/AppTheme/index.tsx → layout/GlobalLayout/AppTheme.tsx} +0 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.83.1](https://github.com/lobehub/lobe-chat/compare/v0.83.0...v0.83.1)
6
+
7
+ <sup>Released on **2023-10-06**</sup>
8
+
9
+ #### ♻ Code Refactoring
10
+
11
+ - **misc**: Refactor settings page entry.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### Code refactoring
19
+
20
+ - **misc**: Refactor settings page entry ([e86aff2](https://github.com/lobehub/lobe-chat/commit/e86aff2))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ## [Version 0.83.0](https://github.com/lobehub/lobe-chat/compare/v0.82.9...v0.83.0)
31
+
32
+ <sup>Released on **2023-10-06**</sup>
33
+
34
+ #### ✨ Features
35
+
36
+ - **misc**: Upgrade locale with SSR.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### What's improved
44
+
45
+ - **misc**: Upgrade locale with SSR, closes [#268](https://github.com/lobehub/lobe-chat/issues/268) ([2fdea52](https://github.com/lobehub/lobe-chat/commit/2fdea52))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 0.82.9](https://github.com/lobehub/lobe-chat/compare/v0.82.8...v0.82.9)
6
56
 
7
57
  <sup>Released on **2023-10-05**</sup>
@@ -36,6 +36,7 @@
36
36
  "password": {
37
37
  "description": "The application encryption has been enabled by the administrator. Enter the application password to unlock the application. The password only needs to be filled in once.",
38
38
  "title": "Enter Password to Unlock Application"
39
- }
39
+ },
40
+ "closeMessage": "Close message"
40
41
  }
41
42
  }
@@ -115,6 +115,7 @@
115
115
  "updateAt": "Last Updated"
116
116
  },
117
117
  "responseData": "Response Data",
118
+ "setting": "Plugin Settings",
118
119
  "settings": {
119
120
  "indexUrl": {
120
121
  "title": "Marketplace Index",
@@ -211,7 +211,8 @@
211
211
  "title": "Font Size"
212
212
  },
213
213
  "lang": {
214
- "title": "Language Settings"
214
+ "title": "Language Settings",
215
+ "autoMode": "Follow System"
215
216
  },
216
217
  "neutralColor": {
217
218
  "desc": "Custom grayscale for different color tendencies",
@@ -36,6 +36,7 @@
36
36
  "password": {
37
37
  "description": "Шифрование приложения включено администратором. Введите пароль приложения, чтобы разблокировать приложение. Пароль необходимо ввести только один раз.",
38
38
  "title": "Введите пароль для разблокировки приложения"
39
- }
39
+ },
40
+ "closeMessage": "Закрыть сообщение"
40
41
  }
41
42
  }
@@ -95,6 +95,7 @@
95
95
  "plugins": {
96
96
  "unknown": "Проверка плагинов..."
97
97
  },
98
+ "setting": "Настройки плагина",
98
99
  "settings": {
99
100
  "indexUrl": {
100
101
  "title": "Индекс рынка",
@@ -211,7 +211,8 @@
211
211
  "title": "Размер шрифта"
212
212
  },
213
213
  "lang": {
214
- "title": "Языковые настройки"
214
+ "title": "Языковые настройки",
215
+ "autoMode": "Следовать за системой"
215
216
  },
216
217
  "neutralColor": {
217
218
  "desc": "Пользовательская шкала серого для различных цветовых тенденций",
@@ -32,6 +32,7 @@
32
32
  "description": "输入你的 OpenAI API Key 即可绕过密码验证。应用不会记录你的 API Key",
33
33
  "title": "使用自定义 API Key"
34
34
  },
35
+ "closeMessage": "关闭提示",
35
36
  "confirm": "确认并重试",
36
37
  "password": {
37
38
  "description": "管理员已开启应用加密,输入应用密码后即可解锁应用。密码只需填写一次",
@@ -95,10 +95,11 @@
95
95
  "plugins": {
96
96
  "unknown": "插件检测中..."
97
97
  },
98
+ "setting": "插件设置",
98
99
  "settings": {
99
100
  "indexUrl": {
100
101
  "title": "市场索引",
101
- "tooltip": "暂不支持编辑"
102
+ "tooltip": "暂不支持在线编辑,请通过部署时环境变量进行设置"
102
103
  },
103
104
  "modalDesc": "配置插件市场的地址后,可以使用自定义的插件市场",
104
105
  "title": "设置插件市场"
@@ -198,7 +198,8 @@
198
198
  "title": "字体大小"
199
199
  },
200
200
  "lang": {
201
- "title": "语言设置"
201
+ "autoMode": "跟随系统",
202
+ "title": "语言"
202
203
  },
203
204
  "neutralColor": {
204
205
  "desc": "不同色彩倾向的灰阶自定义",
@@ -36,6 +36,7 @@
36
36
  "password": {
37
37
  "description": "管理員已啟用應用程式加密,輸入應用程式密碼後即可解鎖應用程式。密碼只需填寫一次。",
38
38
  "title": "輸入密碼解鎖應用程式"
39
- }
39
+ },
40
+ "closeMessage": "關閉提示"
40
41
  }
41
42
  }
@@ -115,6 +115,7 @@
115
115
  "updateAt": "最後更新時間"
116
116
  },
117
117
  "responseData": "回應資料",
118
+ "setting": "插件設置",
118
119
  "settings": {
119
120
  "indexUrl": {
120
121
  "title": "外掛市集索引",
@@ -211,7 +211,8 @@
211
211
  "title": "字型大小"
212
212
  },
213
213
  "lang": {
214
- "title": "語言設定"
214
+ "title": "語言設定",
215
+ "autoMode": "跟隨系統"
215
216
  },
216
217
  "neutralColor": {
217
218
  "desc": "不同色彩傾向的灰階自訂",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.82.9",
3
+ "version": "0.83.1",
4
4
  "description": "An open-source, extensible (Function Calling), high-performance chatbot framework. It supports one-click free deployment of your private ChatGPT/LLM web application",
5
5
  "keywords": [
6
6
  "chatbot",
@@ -76,7 +76,7 @@
76
76
  "ahooks": "^3",
77
77
  "ai": "^2",
78
78
  "antd": "^5",
79
- "antd-style": "^3",
79
+ "antd-style": "^3.5",
80
80
  "brotli-wasm": "^1",
81
81
  "chroma-js": "^2",
82
82
  "dayjs": "^1",
@@ -85,6 +85,9 @@
85
85
  "gpt-tokenizer": "^2",
86
86
  "html-to-image": "^1",
87
87
  "i18next": "^23",
88
+ "i18next-browser-languagedetector": "^7",
89
+ "i18next-resources-for-ts": "^1",
90
+ "i18next-resources-to-backend": "^1",
88
91
  "idb-keyval": "^6",
89
92
  "immer": "^10",
90
93
  "lodash-es": "^4",
@@ -92,7 +95,7 @@
92
95
  "mixpanel-browser": "^2",
93
96
  "nanoid": "^5",
94
97
  "next": "^13.5.3",
95
- "openai": "~4.10.0",
98
+ "openai": "^4.10.0",
96
99
  "polished": "^4",
97
100
  "posthog-js": "^1",
98
101
  "react": "^18",
@@ -139,8 +142,6 @@
139
142
  "dpdm": "^3",
140
143
  "eslint": "^8",
141
144
  "husky": "^8",
142
- "i18next-browser-languagedetector": "^7",
143
- "i18next-resources-for-ts": "^1",
144
145
  "jsdom": "^22",
145
146
  "lint-staged": "^14",
146
147
  "next-pwa": "^5",
@@ -6,7 +6,7 @@ import { memo, useMemo, useRef, useState } from 'react';
6
6
  import { Flexbox } from 'react-layout-kit';
7
7
  import { shallow } from 'zustand/shallow';
8
8
 
9
- import { globalSelectors, useGlobalStore } from '@/store/global';
9
+ import { settingsSelectors, useGlobalStore } from '@/store/global';
10
10
  import { useSessionStore } from '@/store/session';
11
11
  import { agentSelectors, sessionSelectors } from '@/store/session/selectors';
12
12
 
@@ -36,7 +36,7 @@ const SessionItem = memo<SessionItemProps>(({ id }) => {
36
36
  const isHovering = useHover(ref);
37
37
  const { mobile } = useResponsive();
38
38
  const { styles } = useStyles();
39
- const [defaultModel] = useGlobalStore((s) => [globalSelectors.defaultAgentConfig(s).model]);
39
+ const [defaultModel] = useGlobalStore((s) => [settingsSelectors.defaultAgentConfig(s).model]);
40
40
 
41
41
  const [
42
42
  active,
@@ -1,20 +1,24 @@
1
1
  'use client';
2
2
 
3
3
  import { Icon, Logo } from '@lobehub/ui';
4
- import { t } from 'i18next';
5
4
  import { Loader2 } from 'lucide-react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import { Center, Flexbox } from 'react-layout-kit';
7
7
 
8
- const Loading = () => (
9
- <Flexbox height={'100vh'} width={'100%'}>
10
- <Center flex={1} gap={12} width={'100%'}>
11
- <Logo extra={'Chat'} size={48} type={'combine'} />
12
- <Center gap={16} horizontal>
13
- <Icon icon={Loader2} spin />
14
- {t('appInitializing', { ns: 'common' })}
8
+ const Loading = () => {
9
+ const { t } = useTranslation();
10
+
11
+ return (
12
+ <Flexbox height={'100vh'} width={'100%'}>
13
+ <Center flex={1} gap={12} width={'100%'}>
14
+ <Logo extra={'Chat'} size={48} type={'combine'} />
15
+ <Center gap={16} horizontal>
16
+ <Icon icon={Loader2} spin />
17
+ {t('appInitializing', { ns: 'common' })}
18
+ </Center>
15
19
  </Center>
16
- </Center>
17
- </Flexbox>
18
- );
20
+ </Flexbox>
21
+ );
22
+ };
19
23
 
20
24
  export default Loading;
@@ -2,6 +2,7 @@ import { cookies } from 'next/headers';
2
2
  import { PropsWithChildren } from 'react';
3
3
 
4
4
  import Analytics from '@/components/Analytics';
5
+ import { DEFAULT_LANG, LOBE_LOCALE_COOKIE } from '@/const/locale';
5
6
  import {
6
7
  LOBE_THEME_APPEARANCE,
7
8
  LOBE_THEME_NEUTRAL_COLOR,
@@ -17,13 +18,15 @@ const RootLayout = ({ children }: PropsWithChildren) => {
17
18
  const appearance = cookieStore.get(LOBE_THEME_APPEARANCE);
18
19
  const neutralColor = cookieStore.get(LOBE_THEME_NEUTRAL_COLOR);
19
20
  const primaryColor = cookieStore.get(LOBE_THEME_PRIMARY_COLOR);
21
+ const lang = cookieStore.get(LOBE_LOCALE_COOKIE);
20
22
 
21
23
  return (
22
- <html lang="en-US">
24
+ <html lang={lang?.value || DEFAULT_LANG}>
23
25
  <body>
24
26
  <StyleRegistry>
25
27
  <Layout
26
28
  defaultAppearance={appearance?.value}
29
+ defaultLang={lang?.value}
27
30
  defaultNeutralColor={neutralColor?.value as any}
28
31
  defaultPrimaryColor={primaryColor?.value as any}
29
32
  >
@@ -2,11 +2,11 @@ import isEqual from 'fast-deep-equal';
2
2
  import { memo } from 'react';
3
3
 
4
4
  import AgentSetting from '@/features/AgentSetting';
5
- import { globalSelectors, useGlobalStore } from '@/store/global';
5
+ import { settingsSelectors, useGlobalStore } from '@/store/global';
6
6
 
7
7
  const Agent = memo(() => {
8
- const config = useGlobalStore(globalSelectors.defaultAgentConfig, isEqual);
9
- const meta = useGlobalStore(globalSelectors.defaultAgentMeta, isEqual);
8
+ const config = useGlobalStore(settingsSelectors.defaultAgentConfig, isEqual);
9
+ const meta = useGlobalStore(settingsSelectors.defaultAgentMeta, isEqual);
10
10
  const [updateAgent] = useGlobalStore((s) => [s.updateDefaultAgent]);
11
11
 
12
12
  return (
@@ -1,7 +1,21 @@
1
- import Page from './index';
1
+ 'use client';
2
2
 
3
- const Index = () => {
4
- return <Page />;
5
- };
3
+ import { memo } from 'react';
6
4
 
7
- export default Index;
5
+ import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
+ import { SettingsTabs } from '@/store/global/initialState';
7
+
8
+ import Layout from '../index';
9
+ import Agent from './Agent';
10
+
11
+ const AgentSetting = memo(() => {
12
+ useSwitchSideBarOnInit(SettingsTabs.Agent);
13
+
14
+ return (
15
+ <Layout>
16
+ <Agent />
17
+ </Layout>
18
+ );
19
+ });
20
+
21
+ export default AgentSetting;
@@ -3,32 +3,27 @@ import { Form as AntForm, App, Button, Input, Select } from 'antd';
3
3
  import isEqual from 'fast-deep-equal';
4
4
  import { debounce } from 'lodash-es';
5
5
  import { AppWindow, Monitor, Moon, Palette, Sun } from 'lucide-react';
6
- import { memo, useCallback, useMemo } from 'react';
6
+ import { memo, useCallback } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
 
9
9
  import { FORM_STYLE } from '@/const/layoutTokens';
10
10
  import { DEFAULT_SETTINGS } from '@/const/settings';
11
11
  import AvatarWithUpload from '@/features/AvatarWithUpload';
12
12
  import { localeOptions } from '@/locales/options';
13
- import { globalSelectors, useGlobalStore } from '@/store/global';
13
+ import { settingsSelectors, useGlobalStore } from '@/store/global';
14
14
  import { useSessionStore } from '@/store/session';
15
- import { ConfigKeys } from '@/types/settings';
16
15
  import { switchLang } from '@/utils/switchLang';
17
16
 
18
17
  import { ThemeSwatchesNeutral, ThemeSwatchesPrimary } from '../features/ThemeSwatches';
19
18
 
20
- type SettingItemGroup = ItemGroup & {
21
- children: {
22
- name?: ConfigKeys | string;
23
- }[];
24
- };
19
+ type SettingItemGroup = ItemGroup;
25
20
 
26
21
  const Common = memo(() => {
27
22
  const { t } = useTranslation('setting');
28
23
  const [form] = AntForm.useForm();
29
24
  const clearSessions = useSessionStore((s) => s.clearSessions);
30
25
 
31
- const settings = useGlobalStore(globalSelectors.currentSettings, isEqual);
26
+ const settings = useGlobalStore(settingsSelectors.currentSettings, isEqual);
32
27
  const [setThemeMode, setSettings, resetSettings] = useGlobalStore((s) => [
33
28
  s.switchThemeMode,
34
29
  s.setSettings,
@@ -36,6 +31,7 @@ const Common = memo(() => {
36
31
  ]);
37
32
 
38
33
  const { message, modal } = App.useApp();
34
+
39
35
  const handleReset = useCallback(() => {
40
36
  modal.confirm({
41
37
  cancelText: t('cancel', { ns: 'common' }),
@@ -49,7 +45,6 @@ const Common = memo(() => {
49
45
  title: t('danger.reset.confirm'),
50
46
  });
51
47
  }, []);
52
-
53
48
  const handleClear = useCallback(() => {
54
49
  modal.confirm({
55
50
  cancelText: t('cancel', { ns: 'common' }),
@@ -66,119 +61,116 @@ const Common = memo(() => {
66
61
  });
67
62
  }, []);
68
63
 
69
- const theme: SettingItemGroup = useMemo(
70
- () => ({
71
- children: [
72
- {
73
- children: <AvatarWithUpload />,
74
- label: t('settingTheme.avatar.title'),
75
- minWidth: undefined,
76
- },
77
- {
78
- children: (
79
- <SelectWithImg
80
- defaultValue={settings.themeMode}
81
- height={60}
82
- onChange={setThemeMode}
83
- options={[
84
- {
85
- icon: Sun,
86
- img: '/images/theme_light.webp',
87
- label: t('settingTheme.themeMode.light'),
88
- value: 'light',
89
- },
90
- {
91
- icon: Moon,
92
- img: '/images/theme_dark.webp',
93
- label: t('settingTheme.themeMode.dark'),
94
- value: 'dark',
95
- },
96
- {
97
- icon: Monitor,
98
- img: '/images/theme_auto.webp',
99
- label: t('settingTheme.themeMode.auto'),
100
- value: 'auto',
101
- },
102
- ]}
103
- width={100}
104
- />
105
- ),
106
- label: t('settingTheme.themeMode.title'),
107
- minWidth: undefined,
108
- },
109
- {
110
- children: <Select onChange={switchLang} options={localeOptions} />,
111
- label: t('settingTheme.lang.title'),
112
- name: 'language',
113
- },
114
- {
115
- children: <SliderWithInput max={18} min={12} />,
116
- desc: t('settingTheme.fontSize.desc'),
117
- label: t('settingTheme.fontSize.title'),
118
- name: 'fontSize',
119
- },
120
- {
121
- children: <ThemeSwatchesPrimary />,
122
- desc: t('settingTheme.primaryColor.desc'),
123
- label: t('settingTheme.primaryColor.title'),
124
- minWidth: undefined,
125
- },
126
- {
127
- children: <ThemeSwatchesNeutral />,
128
- desc: t('settingTheme.neutralColor.desc'),
129
- label: t('settingTheme.neutralColor.title'),
130
- minWidth: undefined,
131
- },
132
- ],
133
- icon: Palette,
134
- title: t('settingTheme.title'),
135
- }),
136
- [settings],
137
- );
138
-
139
- const system: SettingItemGroup = useMemo(
140
- () => ({
141
- children: [
142
- {
143
- children: <Input.Password placeholder={t('settingSystem.accessCode.placeholder')} />,
144
- desc: t('settingSystem.accessCode.desc'),
145
- label: t('settingSystem.accessCode.title'),
146
- name: 'password',
147
- },
148
- {
149
- children: (
150
- <Button danger onClick={handleReset} type="primary">
151
- {t('danger.reset.action')}
152
- </Button>
153
- ),
154
- desc: t('danger.reset.title'),
155
- label: t('danger.reset.desc'),
156
- minWidth: undefined,
157
- },
158
- {
159
- children: (
160
- <Button danger onClick={handleClear} type="primary">
161
- {t('danger.clear.action')}
162
- </Button>
163
- ),
164
- desc: t('danger.clear.title'),
165
- label: t('danger.clear.desc'),
166
- minWidth: undefined,
167
- },
168
- ],
169
- icon: AppWindow,
170
- title: t('settingSystem.title'),
171
- }),
172
- [settings],
173
- );
64
+ const theme: SettingItemGroup = {
65
+ children: [
66
+ {
67
+ children: <AvatarWithUpload />,
68
+ label: t('settingTheme.avatar.title'),
69
+ minWidth: undefined,
70
+ },
71
+ {
72
+ children: (
73
+ <SelectWithImg
74
+ defaultValue={settings.themeMode}
75
+ height={60}
76
+ onChange={setThemeMode}
77
+ options={[
78
+ {
79
+ icon: Sun,
80
+ img: '/images/theme_light.webp',
81
+ label: t('settingTheme.themeMode.light'),
82
+ value: 'light',
83
+ },
84
+ {
85
+ icon: Moon,
86
+ img: '/images/theme_dark.webp',
87
+ label: t('settingTheme.themeMode.dark'),
88
+ value: 'dark',
89
+ },
90
+ {
91
+ icon: Monitor,
92
+ img: '/images/theme_auto.webp',
93
+ label: t('settingTheme.themeMode.auto'),
94
+ value: 'auto',
95
+ },
96
+ ]}
97
+ width={100}
98
+ />
99
+ ),
100
+ label: t('settingTheme.themeMode.title'),
101
+ minWidth: undefined,
102
+ },
103
+ {
104
+ children: (
105
+ <Select
106
+ onChange={switchLang}
107
+ options={[{ label: t('settingTheme.lang.autoMode'), value: 'auto' }, ...localeOptions]}
108
+ />
109
+ ),
110
+ label: t('settingTheme.lang.title'),
111
+ name: 'language',
112
+ },
113
+ {
114
+ children: <SliderWithInput max={18} min={12} />,
115
+ desc: t('settingTheme.fontSize.desc'),
116
+ label: t('settingTheme.fontSize.title'),
117
+ name: 'fontSize',
118
+ },
119
+ {
120
+ children: <ThemeSwatchesPrimary />,
121
+ desc: t('settingTheme.primaryColor.desc'),
122
+ label: t('settingTheme.primaryColor.title'),
123
+ minWidth: undefined,
124
+ },
125
+ {
126
+ children: <ThemeSwatchesNeutral />,
127
+ desc: t('settingTheme.neutralColor.desc'),
128
+ label: t('settingTheme.neutralColor.title'),
129
+ minWidth: undefined,
130
+ },
131
+ ],
132
+ icon: Palette,
133
+ title: t('settingTheme.title'),
134
+ };
174
135
 
175
- const items = useMemo(() => [theme, system], [settings]);
136
+ const system: SettingItemGroup = {
137
+ children: [
138
+ {
139
+ children: <Input.Password placeholder={t('settingSystem.accessCode.placeholder')} />,
140
+ desc: t('settingSystem.accessCode.desc'),
141
+ label: t('settingSystem.accessCode.title'),
142
+ name: 'password',
143
+ },
144
+ {
145
+ children: (
146
+ <Button danger onClick={handleReset} type="primary">
147
+ {t('danger.reset.action')}
148
+ </Button>
149
+ ),
150
+ desc: t('danger.reset.title'),
151
+ label: t('danger.reset.desc'),
152
+ minWidth: undefined,
153
+ },
154
+ {
155
+ children: (
156
+ <Button danger onClick={handleClear} type="primary">
157
+ {t('danger.clear.action')}
158
+ </Button>
159
+ ),
160
+ desc: t('danger.clear.title'),
161
+ label: t('danger.clear.desc'),
162
+ minWidth: undefined,
163
+ },
164
+ ],
165
+ icon: AppWindow,
166
+ title: t('settingSystem.title'),
167
+ };
176
168
 
177
169
  return (
178
170
  <Form
179
171
  form={form}
180
172
  initialValues={settings}
181
- items={items}
173
+ items={[theme, system]}
182
174
  onValuesChange={debounce(setSettings, 100)}
183
175
  {...FORM_STYLE}
184
176
  />
@@ -1,7 +1,20 @@
1
- import Page from './index';
1
+ 'use client';
2
2
 
3
- const Index = () => {
4
- return <Page />;
5
- };
3
+ import { memo } from 'react';
6
4
 
7
- export default Index;
5
+ import { useSwitchSideBarOnInit } from '@/store/global/hooks/useSwitchSettingsOnInit';
6
+ import { SettingsTabs } from '@/store/global/initialState';
7
+
8
+ import Layout from '../index';
9
+ import Common from './Common';
10
+
11
+ const CommonSetting = memo(() => {
12
+ useSwitchSideBarOnInit(SettingsTabs.Common);
13
+ return (
14
+ <Layout>
15
+ <Common />
16
+ </Layout>
17
+ );
18
+ });
19
+
20
+ export default CommonSetting;