refactor(styles): adjust border-radius and padding in various components for improved UI consistency; update layout in settings pages

This commit is contained in:
Teo 2025-06-12 17:04:41 +08:00
parent 1124090d87
commit 73fced37b4
8 changed files with 61 additions and 63 deletions

View File

@ -207,7 +207,7 @@
max-height: 40vh; max-height: 40vh;
overflow-y: auto; overflow-y: auto;
border: 0.5px solid var(--color-border); border: 0.5px solid var(--color-border);
border-radius: 16px; border-radius: 12px;
.ant-dropdown-menu-item { .ant-dropdown-menu-item {
padding: 5px; padding: 5px;
@ -218,7 +218,7 @@
} }
.ant-popover-inner { .ant-popover-inner {
border: 0.5px solid var(--color-border); border: 0.5px solid var(--color-border);
border-radius: 16px; border-radius: 12px;
.ant-popover-inner-content { .ant-popover-inner-content {
max-height: 70vh; max-height: 70vh;
overflow-y: auto; overflow-y: auto;
@ -229,6 +229,25 @@
border: none; border: none;
} }
} }
.ant-modal {
.ant-modal-content {
border-radius: 12px !important;
border: 0.5px solid var(--color-border) !important;
padding: 0 0 8px 0 !important;
.ant-modal-header {
padding: 16px 16px 0 16px !important;
border-radius: 12px;
}
.ant-modal-body {
max-height: 80vh;
overflow-y: auto;
padding: 0 16px 0 16px;
}
.ant-modal-footer {
padding: 0 16px 8px 16px;
}
}
}
.ant-collapse { .ant-collapse {
border: 1px solid var(--color-border); border: 1px solid var(--color-border);
@ -238,7 +257,7 @@
} }
.ant-collapse-content { .ant-collapse-content {
border-top: 1px solid var(--color-border) !important; border-top: 0.5px solid var(--color-border) !important;
.ant-color-picker & { .ant-color-picker & {
border-top: none !important; border-top: none !important;
} }

View File

@ -43,10 +43,15 @@ const AntdProvider: FC<PropsWithChildren> = ({ children }) => {
paddingInline: 10 paddingInline: 10
}, },
Input: { Input: {
controlHeight: 30 controlHeight: 30,
colorBorder: 'var(--color-border)'
},
InputNumber: {
colorBorder: 'var(--color-border)'
}, },
Select: { Select: {
controlHeight: 30 controlHeight: 30,
colorBorder: 'var(--color-border)'
}, },
Collapse: { Collapse: {
headerBg: 'transparent' headerBg: 'transparent'

View File

@ -7,7 +7,7 @@ import { useTheme } from '@renderer/context/ThemeProvider'
import { useDefaultAssistant } from '@renderer/hooks/useAssistant' import { useDefaultAssistant } from '@renderer/hooks/useAssistant'
import { AssistantSettings as AssistantSettingsType } from '@renderer/types' import { AssistantSettings as AssistantSettingsType } from '@renderer/types'
import { getLeadingEmoji, modalConfirm } from '@renderer/utils' import { getLeadingEmoji, modalConfirm } from '@renderer/utils'
import { Button, Col, Input, InputNumber, Modal, Popover, Row, Slider, Switch, Tooltip } from 'antd' import { Button, Col, Flex, Input, InputNumber, Modal, Popover, Row, Slider, Switch, Tooltip } from 'antd'
import TextArea from 'antd/es/input/TextArea' import TextArea from 'antd/es/input/TextArea'
import { Dispatch, FC, SetStateAction, useState } from 'react' import { Dispatch, FC, SetStateAction, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
@ -145,7 +145,7 @@ const AssistantSettings: FC = () => {
justifyContent: 'space-between' justifyContent: 'space-between'
}}> }}>
{t('settings.assistant.model_params')} {t('settings.assistant.model_params')}
<Button onClick={onReset} style={{ width: 90 }}> <Button onClick={onReset} style={{ width: 60 }}>
{t('chat.settings.reset')} {t('chat.settings.reset')}
</Button> </Button>
</SettingSubtitle> </SettingSubtitle>
@ -156,7 +156,7 @@ const AssistantSettings: FC = () => {
</Tooltip> </Tooltip>
</Row> </Row>
<Row align="middle" style={{ marginBottom: 10 }} gutter={20}> <Row align="middle" style={{ marginBottom: 10 }} gutter={20}>
<Col span={21}> <Col span={20}>
<Slider <Slider
min={0} min={0}
max={2} max={2}
@ -167,7 +167,7 @@ const AssistantSettings: FC = () => {
step={0.01} step={0.01}
/> />
</Col> </Col>
<Col span={3}> <Col span={4}>
<InputNumber <InputNumber
min={0} min={0}
max={2} max={2}
@ -185,7 +185,7 @@ const AssistantSettings: FC = () => {
</Tooltip> </Tooltip>
</Row> </Row>
<Row align="middle" style={{ marginBottom: 10 }} gutter={20}> <Row align="middle" style={{ marginBottom: 10 }} gutter={20}>
<Col span={21}> <Col span={20}>
<Slider <Slider
min={0} min={0}
max={1} max={1}
@ -196,7 +196,7 @@ const AssistantSettings: FC = () => {
step={0.01} step={0.01}
/> />
</Col> </Col>
<Col span={3}> <Col span={4}>
<InputNumber min={0} max={1} step={0.01} value={topP} onChange={onTopPChange} style={{ width: '100%' }} /> <InputNumber min={0} max={1} step={0.01} value={topP} onChange={onTopPChange} style={{ width: '100%' }} />
</Col> </Col>
</Row> </Row>
@ -207,7 +207,7 @@ const AssistantSettings: FC = () => {
</Tooltip> </Tooltip>
</Row> </Row>
<Row align="middle" style={{ marginBottom: 10 }} gutter={20}> <Row align="middle" style={{ marginBottom: 10 }} gutter={20}>
<Col span={21}> <Col span={20}>
<Slider <Slider
min={0} min={0}
max={20} max={20}
@ -218,7 +218,7 @@ const AssistantSettings: FC = () => {
step={1} step={1}
/> />
</Col> </Col>
<Col span={3}> <Col span={4}>
<InputNumber <InputNumber
min={0} min={0}
max={20} max={20}
@ -229,7 +229,7 @@ const AssistantSettings: FC = () => {
/> />
</Col> </Col>
</Row> </Row>
<Row align="middle" style={{ marginBottom: 10 }}> <Flex justify="space-between" align="center" style={{ marginBottom: 10 }}>
<HStack alignItems="center"> <HStack alignItems="center">
<Label>{t('chat.settings.max_tokens')}</Label> <Label>{t('chat.settings.max_tokens')}</Label>
<Tooltip title={t('chat.settings.max_tokens.tip')}> <Tooltip title={t('chat.settings.max_tokens.tip')}>
@ -255,7 +255,7 @@ const AssistantSettings: FC = () => {
onUpdateAssistantSettings({ enableMaxTokens: enabled }) onUpdateAssistantSettings({ enableMaxTokens: enabled })
}} }}
/> />
</Row> </Flex>
{enableMaxTokens && ( {enableMaxTokens && (
<Row align="middle" gutter={20}> <Row align="middle" gutter={20}>
<Col span={24}> <Col span={24}>
@ -307,7 +307,7 @@ const PopupContainer: React.FC<Props> = ({ resolve }) => {
afterClose={onClose} afterClose={onClose}
transitionName="animation-move-down" transitionName="animation-move-down"
centered centered
width={800} width={500}
footer={null}> footer={null}>
<AssistantSettings /> <AssistantSettings />
</Modal> </Modal>

View File

@ -2,7 +2,7 @@ import { HStack } from '@renderer/components/Layout'
import { useSettings } from '@renderer/hooks/useSettings' import { useSettings } from '@renderer/hooks/useSettings'
import { useAppDispatch } from '@renderer/store' import { useAppDispatch } from '@renderer/store'
import { setEnableTopicNaming, setTopicNamingPrompt } from '@renderer/store/settings' import { setEnableTopicNaming, setTopicNamingPrompt } from '@renderer/store/settings'
import { Button, Divider, Input, Modal, Switch } from 'antd' import { Button, Input, Modal, Switch } from 'antd'
import { useState } from 'react' import { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
@ -45,14 +45,13 @@ const PopupContainer: React.FC<Props> = ({ resolve }) => {
afterClose={onClose} afterClose={onClose}
transitionName="animation-move-down" transitionName="animation-move-down"
footer={null} footer={null}
width={500}
centered> centered>
<Divider style={{ margin: '10px 0' }} />
<HStack style={{ gap: 10, marginBottom: 20, marginTop: 20 }} alignItems="center"> <HStack style={{ gap: 10, marginBottom: 20, marginTop: 20 }} alignItems="center">
<div>{t('settings.models.enable_topic_naming')}</div> <div>{t('settings.models.enable_topic_naming')}</div>
<Switch checked={enableTopicNaming} onChange={(v) => dispatch(setEnableTopicNaming(v))} /> <Switch checked={enableTopicNaming} onChange={(v) => dispatch(setEnableTopicNaming(v))} />
</HStack> </HStack>
<Divider style={{ margin: '10px 0' }} /> <div style={{ marginBottom: 8 }}>
<div style={{ marginBottom: 20 }}>
<div style={{ marginBottom: 10 }}>{t('settings.models.topic_naming_prompt')}</div> <div style={{ marginBottom: 10 }}>{t('settings.models.topic_naming_prompt')}</div>
<Input.TextArea <Input.TextArea
rows={4} rows={4}

View File

@ -121,7 +121,7 @@ const PopupContainer: React.FC<Props> = ({ title, provider, resolve }) => {
tooltip={t('settings.models.add.group_name.tooltip')}> tooltip={t('settings.models.add.group_name.tooltip')}>
<Input placeholder={t('settings.models.add.group_name.placeholder')} spellCheck={false} /> <Input placeholder={t('settings.models.add.group_name.placeholder')} spellCheck={false} />
</Form.Item> </Form.Item>
<Form.Item style={{ marginBottom: 0, textAlign: 'center' }}> <Form.Item style={{ marginBottom: 8, textAlign: 'center' }}>
<Flex justify="end" align="center" style={{ position: 'relative' }}> <Flex justify="end" align="center" style={{ position: 'relative' }}>
<Button type="primary" htmlType="submit" size="middle"> <Button type="primary" htmlType="submit" size="middle">
{t('settings.models.add.add_model')} {t('settings.models.add.add_model')}

View File

@ -253,10 +253,6 @@ const PopupContainer: React.FC<Props> = ({ provider: _provider, resolve }) => {
afterClose={onClose} afterClose={onClose}
footer={null} footer={null}
width="800px" width="800px"
styles={{
content: { padding: 0 },
header: { padding: '16px 22px 30px 22px' }
}}
transitionName="animation-move-down" transitionName="animation-move-down"
centered> centered>
<SearchContainer> <SearchContainer>
@ -378,8 +374,6 @@ const SearchContainer = styled.div`
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 15px; gap: 15px;
padding: 0 22px;
margin-top: -10px;
.ant-radio-group { .ant-radio-group {
display: flex; display: flex;
@ -396,12 +390,10 @@ const TopToolsWrapper = styled.div`
const ListContainer = styled.div` const ListContainer = styled.div`
height: calc(100vh - 300px); height: calc(100vh - 300px);
overflow-y: scroll; overflow-y: scroll;
padding: 0 6px 16px 6px;
margin-left: 16px;
margin-right: 10px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 16px; gap: 16px;
padding-right: 2px;
` `
const FlexColumn = styled.div` const FlexColumn = styled.div`

View File

@ -1,4 +1,3 @@
import { DownOutlined, UpOutlined } from '@ant-design/icons'
import CopyIcon from '@renderer/components/Icons/CopyIcon' import CopyIcon from '@renderer/components/Icons/CopyIcon'
import { import {
isEmbeddingModel, isEmbeddingModel,
@ -10,6 +9,7 @@ import {
import { Model, ModelType } from '@renderer/types' import { Model, ModelType } from '@renderer/types'
import { getDefaultGroupName } from '@renderer/utils' import { getDefaultGroupName } from '@renderer/utils'
import { Button, Checkbox, Divider, Flex, Form, Input, message, Modal } from 'antd' import { Button, Checkbox, Divider, Flex, Form, Input, message, Modal } from 'antd'
import { ChevronDown, ChevronUp } from 'lucide-react'
import { FC, useState } from 'react' import { FC, useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import styled from 'styled-components' import styled from 'styled-components'
@ -108,20 +108,25 @@ const ModelEditContent: FC<ModelEditContentProps> = ({ model, onUpdateModel, ope
tooltip={t('settings.models.add.group_name.tooltip')}> tooltip={t('settings.models.add.group_name.tooltip')}>
<Input placeholder={t('settings.models.add.group_name.placeholder')} spellCheck={false} /> <Input placeholder={t('settings.models.add.group_name.placeholder')} spellCheck={false} />
</Form.Item> </Form.Item>
<Form.Item style={{ marginBottom: 15, textAlign: 'center' }}> <Form.Item style={{ marginBottom: 8, textAlign: 'center' }}>
<Flex justify="space-between" align="center" style={{ position: 'relative' }}> <Flex justify="space-between" align="center" style={{ position: 'relative' }}>
<MoreSettingsRow onClick={() => setShowModelTypes(!showModelTypes)}> <Button
color="default"
variant="filled"
icon={showModelTypes ? <ChevronUp size={16} /> : <ChevronDown size={16} />}
iconPosition="end"
onClick={() => setShowModelTypes(!showModelTypes)}
style={{ color: 'var(--color-text-3)' }}>
{t('settings.moresetting')} {t('settings.moresetting')}
<ExpandIcon>{showModelTypes ? <UpOutlined /> : <DownOutlined />}</ExpandIcon> </Button>
</MoreSettingsRow>
<Button type="primary" htmlType="submit" size="middle"> <Button type="primary" htmlType="submit" size="middle">
{t('common.save')} {t('common.save')}
</Button> </Button>
</Flex> </Flex>
</Form.Item> </Form.Item>
{showModelTypes && ( {showModelTypes && (
<div> <div style={{ marginBottom: 8 }}>
<Divider style={{ margin: '0 0 15px 0' }} /> <Divider style={{ margin: '16px 0 16px 0' }} />
<TypeTitle>{t('models.type.select')}:</TypeTitle> <TypeTitle>{t('models.type.select')}:</TypeTitle>
{(() => { {(() => {
const defaultTypes = [ const defaultTypes = [
@ -206,26 +211,4 @@ const TypeTitle = styled.div`
font-weight: 600; font-weight: 600;
` `
const ExpandIcon = styled.div`
font-size: 12px;
color: var(--color-text-3);
`
const MoreSettingsRow = styled.div`
display: flex;
align-items: center;
gap: 8px;
color: var(--color-text-3);
cursor: pointer;
padding: 4px 8px;
border-radius: 4px;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
&:hover {
background-color: var(--color-background-soft);
}
`
export default ModelEditContent export default ModelEditContent

View File

@ -1,5 +1,5 @@
import { TopView } from '@renderer/components/TopView' import { TopView } from '@renderer/components/TopView'
import { Button, Form, FormProps, Input, Modal } from 'antd' import { Button, Flex, Form, FormProps, Input, Modal } from 'antd'
import { useState } from 'react' import { useState } from 'react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
@ -66,7 +66,7 @@ const PopupContainer: React.FC<Props> = ({ title, resolve }) => {
centered> centered>
<Form <Form
form={form} form={form}
labelCol={{ flex: '150px' }} labelCol={{ flex: '110px' }}
labelAlign="right" labelAlign="right"
colon={false} colon={false}
style={{ marginTop: 25 }} style={{ marginTop: 25 }}
@ -89,11 +89,11 @@ const PopupContainer: React.FC<Props> = ({ title, resolve }) => {
<Form.Item name="name" label={t('settings.websearch.subscribe_name')}> <Form.Item name="name" label={t('settings.websearch.subscribe_name')}>
<Input placeholder={t('settings.websearch.subscribe_name.placeholder')} spellCheck={false} /> <Input placeholder={t('settings.websearch.subscribe_name.placeholder')} spellCheck={false} />
</Form.Item> </Form.Item>
<Form.Item label=" "> <Flex justify="end" style={{ marginBottom: 8 }}>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
{t('settings.websearch.subscribe_add')} {t('settings.websearch.subscribe_add')}
</Button> </Button>
</Form.Item> </Flex>
</Form> </Form>
</Modal> </Modal>
) )