This commit is contained in:
kangfenmao 2024-09-04 13:26:51 +08:00
parent 14acd45927
commit 563472f3a9
7 changed files with 40 additions and 49 deletions

View File

@ -1,6 +1,6 @@
@font-face {
font-family: 'iconfont'; /* Project id 4563475 */
src: url('iconfont.woff2?t=1724204739157') format('woff2');
src: url('iconfont.woff2?t=1725424338696') format('woff2');
}
.iconfont {
@ -11,6 +11,10 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-inbox:before {
content: '\e869';
}
.icon-business-smart-assistant:before {
content: '\e601';
}

View File

@ -68,6 +68,7 @@ const resources = {
'topics.edit.placeholder': 'Enter new name',
'topics.delete.all.title': 'Delete all topics',
'topics.delete.all.content': 'Are you sure you want to delete all topics?',
'topics.list': 'Topic List',
'input.new_topic': 'New Topic',
'input.clear': 'Clear',
'input.expand': 'Expand',
@ -312,6 +313,7 @@ const resources = {
'topics.edit.placeholder': '输入新名称',
'topics.delete.all.title': '删除所有话题',
'topics.delete.all.content': '确定要删除所有话题吗?',
'topics.list': '话题列表',
'input.new_topic': '新话题',
'input.clear': '清除',
'input.expand': '展开',

View File

@ -121,7 +121,7 @@ const Assistants: FC<Props> = ({
onClick={() => onSwitchAssistant(assistant)}
className={assistant.id === activeAssistant?.id ? 'active' : ''}>
<AssistantName className="name">{assistant.name || t('chat.default.name')}</AssistantName>
<Tooltip arrow title="话题列表" placement="bottom" mouseEnterDelay={0.5}>
<Tooltip arrow title={t('chat.topics.list')} placement="bottom" mouseEnterDelay={0.5}>
<ArrowRightButton className="arrow-button" onClick={() => setShowTopics(true)}>
<ArrowRightOutlined />
</ArrowRightButton>
@ -180,9 +180,6 @@ const AssistantItem = styled.div`
opacity: 1;
color: var(--color-text-2);
}
.name {
font-weight: 500;
}
}
`
@ -192,6 +189,7 @@ const AssistantName = styled.div`
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
font-size: 13px;
`
const ArrowRightButton = styled.div`

View File

@ -1,4 +1,4 @@
import { ArrowLeftOutlined } from '@ant-design/icons'
import { ArrowLeftOutlined, UnorderedListOutlined } from '@ant-design/icons'
import { Navbar, NavbarCenter, NavbarLeft } from '@renderer/components/app/Navbar'
import { HStack } from '@renderer/components/Layout'
import { isMac, isWindows } from '@renderer/config/constant'
@ -64,17 +64,17 @@ const HomePage: FC = () => {
{showAssistants && (
<NavbarLeft
style={{ justifyContent: 'space-between', alignItems: 'center', borderRight: 'none', padding: '0 8px' }}>
<NavigtaionBack className={showTopics ? 'back' : ''} onClick={() => setShowTopics(false)}>
{showTopics && <ArrowLeftOutlined />}
<NavigationBackTitle>{showTopics ? t('common.back') : t('common.chat')}</NavigationBackTitle>
</NavigtaionBack>
<NewButton onClick={() => setShowTopics(!showTopics)} className="back-button">
{showTopics ? <ArrowLeftOutlined /> : <UnorderedListOutlined />}
<BackText>{showTopics ? t('common.assistant') : t('chat.topics.title')}</BackText>
</NewButton>
<NewButton onClick={onCreate}>
<i className="iconfont icon-a-addchat"></i>
</NewButton>
</NavbarLeft>
)}
<NavbarCenter
style={{ paddingLeft: isMac ? 16 : 8, justifyContent: 'space-between', paddingRight: isWindows ? 140 : 12 }}>
style={{ justifyContent: 'space-between', paddingLeft: isMac ? 16 : 8, paddingRight: isWindows ? 135 : 12 }}>
<HStack alignItems="center">
<AssistantName>{activeAssistant?.name || t('chat.default.name')}</AssistantName>
<SelectModelButton assistant={activeAssistant} />
@ -118,45 +118,20 @@ const ContentContainer = styled.div`
background-color: var(--color-background);
`
const NavigtaionBack = styled.div`
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
gap: 10px;
margin-left: ${isMac ? '10px' : 0};
-webkit-app-region: none;
transition: all 0.2s ease-in-out;
transition: opacity 0.2s ease-in-out;
padding: 3px 8px;
border-radius: 6px;
&.back {
cursor: pointer;
&:hover {
background-color: var(--color-background-mute);
color: var(--color-text-1);
}
}
`
const NavigationBackTitle = styled.div`
font-size: 14px;
font-weight: 800;
font-family: Ubuntu;
`
const AssistantName = styled.span`
margin-left: 5px;
margin-right: 10px;
font-family: Ubuntu;
font-weight: 800;
font-size: 13px;
font-weight: 500;
`
export const NewButton = styled.div`
-webkit-app-region: none;
border-radius: 4px;
width: 30px;
padding: 0 5px;
height: 30px;
gap: 5px;
display: flex;
flex-direction: row;
justify-content: center;
@ -173,6 +148,19 @@ export const NewButton = styled.div`
.icon-hidesidebarhoriz {
font-size: 17px;
}
&.back-button {
margin-left: ${isMac ? '8px' : 0};
.anticon {
font-size: 16px;
}
.anticon-arrow-left {
font-size: 14px;
}
&:hover {
background-color: var(--color-background-mute);
color: var(--color-icon-white);
}
}
&:hover {
background-color: var(--color-background-mute);
cursor: pointer;
@ -180,6 +168,11 @@ export const NewButton = styled.div`
}
`
const BackText = styled.span`
font-size: 12px;
font-weight: 400;
`
const ThemeSwitch = styled(Switch)`
-webkit-app-region: none;
margin-right: 10px;

View File

@ -109,7 +109,7 @@ const Topics: FC<Props> = ({ assistant: _assistant, activeTopic, setActiveTopic
</Dropdown>
)}
</DragableList>
{assistant.topics.length > 20 && (
{assistant.topics.length > 10 && (
<Footer>
<Button style={{ width: '100%' }} onClick={onDeleteAll}>
{t('chat.topics.delete.all.title')}
@ -128,7 +128,7 @@ const Container = styled.div`
`
const TopicListItem = styled.div`
padding: 6px 10px;
padding: 5px 10px;
margin: 0 10px;
cursor: pointer;
border-radius: 4px;
@ -142,7 +142,6 @@ const TopicListItem = styled.div`
}
&.active {
background-color: var(--color-background-mute);
font-weight: 500;
}
`

View File

@ -7,10 +7,9 @@ import { useAppDispatch } from '@renderer/store'
import { setLanguage, setUserName, ThemeMode } from '@renderer/store/settings'
import { setProxyUrl as _setProxyUrl } from '@renderer/store/settings'
import { isValidProxyUrl } from '@renderer/utils'
import { Avatar, Button, Input, Select } from 'antd'
import { Button, Input, Select } from 'antd'
import { FC, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
import { SettingContainer, SettingDivider, SettingRow, SettingRowTitle, SettingTitle } from '.'
@ -128,8 +127,4 @@ const GeneralSettings: FC = () => {
)
}
const UserAvatar = styled(Avatar)`
cursor: pointer;
`
export default GeneralSettings