@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.
- package/CHANGELOG.md +50 -0
- package/locales/en_US/error.json +2 -1
- package/locales/en_US/plugin.json +1 -0
- package/locales/en_US/setting.json +2 -1
- package/locales/ru_RU/error.json +2 -1
- package/locales/ru_RU/plugin.json +1 -0
- package/locales/ru_RU/setting.json +2 -1
- package/locales/zh_CN/error.json +1 -0
- package/locales/zh_CN/plugin.json +2 -1
- package/locales/zh_CN/setting.json +2 -1
- package/locales/zh_TW/error.json +2 -1
- package/locales/zh_TW/plugin.json +1 -0
- package/locales/zh_TW/setting.json +2 -1
- package/package.json +6 -5
- package/src/app/chat/components/SessionList/List/Item/index.tsx +2 -2
- package/src/app/home/index.tsx +15 -11
- package/src/app/layout.tsx +4 -1
- package/src/app/settings/agent/Agent.tsx +3 -3
- package/src/app/settings/agent/page.tsx +19 -5
- package/src/app/settings/common/Common.tsx +109 -117
- package/src/app/settings/common/page.tsx +18 -5
- package/src/app/settings/features/SideBar/List.tsx +11 -5
- package/src/app/settings/llm/LLM/index.tsx +2 -2
- package/src/app/settings/llm/page.tsx +18 -5
- package/src/config/client.ts +13 -0
- package/src/const/locale.ts +9 -0
- package/src/const/settings.ts +1 -1
- package/src/const/url.ts +1 -6
- package/src/helpers/export.ts +2 -2
- package/src/layout/GlobalLayout/Locale.tsx +44 -0
- package/src/layout/GlobalLayout/LocaleLoading.tsx +21 -0
- package/src/layout/GlobalLayout/StoreHydration.tsx +28 -0
- package/src/layout/GlobalLayout/index.tsx +29 -41
- package/src/locales/create.ts +43 -26
- package/src/locales/default/setting.ts +2 -1
- package/src/locales/options.ts +6 -5
- package/src/services/agentMarket.ts +6 -4
- package/src/services/pluginMarket.ts +2 -2
- package/src/store/global/hooks/useSwitchSettingsOnInit.ts +5 -2
- package/src/store/global/{selectors.test.ts → selectors/settings.test.ts} +11 -11
- package/src/store/global/selectors/settings.ts +44 -0
- package/src/store/global/selectors.ts +1 -36
- package/src/store/global/slices/common.ts +3 -4
- package/src/types/locale.ts +4 -0
- package/src/types/settings.ts +2 -2
- package/src/utils/env.ts +2 -0
- package/src/utils/responsive.ts +1 -1
- package/src/utils/switchLang.ts +5 -1
- package/src/app/settings/agent/index.tsx +0 -20
- package/src/app/settings/common/index.tsx +0 -20
- package/src/app/settings/llm/index.tsx +0 -20
- package/src/layout/GlobalLayout/style.ts +0 -18
- /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
|
+
[](#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
|
+
[](#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>
|
package/locales/en_US/error.json
CHANGED
|
@@ -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
|
}
|
package/locales/ru_RU/error.json
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"password": {
|
|
37
37
|
"description": "Шифрование приложения включено администратором. Введите пароль приложения, чтобы разблокировать приложение. Пароль необходимо ввести только один раз.",
|
|
38
38
|
"title": "Введите пароль для разблокировки приложения"
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
"closeMessage": "Закрыть сообщение"
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -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/locales/zh_CN/error.json
CHANGED
|
@@ -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": "设置插件市场"
|
package/locales/zh_TW/error.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "0.
|
|
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": "
|
|
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 {
|
|
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) => [
|
|
39
|
+
const [defaultModel] = useGlobalStore((s) => [settingsSelectors.defaultAgentConfig(s).model]);
|
|
40
40
|
|
|
41
41
|
const [
|
|
42
42
|
active,
|
package/src/app/home/index.tsx
CHANGED
|
@@ -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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
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
|
-
</
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
</Flexbox>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
19
23
|
|
|
20
24
|
export default Loading;
|
package/src/app/layout.tsx
CHANGED
|
@@ -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=
|
|
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 {
|
|
5
|
+
import { settingsSelectors, useGlobalStore } from '@/store/global';
|
|
6
6
|
|
|
7
7
|
const Agent = memo(() => {
|
|
8
|
-
const config = useGlobalStore(
|
|
9
|
-
const meta = useGlobalStore(
|
|
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
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
return <Page />;
|
|
5
|
-
};
|
|
3
|
+
import { memo } from 'react';
|
|
6
4
|
|
|
7
|
-
|
|
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
|
|
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 {
|
|
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(
|
|
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 =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
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
|
|
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={
|
|
173
|
+
items={[theme, system]}
|
|
182
174
|
onValuesChange={debounce(setSettings, 100)}
|
|
183
175
|
{...FORM_STYLE}
|
|
184
176
|
/>
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
return <Page />;
|
|
5
|
-
};
|
|
3
|
+
import { memo } from 'react';
|
|
6
4
|
|
|
7
|
-
|
|
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;
|