From ade4780c0ee88f1c9470f8e6aca85e502439a837 Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Tue, 12 Nov 2024 00:37:23 +0800 Subject: [PATCH] feat: update translations and display settings --- src/renderer/src/i18n/locales/en-us.json | 3 +- src/renderer/src/i18n/locales/zh-cn.json | 3 +- src/renderer/src/i18n/locales/zh-tw.json | 3 +- .../src/pages/home/Inputbar/Inputbar.tsx | 4 -- src/renderer/src/pages/home/Tabs/Settings.tsx | 47 +++++++++++++++++-- .../src/pages/settings/GeneralSettings.tsx | 38 +-------------- 6 files changed, 52 insertions(+), 46 deletions(-) diff --git a/src/renderer/src/i18n/locales/en-us.json b/src/renderer/src/i18n/locales/en-us.json index d36ab1f0c4..edaeb2fdae 100644 --- a/src/renderer/src/i18n/locales/en-us.json +++ b/src/renderer/src/i18n/locales/en-us.json @@ -336,7 +336,7 @@ "about.license.button": "License", "about.contact.button": "Email", "proxy.title": "Proxy Address", - "tray.title": "Show Tray Icon", + "tray.title": "Tray Icon", "theme.title": "Theme", "theme.dark": "Dark", "theme.light": "Light", @@ -349,6 +349,7 @@ "topic.position.left": "Left", "topic.position.right": "Right", "topic.show.time": "Show Topic Time", + "display.title": "Display Settings", "shortcuts": { "title": "Keyboard Shortcuts", "action": "Action", diff --git a/src/renderer/src/i18n/locales/zh-cn.json b/src/renderer/src/i18n/locales/zh-cn.json index e0812ba551..c04fa75426 100644 --- a/src/renderer/src/i18n/locales/zh-cn.json +++ b/src/renderer/src/i18n/locales/zh-cn.json @@ -324,7 +324,7 @@ "about.license.button": "查看", "about.contact.button": "邮件", "proxy.title": "代理地址", - "tray.title": "显示任务栏图标", + "tray.title": "任务栏图标", "theme.title": "主题", "theme.dark": "深色主题", "theme.light": "浅色主题", @@ -337,6 +337,7 @@ "topic.position.left": "左侧", "topic.position.right": "右侧", "topic.show.time": "显示话题时间", + "display.title": "显示设置", "shortcuts": { "title": "快捷方式", "action": "操作", diff --git a/src/renderer/src/i18n/locales/zh-tw.json b/src/renderer/src/i18n/locales/zh-tw.json index de359b2cb8..24bb0c915b 100644 --- a/src/renderer/src/i18n/locales/zh-tw.json +++ b/src/renderer/src/i18n/locales/zh-tw.json @@ -324,7 +324,7 @@ "about.license.button": "查看", "about.contact.button": "郵件", "proxy.title": "代理地址", - "tray.title": "顯示工作列圖示", + "tray.title": "工作列圖示", "theme.title": "主題", "theme.dark": "深色主題", "theme.light": "淺色主題", @@ -337,6 +337,7 @@ "topic.position.left": "左側", "topic.position.right": "右側", "topic.show.time": "顯示話題時間", + "display.title": "顯示設定", "shortcuts": { "title": "快速方式", "action": "操作", diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index 85d528bc42..756e4c6268 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -399,13 +399,9 @@ const Textarea = styled(TextArea)` overflow: auto; width: 100%; box-sizing: border-box; - color: var(--color-text); &.ant-input { line-height: 1.4; } - &::placeholder { - color: var(--color-text-3); - } ` const Toolbar = styled.div` diff --git a/src/renderer/src/pages/home/Tabs/Settings.tsx b/src/renderer/src/pages/home/Tabs/Settings.tsx index b6cabfc03f..b8a03805c4 100644 --- a/src/renderer/src/pages/home/Tabs/Settings.tsx +++ b/src/renderer/src/pages/home/Tabs/Settings.tsx @@ -8,6 +8,7 @@ import { useSettings } from '@renderer/hooks/useSettings' import { SettingDivider, SettingRow, SettingRowTitle, SettingSubtitle } from '@renderer/pages/settings' import { useAppDispatch } from '@renderer/store' import { + setClickAssistantToShowTopic, setCodeShowLineNumbers, setCodeStyle, setFontSize, @@ -17,7 +18,8 @@ import { setPasteLongTextAsFile, setRenderInputMessageAsMarkdown, setShowInputEstimatedTokens, - setShowMessageDivider + setShowMessageDivider, + setShowTopicTime } from '@renderer/store/settings' import { Assistant, AssistantSettings } from '@renderer/types' import { Col, Row, Select, Slider, Switch, Tooltip } from 'antd' @@ -52,7 +54,11 @@ const SettingsTab: FC = (props) => { pasteLongTextAsFile, renderInputMessageAsMarkdown, codeShowLineNumbers, - mathEngine + mathEngine, + topicPosition, + showTopicTime, + clickAssistantToShowTopic, + setTopicPosition } = useSettings() const onUpdateAssistantSettings = (settings: Partial) => { @@ -223,7 +229,7 @@ const SettingsTab: FC = (props) => { + + + {topicPosition === 'left' && ( + <> + + {t('settings.advanced.click_assistant_switch_to_topics')} + dispatch(setClickAssistantToShowTopic(checked))} + /> + + + + )} + + {t('settings.topic.show.time')} + dispatch(setShowTopicTime(checked))} /> + + ) } diff --git a/src/renderer/src/pages/settings/GeneralSettings.tsx b/src/renderer/src/pages/settings/GeneralSettings.tsx index fa14b76ab2..f22baa1e59 100644 --- a/src/renderer/src/pages/settings/GeneralSettings.tsx +++ b/src/renderer/src/pages/settings/GeneralSettings.tsx @@ -2,7 +2,7 @@ import { isMac } from '@renderer/config/constant' import { useSettings } from '@renderer/hooks/useSettings' import i18n from '@renderer/i18n' import { useAppDispatch } from '@renderer/store' -import { setClickAssistantToShowTopic, setLanguage, setShowTopicTime } from '@renderer/store/settings' +import { setLanguage } from '@renderer/store/settings' import { setProxyUrl as _setProxyUrl } from '@renderer/store/settings' import { LanguageVarious, ThemeMode } from '@renderer/types' import { isValidProxyUrl } from '@renderer/utils' @@ -21,11 +21,7 @@ const GeneralSettings: FC = () => { setTray, tray, windowStyle, - topicPosition, - showTopicTime, - clickAssistantToShowTopic, - setWindowStyle, - setTopicPosition + setWindowStyle } = useSettings() const [proxyUrl, setProxyUrl] = useState(storeProxyUrl) @@ -115,41 +111,11 @@ const GeneralSettings: FC = () => { /> - - {t('settings.topic.position')} -