mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 07:19:02 +08:00
feat: add files sidebar menu
This commit is contained in:
parent
7330391813
commit
3acc24d40e
@ -9,6 +9,7 @@ import AntdProvider from './context/AntdProvider'
|
|||||||
import { ThemeProvider } from './context/ThemeProvider'
|
import { ThemeProvider } from './context/ThemeProvider'
|
||||||
import AgentsPage from './pages/agents/AgentsPage'
|
import AgentsPage from './pages/agents/AgentsPage'
|
||||||
import AppsPage from './pages/apps/AppsPage'
|
import AppsPage from './pages/apps/AppsPage'
|
||||||
|
import FilesPage from './pages/files/FilesPage'
|
||||||
import HomePage from './pages/home/HomePage'
|
import HomePage from './pages/home/HomePage'
|
||||||
import SettingsPage from './pages/settings/SettingsPage'
|
import SettingsPage from './pages/settings/SettingsPage'
|
||||||
import TranslatePage from './pages/translate/TranslatePage'
|
import TranslatePage from './pages/translate/TranslatePage'
|
||||||
@ -24,6 +25,7 @@ function App(): JSX.Element {
|
|||||||
<Sidebar />
|
<Sidebar />
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<HomePage />} />
|
<Route path="/" element={<HomePage />} />
|
||||||
|
<Route path="/files" element={<FilesPage />} />
|
||||||
<Route path="/agents" element={<AgentsPage />} />
|
<Route path="/agents" element={<AgentsPage />} />
|
||||||
<Route path="/translate" element={<TranslatePage />} />
|
<Route path="/translate" element={<TranslatePage />} />
|
||||||
<Route path="/apps" element={<AppsPage />} />
|
<Route path="/apps" element={<AppsPage />} />
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { TranslationOutlined } from '@ant-design/icons'
|
import { FolderOutlined, TranslationOutlined } from '@ant-design/icons'
|
||||||
import { isMac } from '@renderer/config/constant'
|
import { isMac } from '@renderer/config/constant'
|
||||||
import { isLocalAi, UserAvatar } from '@renderer/config/env'
|
import { isLocalAi, UserAvatar } from '@renderer/config/env'
|
||||||
import useAvatar from '@renderer/hooks/useAvatar'
|
import useAvatar from '@renderer/hooks/useAvatar'
|
||||||
@ -51,6 +51,11 @@ const Sidebar: FC = () => {
|
|||||||
<i className="iconfont icon-chat"></i>
|
<i className="iconfont icon-chat"></i>
|
||||||
</Icon>
|
</Icon>
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
|
<StyledLink onClick={() => to('/files')}>
|
||||||
|
<Icon className={isRoute('/files')}>
|
||||||
|
<FolderOutlined />
|
||||||
|
</Icon>
|
||||||
|
</StyledLink>
|
||||||
<StyledLink onClick={() => to('/agents')}>
|
<StyledLink onClick={() => to('/agents')}>
|
||||||
<Icon className={isRoute('/agents')}>
|
<Icon className={isRoute('/agents')}>
|
||||||
<i className="iconfont icon-business-smart-assistant"></i>
|
<i className="iconfont icon-business-smart-assistant"></i>
|
||||||
|
|||||||
@ -102,6 +102,9 @@ const resources = {
|
|||||||
'message.new.context': 'New Context',
|
'message.new.context': 'New Context',
|
||||||
'assistant.search.placeholder': 'Search'
|
'assistant.search.placeholder': 'Search'
|
||||||
},
|
},
|
||||||
|
files: {
|
||||||
|
title: 'Files'
|
||||||
|
},
|
||||||
agents: {
|
agents: {
|
||||||
title: 'Assistants',
|
title: 'Assistants',
|
||||||
my_agents: 'My Assistants',
|
my_agents: 'My Assistants',
|
||||||
@ -358,6 +361,9 @@ const resources = {
|
|||||||
'message.new.context': '清除上下文',
|
'message.new.context': '清除上下文',
|
||||||
'assistant.search.placeholder': '搜索'
|
'assistant.search.placeholder': '搜索'
|
||||||
},
|
},
|
||||||
|
files: {
|
||||||
|
title: '文件'
|
||||||
|
},
|
||||||
agents: {
|
agents: {
|
||||||
title: '智能体',
|
title: '智能体',
|
||||||
my_agents: '我的智能体',
|
my_agents: '我的智能体',
|
||||||
|
|||||||
40
src/renderer/src/pages/files/FilesPage.tsx
Normal file
40
src/renderer/src/pages/files/FilesPage.tsx
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import { Navbar, NavbarCenter } from '@renderer/components/app/Navbar'
|
||||||
|
import { Button } from 'antd'
|
||||||
|
import { FC } from 'react'
|
||||||
|
import { useTranslation } from 'react-i18next'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
|
||||||
|
const FilesPage: FC = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container>
|
||||||
|
<Navbar>
|
||||||
|
<NavbarCenter style={{ borderRight: 'none' }}>{t('files.title')}</NavbarCenter>
|
||||||
|
</Navbar>
|
||||||
|
<ContentContainer>
|
||||||
|
<Button>添加文件</Button>
|
||||||
|
</ContentContainer>
|
||||||
|
</Container>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const Container = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
`
|
||||||
|
|
||||||
|
const ContentContainer = styled.div`
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100%;
|
||||||
|
overflow-y: scroll;
|
||||||
|
background-color: var(--color-background);
|
||||||
|
padding: 20px;
|
||||||
|
`
|
||||||
|
|
||||||
|
export default FilesPage
|
||||||
@ -26,6 +26,7 @@ import { CSSProperties, FC, useCallback, useEffect, useMemo, useRef, useState }
|
|||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
|
||||||
|
import AttachmentButton from './AttachmentButton'
|
||||||
import SendMessageButton from './SendMessageButton'
|
import SendMessageButton from './SendMessageButton'
|
||||||
import TokenCount from './TokenCount'
|
import TokenCount from './TokenCount'
|
||||||
|
|
||||||
@ -260,7 +261,7 @@ const Inputbar: FC<Props> = ({ assistant, setActiveTopic }) => {
|
|||||||
<ControlOutlined />
|
<ControlOutlined />
|
||||||
</ToolbarButton>
|
</ToolbarButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
{/* <AttachmentButton files={files} setFiles={setFiles} ToolbarButton={ToolbarButton} /> */}
|
<AttachmentButton files={files} setFiles={setFiles} ToolbarButton={ToolbarButton} />
|
||||||
<Tooltip placement="top" title={expended ? t('chat.input.collapse') : t('chat.input.expand')} arrow>
|
<Tooltip placement="top" title={expended ? t('chat.input.collapse') : t('chat.input.expand')} arrow>
|
||||||
<ToolbarButton type="text" onClick={onToggleExpended}>
|
<ToolbarButton type="text" onClick={onToggleExpended}>
|
||||||
{expended ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
{expended ? <FullscreenExitOutlined /> : <FullscreenOutlined />}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user