mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-05 04:19:02 +08:00
style(toggleTheme): 将主题切换按钮移到左下角菜单栏中
This commit is contained in:
parent
89dd35c98d
commit
d4ae321cd2
@ -1,6 +1,7 @@
|
|||||||
import { FileSearchOutlined, FolderOutlined, PictureOutlined, TranslationOutlined } from '@ant-design/icons'
|
import { FileSearchOutlined, FolderOutlined, PictureOutlined, 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 { useTheme } from '@renderer/context/ThemeProvider'
|
||||||
import useAvatar from '@renderer/hooks/useAvatar'
|
import useAvatar from '@renderer/hooks/useAvatar'
|
||||||
import { useRuntime } from '@renderer/hooks/useRuntime'
|
import { useRuntime } from '@renderer/hooks/useRuntime'
|
||||||
import { useSettings } from '@renderer/hooks/useSettings'
|
import { useSettings } from '@renderer/hooks/useSettings'
|
||||||
@ -21,6 +22,7 @@ const Sidebar: FC = () => {
|
|||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const navigate = useNavigate()
|
const navigate = useNavigate()
|
||||||
const { windowStyle } = useSettings()
|
const { windowStyle } = useSettings()
|
||||||
|
const { theme, toggleTheme } = useTheme()
|
||||||
|
|
||||||
const isRoute = (path: string): string => (pathname === path ? 'active' : '')
|
const isRoute = (path: string): string => (pathname === path ? 'active' : '')
|
||||||
const isRoutes = (path: string): string => (pathname.startsWith(path) ? 'active' : '')
|
const isRoutes = (path: string): string => (pathname.startsWith(path) ? 'active' : '')
|
||||||
@ -86,6 +88,14 @@ const Sidebar: FC = () => {
|
|||||||
</Menus>
|
</Menus>
|
||||||
</MainMenus>
|
</MainMenus>
|
||||||
<Menus onClick={MinApp.onClose}>
|
<Menus onClick={MinApp.onClose}>
|
||||||
|
<Icon onClick={() => toggleTheme()}>
|
||||||
|
{theme === 'dark' ? (
|
||||||
|
<i className="iconfont icon-theme icon-dark1" />
|
||||||
|
) : (
|
||||||
|
<i className="iconfont icon-theme icon-theme-light" />
|
||||||
|
)}
|
||||||
|
</Icon>
|
||||||
|
|
||||||
<StyledLink onClick={() => to(isLocalAi ? '/settings/assistant' : '/settings/provider')}>
|
<StyledLink onClick={() => to(isLocalAi ? '/settings/assistant' : '/settings/provider')}>
|
||||||
<Icon className={pathname.startsWith('/settings') ? 'active' : ''}>
|
<Icon className={pathname.startsWith('/settings') ? 'active' : ''}>
|
||||||
<i className="iconfont icon-setting" />
|
<i className="iconfont icon-setting" />
|
||||||
|
|||||||
@ -63,12 +63,6 @@ const HeaderNavbar: FC<Props> = ({ activeAssistant }) => {
|
|||||||
<SelectModelButton assistant={assistant} />
|
<SelectModelButton assistant={assistant} />
|
||||||
</HStack>
|
</HStack>
|
||||||
<HStack alignItems="center">
|
<HStack alignItems="center">
|
||||||
<ThemeSwitch
|
|
||||||
checkedChildren={<i className="iconfont icon-theme icon-dark1" />}
|
|
||||||
unCheckedChildren={<i className="iconfont icon-theme icon-theme-light" />}
|
|
||||||
checked={theme === 'dark'}
|
|
||||||
onChange={toggleTheme}
|
|
||||||
/>
|
|
||||||
{topicPosition === 'right' && (
|
{topicPosition === 'right' && (
|
||||||
<NewButton onClick={toggleShowTopics}>
|
<NewButton onClick={toggleShowTopics}>
|
||||||
<i className={`iconfont icon-${showTopics ? 'show' : 'hide'}-sidebar`} />
|
<i className={`iconfont icon-${showTopics ? 'show' : 'hide'}-sidebar`} />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user