mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-10 07:19:02 +08:00
fix: adjust navbar and title bar dimensions, update icon handling
This commit is contained in:
parent
75b9e2f408
commit
684367bf7c
@ -11,13 +11,13 @@ if (isDev) {
|
|||||||
export const DATA_PATH = getDataPath()
|
export const DATA_PATH = getDataPath()
|
||||||
|
|
||||||
export const titleBarOverlayDark = {
|
export const titleBarOverlayDark = {
|
||||||
height: 40,
|
height: 42,
|
||||||
color: 'rgba(255,255,255,0)',
|
color: 'rgba(255,255,255,0)',
|
||||||
symbolColor: '#fff'
|
symbolColor: '#fff'
|
||||||
}
|
}
|
||||||
|
|
||||||
export const titleBarOverlayLight = {
|
export const titleBarOverlayLight = {
|
||||||
height: 40,
|
height: 42,
|
||||||
color: 'rgba(255,255,255,0)',
|
color: 'rgba(255,255,255,0)',
|
||||||
symbolColor: '#000'
|
symbolColor: '#000'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export class WindowService {
|
|||||||
titleBarOverlay: nativeTheme.shouldUseDarkColors ? titleBarOverlayDark : titleBarOverlayLight,
|
titleBarOverlay: nativeTheme.shouldUseDarkColors ? titleBarOverlayDark : titleBarOverlayLight,
|
||||||
backgroundColor: isMac ? undefined : nativeTheme.shouldUseDarkColors ? '#181818' : '#FFFFFF',
|
backgroundColor: isMac ? undefined : nativeTheme.shouldUseDarkColors ? '#181818' : '#FFFFFF',
|
||||||
darkTheme: nativeTheme.shouldUseDarkColors,
|
darkTheme: nativeTheme.shouldUseDarkColors,
|
||||||
trafficLightPosition: { x: 15, y: 12 },
|
trafficLightPosition: { x: 12, y: 12 },
|
||||||
...(isLinux ? { icon } : {}),
|
...(isLinux ? { icon } : {}),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: join(__dirname, '../preload/index.js'),
|
preload: join(__dirname, '../preload/index.js'),
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
--navbar-background-mac: rgba(20, 20, 20, 0.55);
|
--navbar-background-mac: rgba(20, 20, 20, 0.55);
|
||||||
--navbar-background: #1f1f1f;
|
--navbar-background: #1f1f1f;
|
||||||
|
|
||||||
--navbar-height: 45px;
|
--navbar-height: 42px;
|
||||||
--sidebar-width: 50px;
|
--sidebar-width: 50px;
|
||||||
--status-bar-height: 40px;
|
--status-bar-height: 40px;
|
||||||
--input-bar-height: 100px;
|
--input-bar-height: 100px;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { isLinux, isMac, isWindows } from '@renderer/config/constant'
|
import { isLinux, isMac, isWindows } from '@renderer/config/constant'
|
||||||
import { useFullscreen } from '@renderer/hooks/useFullscreen'
|
import { useFullscreen } from '@renderer/hooks/useFullscreen'
|
||||||
import { Button } from 'antd'
|
import { Button } from 'antd'
|
||||||
import { X } from 'lucide-react'
|
import { ChevronDown, X } from 'lucide-react'
|
||||||
import type { FC, PropsWithChildren } from 'react'
|
import type { FC, PropsWithChildren } from 'react'
|
||||||
import type { HTMLAttributes } from 'react'
|
import type { HTMLAttributes } from 'react'
|
||||||
import { useNavigate } from 'react-router-dom'
|
import { useNavigate } from 'react-router-dom'
|
||||||
@ -28,16 +28,46 @@ export const NavbarRight: FC<Props> = ({ children, ...props }) => {
|
|||||||
|
|
||||||
export const NavbarMain: FC<Props> = ({ children, ...props }) => {
|
export const NavbarMain: FC<Props> = ({ children, ...props }) => {
|
||||||
const isFullscreen = useFullscreen()
|
const isFullscreen = useFullscreen()
|
||||||
const navigate = useNavigate()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavbarMainContainer {...props} $isFullscreen={isFullscreen}>
|
<NavbarMainContainer {...props} $isFullscreen={isFullscreen}>
|
||||||
|
<CloseIconWindows />
|
||||||
{children}
|
{children}
|
||||||
<Button type="text" icon={<X size={18} />} onClick={() => navigate('/')} className="nodrag"></Button>
|
<CloseIconMac />
|
||||||
</NavbarMainContainer>
|
</NavbarMainContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CloseIconMac = () => {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
if (!isMac) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return <Button type="text" icon={<X size={18} />} onClick={() => navigate('/')} className="nodrag" />
|
||||||
|
}
|
||||||
|
|
||||||
|
const CloseIconWindows = () => {
|
||||||
|
const navigate = useNavigate()
|
||||||
|
|
||||||
|
if (isMac) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
size="small"
|
||||||
|
type="default"
|
||||||
|
shape="circle"
|
||||||
|
icon={<ChevronDown size={16} />}
|
||||||
|
onClick={() => navigate('/')}
|
||||||
|
className="nodrag"
|
||||||
|
style={{ marginRight: 5 }}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
const NavbarContainer = styled.div`
|
const NavbarContainer = styled.div`
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@ -163,7 +163,7 @@ const NavbarContainer = styled.div<{ $isFullscreen: boolean; $showSidebar: boole
|
|||||||
max-height: var(--navbar-height);
|
max-height: var(--navbar-height);
|
||||||
min-height: var(--navbar-height);
|
min-height: var(--navbar-height);
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding-left: ${({ $showSidebar }) => (isMac && !$showSidebar ? '70px' : '10px')};
|
padding-left: ${({ $showSidebar }) => (isMac && !$showSidebar ? '70px' : '20px')};
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: var(--color-text-1);
|
color: var(--color-text-1);
|
||||||
padding-right: ${({ $isFullscreen }) => ($isFullscreen ? '12px' : isWindows ? '140px' : isLinux ? '120px' : '12px')};
|
padding-right: ${({ $isFullscreen }) => ($isFullscreen ? '12px' : isWindows ? '140px' : isLinux ? '120px' : '12px')};
|
||||||
|
|||||||
@ -1,7 +1,4 @@
|
|||||||
import { NavbarRight } from '@renderer/components/app/Navbar'
|
|
||||||
import { HStack } from '@renderer/components/Layout'
|
import { HStack } from '@renderer/components/Layout'
|
||||||
import { isLinux, isWindows } from '@renderer/config/constant'
|
|
||||||
import { useFullscreen } from '@renderer/hooks/useFullscreen'
|
|
||||||
import { Button, Dropdown, Menu, type MenuProps } from 'antd'
|
import { Button, Dropdown, Menu, type MenuProps } from 'antd'
|
||||||
import { ChevronDown, Search } from 'lucide-react'
|
import { ChevronDown, Search } from 'lucide-react'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
@ -74,29 +71,27 @@ export const McpSettingsNavbar = () => {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavbarRight style={{ paddingRight: useFullscreen() ? '12px' : isWindows ? 150 : isLinux ? 120 : 12 }}>
|
<HStack alignItems="center" gap={5}>
|
||||||
<HStack alignItems="center" gap={5}>
|
<Button
|
||||||
|
size="small"
|
||||||
|
type="text"
|
||||||
|
onClick={() => navigate('/mcp-servers/npx-search')}
|
||||||
|
icon={<Search size={14} />}
|
||||||
|
className="nodrag"
|
||||||
|
style={{ fontSize: 13, height: 28, borderRadius: 20 }}>
|
||||||
|
{t('settings.mcp.searchNpx')}
|
||||||
|
</Button>
|
||||||
|
<Dropdown menu={{ items: resourceMenuItems }} trigger={['click']}>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
type="text"
|
type="text"
|
||||||
onClick={() => navigate('/mcp-servers/npx-search')}
|
|
||||||
icon={<Search size={14} />}
|
|
||||||
className="nodrag"
|
className="nodrag"
|
||||||
style={{ fontSize: 13, height: 28, borderRadius: 20 }}>
|
style={{ fontSize: 13, height: 28, borderRadius: 20, display: 'flex', alignItems: 'center' }}>
|
||||||
{t('settings.mcp.searchNpx')}
|
{t('settings.mcp.findMore')}
|
||||||
|
<ChevronDown size={16} />
|
||||||
</Button>
|
</Button>
|
||||||
<Dropdown menu={{ items: resourceMenuItems }} trigger={['click']}>
|
</Dropdown>
|
||||||
<Button
|
<InstallNpxUv mini />
|
||||||
size="small"
|
</HStack>
|
||||||
type="text"
|
|
||||||
className="nodrag"
|
|
||||||
style={{ fontSize: 13, height: 28, borderRadius: 20, display: 'flex', alignItems: 'center' }}>
|
|
||||||
{t('settings.mcp.findMore')}
|
|
||||||
<ChevronDown size={16} />
|
|
||||||
</Button>
|
|
||||||
</Dropdown>
|
|
||||||
<InstallNpxUv mini />
|
|
||||||
</HStack>
|
|
||||||
</NavbarRight>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user