feat: update translations and display settings

This commit is contained in:
kangfenmao 2024-11-12 00:37:23 +08:00
parent 0b9717780d
commit a2d568175b
6 changed files with 52 additions and 46 deletions

View File

@ -336,7 +336,7 @@
"about.license.button": "License", "about.license.button": "License",
"about.contact.button": "Email", "about.contact.button": "Email",
"proxy.title": "Proxy Address", "proxy.title": "Proxy Address",
"tray.title": "Show Tray Icon", "tray.title": "Tray Icon",
"theme.title": "Theme", "theme.title": "Theme",
"theme.dark": "Dark", "theme.dark": "Dark",
"theme.light": "Light", "theme.light": "Light",
@ -349,6 +349,7 @@
"topic.position.left": "Left", "topic.position.left": "Left",
"topic.position.right": "Right", "topic.position.right": "Right",
"topic.show.time": "Show Topic Time", "topic.show.time": "Show Topic Time",
"display.title": "Display Settings",
"shortcuts": { "shortcuts": {
"title": "Keyboard Shortcuts", "title": "Keyboard Shortcuts",
"action": "Action", "action": "Action",

View File

@ -324,7 +324,7 @@
"about.license.button": "查看", "about.license.button": "查看",
"about.contact.button": "邮件", "about.contact.button": "邮件",
"proxy.title": "代理地址", "proxy.title": "代理地址",
"tray.title": "显示任务栏图标", "tray.title": "任务栏图标",
"theme.title": "主题", "theme.title": "主题",
"theme.dark": "深色主题", "theme.dark": "深色主题",
"theme.light": "浅色主题", "theme.light": "浅色主题",
@ -337,6 +337,7 @@
"topic.position.left": "左侧", "topic.position.left": "左侧",
"topic.position.right": "右侧", "topic.position.right": "右侧",
"topic.show.time": "显示话题时间", "topic.show.time": "显示话题时间",
"display.title": "显示设置",
"shortcuts": { "shortcuts": {
"title": "快捷方式", "title": "快捷方式",
"action": "操作", "action": "操作",

View File

@ -324,7 +324,7 @@
"about.license.button": "查看", "about.license.button": "查看",
"about.contact.button": "郵件", "about.contact.button": "郵件",
"proxy.title": "代理地址", "proxy.title": "代理地址",
"tray.title": "顯示工作列圖示", "tray.title": "工作列圖示",
"theme.title": "主題", "theme.title": "主題",
"theme.dark": "深色主題", "theme.dark": "深色主題",
"theme.light": "淺色主題", "theme.light": "淺色主題",
@ -337,6 +337,7 @@
"topic.position.left": "左側", "topic.position.left": "左側",
"topic.position.right": "右側", "topic.position.right": "右側",
"topic.show.time": "顯示話題時間", "topic.show.time": "顯示話題時間",
"display.title": "顯示設定",
"shortcuts": { "shortcuts": {
"title": "快速方式", "title": "快速方式",
"action": "操作", "action": "操作",

View File

@ -399,13 +399,9 @@ const Textarea = styled(TextArea)`
overflow: auto; overflow: auto;
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
color: var(--color-text);
&.ant-input { &.ant-input {
line-height: 1.4; line-height: 1.4;
} }
&::placeholder {
color: var(--color-text-3);
}
` `
const Toolbar = styled.div` const Toolbar = styled.div`

View File

@ -8,6 +8,7 @@ import { useSettings } from '@renderer/hooks/useSettings'
import { SettingDivider, SettingRow, SettingRowTitle, SettingSubtitle } from '@renderer/pages/settings' import { SettingDivider, SettingRow, SettingRowTitle, SettingSubtitle } from '@renderer/pages/settings'
import { useAppDispatch } from '@renderer/store' import { useAppDispatch } from '@renderer/store'
import { import {
setClickAssistantToShowTopic,
setCodeShowLineNumbers, setCodeShowLineNumbers,
setCodeStyle, setCodeStyle,
setFontSize, setFontSize,
@ -17,7 +18,8 @@ import {
setPasteLongTextAsFile, setPasteLongTextAsFile,
setRenderInputMessageAsMarkdown, setRenderInputMessageAsMarkdown,
setShowInputEstimatedTokens, setShowInputEstimatedTokens,
setShowMessageDivider setShowMessageDivider,
setShowTopicTime
} from '@renderer/store/settings' } from '@renderer/store/settings'
import { Assistant, AssistantSettings } from '@renderer/types' import { Assistant, AssistantSettings } from '@renderer/types'
import { Col, Row, Select, Slider, Switch, Tooltip } from 'antd' import { Col, Row, Select, Slider, Switch, Tooltip } from 'antd'
@ -52,7 +54,11 @@ const SettingsTab: FC<Props> = (props) => {
pasteLongTextAsFile, pasteLongTextAsFile,
renderInputMessageAsMarkdown, renderInputMessageAsMarkdown,
codeShowLineNumbers, codeShowLineNumbers,
mathEngine mathEngine,
topicPosition,
showTopicTime,
clickAssistantToShowTopic,
setTopicPosition
} = useSettings() } = useSettings()
const onUpdateAssistantSettings = (settings: Partial<AssistantSettings>) => { const onUpdateAssistantSettings = (settings: Partial<AssistantSettings>) => {
@ -223,7 +229,7 @@ const SettingsTab: FC<Props> = (props) => {
<Select <Select
value={codeStyle} value={codeStyle}
onChange={(value) => dispatch(setCodeStyle(value))} onChange={(value) => dispatch(setCodeStyle(value))}
style={{ width: 160 }} style={{ width: 150 }}
size="small"> size="small">
{codeThemes.map((theme) => ( {codeThemes.map((theme) => (
<Select.Option key={theme} value={theme}> <Select.Option key={theme} value={theme}>
@ -320,6 +326,41 @@ const SettingsTab: FC<Props> = (props) => {
style={{ width: 100 }} style={{ width: 100 }}
/> />
</SettingRow> </SettingRow>
<SettingDivider />
<SettingSubtitle>{t('settings.display.title')}</SettingSubtitle>
<SettingDivider />
<SettingRow>
<SettingRowTitle>{t('settings.topic.position')}</SettingRowTitle>
<Select
defaultValue={topicPosition || 'right'}
style={{ width: 100 }}
onChange={setTopicPosition}
size="small"
options={[
{ value: 'left', label: t('settings.topic.position.left') },
{ value: 'right', label: t('settings.topic.position.right') }
]}
/>
</SettingRow>
<SettingDivider />
{topicPosition === 'left' && (
<>
<SettingRow>
<SettingRowTitle>{t('settings.advanced.click_assistant_switch_to_topics')}</SettingRowTitle>
<Switch
size="small"
checked={clickAssistantToShowTopic}
onChange={(checked) => dispatch(setClickAssistantToShowTopic(checked))}
/>
</SettingRow>
<SettingDivider />
</>
)}
<SettingRow>
<SettingRowTitle>{t('settings.topic.show.time')}</SettingRowTitle>
<Switch size="small" checked={showTopicTime} onChange={(checked) => dispatch(setShowTopicTime(checked))} />
</SettingRow>
<SettingDivider />
</Container> </Container>
) )
} }

View File

@ -2,7 +2,7 @@ import { isMac } from '@renderer/config/constant'
import { useSettings } from '@renderer/hooks/useSettings' import { useSettings } from '@renderer/hooks/useSettings'
import i18n from '@renderer/i18n' import i18n from '@renderer/i18n'
import { useAppDispatch } from '@renderer/store' 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 { setProxyUrl as _setProxyUrl } from '@renderer/store/settings'
import { LanguageVarious, ThemeMode } from '@renderer/types' import { LanguageVarious, ThemeMode } from '@renderer/types'
import { isValidProxyUrl } from '@renderer/utils' import { isValidProxyUrl } from '@renderer/utils'
@ -21,11 +21,7 @@ const GeneralSettings: FC = () => {
setTray, setTray,
tray, tray,
windowStyle, windowStyle,
topicPosition, setWindowStyle
showTopicTime,
clickAssistantToShowTopic,
setWindowStyle,
setTopicPosition
} = useSettings() } = useSettings()
const [proxyUrl, setProxyUrl] = useState<string | undefined>(storeProxyUrl) const [proxyUrl, setProxyUrl] = useState<string | undefined>(storeProxyUrl)
@ -115,41 +111,11 @@ const GeneralSettings: FC = () => {
/> />
</SettingRow> </SettingRow>
<SettingDivider /> <SettingDivider />
<SettingRow>
<SettingRowTitle>{t('settings.topic.position')}</SettingRowTitle>
<Select
defaultValue={topicPosition || 'right'}
style={{ width: 180 }}
onChange={setTopicPosition}
options={[
{ value: 'left', label: t('settings.topic.position.left') },
{ value: 'right', label: t('settings.topic.position.right') }
]}
/>
</SettingRow>
<SettingDivider />
<SettingRow> <SettingRow>
<SettingRowTitle>{t('settings.tray.title')}</SettingRowTitle> <SettingRowTitle>{t('settings.tray.title')}</SettingRowTitle>
<Switch checked={tray} onChange={(checked) => updateTray(checked)} /> <Switch checked={tray} onChange={(checked) => updateTray(checked)} />
</SettingRow> </SettingRow>
<SettingDivider /> <SettingDivider />
{topicPosition === 'left' && (
<>
<SettingRow style={{ minHeight: 32 }}>
<SettingRowTitle>{t('settings.advanced.click_assistant_switch_to_topics')}</SettingRowTitle>
<Switch
checked={clickAssistantToShowTopic}
onChange={(checked) => dispatch(setClickAssistantToShowTopic(checked))}
/>
</SettingRow>
<SettingDivider />
</>
)}
<SettingRow>
<SettingRowTitle>{t('settings.topic.show.time')}</SettingRowTitle>
<Switch checked={showTopicTime} onChange={(checked) => dispatch(setShowTopicTime(checked))} />
</SettingRow>
<SettingDivider />
</SettingContainer> </SettingContainer>
) )
} }