feat: update translations and display settings

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

View File

@ -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",

View File

@ -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": "操作",

View File

@ -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": "操作",

View File

@ -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`

View File

@ -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> = (props) => {
pasteLongTextAsFile,
renderInputMessageAsMarkdown,
codeShowLineNumbers,
mathEngine
mathEngine,
topicPosition,
showTopicTime,
clickAssistantToShowTopic,
setTopicPosition
} = useSettings()
const onUpdateAssistantSettings = (settings: Partial<AssistantSettings>) => {
@ -223,7 +229,7 @@ const SettingsTab: FC<Props> = (props) => {
<Select
value={codeStyle}
onChange={(value) => dispatch(setCodeStyle(value))}
style={{ width: 160 }}
style={{ width: 150 }}
size="small">
{codeThemes.map((theme) => (
<Select.Option key={theme} value={theme}>
@ -320,6 +326,41 @@ const SettingsTab: FC<Props> = (props) => {
style={{ width: 100 }}
/>
</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>
)
}

View File

@ -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<string | undefined>(storeProxyUrl)
@ -115,41 +111,11 @@ const GeneralSettings: FC = () => {
/>
</SettingRow>
<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>
<SettingRowTitle>{t('settings.tray.title')}</SettingRowTitle>
<Switch checked={tray} onChange={(checked) => updateTray(checked)} />
</SettingRow>
<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>
)
}