mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-11 08:19:01 +08:00
refactor: add Linux support for margin adjustments in MinappPopupConainer and McpSettingsNavbar (#5673)
* refactor: add Linux support for margin adjustments in MinappPopupContainer and McpSettingsNavbar * refactor: adjust margin and padding for Linux support in MinappPopupContainer and McpSettingsNavbar * refactor: enhance Linux support in MinappPopupContainer by updating button group class condition
This commit is contained in:
parent
470d8710f3
commit
2f4ed1378f
@ -8,7 +8,7 @@ import {
|
|||||||
PushpinOutlined,
|
PushpinOutlined,
|
||||||
ReloadOutlined
|
ReloadOutlined
|
||||||
} from '@ant-design/icons'
|
} from '@ant-design/icons'
|
||||||
import { isMac, isWindows } from '@renderer/config/constant'
|
import { isLinux, isMac, isWindows } from '@renderer/config/constant'
|
||||||
import { DEFAULT_MIN_APPS } from '@renderer/config/minapps'
|
import { DEFAULT_MIN_APPS } from '@renderer/config/minapps'
|
||||||
import { useBridge } from '@renderer/hooks/useBridge'
|
import { useBridge } from '@renderer/hooks/useBridge'
|
||||||
import { useMinappPopup } from '@renderer/hooks/useMinappPopup'
|
import { useMinappPopup } from '@renderer/hooks/useMinappPopup'
|
||||||
@ -285,7 +285,7 @@ const MinappPopupContainer: React.FC = () => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
<Spacer />
|
<Spacer />
|
||||||
<ButtonsGroup className={isWindows ? 'windows' : ''}>
|
<ButtonsGroup className={isWindows || isLinux ? 'windows' : ''}>
|
||||||
<Tooltip title={t('minapp.popup.refresh')} mouseEnterDelay={0.8} placement="bottom">
|
<Tooltip title={t('minapp.popup.refresh')} mouseEnterDelay={0.8} placement="bottom">
|
||||||
<Button onClick={() => handleReload(appInfo.id)}>
|
<Button onClick={() => handleReload(appInfo.id)}>
|
||||||
<ReloadOutlined />
|
<ReloadOutlined />
|
||||||
@ -421,7 +421,7 @@ const ButtonsGroup = styled.div`
|
|||||||
gap: 5px;
|
gap: 5px;
|
||||||
-webkit-app-region: no-drag;
|
-webkit-app-region: no-drag;
|
||||||
&.windows {
|
&.windows {
|
||||||
margin-right: ${isWindows ? '130px' : 0};
|
margin-right: ${isWindows ? '130px' : isLinux ? '100px' : 0};
|
||||||
background-color: var(--color-background-mute);
|
background-color: var(--color-background-mute);
|
||||||
border-radius: 50px;
|
border-radius: 50px;
|
||||||
padding: 0 3px;
|
padding: 0 3px;
|
||||||
|
|||||||
@ -26,9 +26,17 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ children, defaultT
|
|||||||
|
|
||||||
const toggleTheme = () => {
|
const toggleTheme = () => {
|
||||||
// 主题顺序是light, dark, auto, 所以需要先判断当前主题,然后取下一个主题
|
// 主题顺序是light, dark, auto, 所以需要先判断当前主题,然后取下一个主题
|
||||||
const nextTheme =
|
switch (theme) {
|
||||||
theme === ThemeMode.light ? ThemeMode.dark : theme === ThemeMode.dark ? ThemeMode.auto : ThemeMode.light
|
case ThemeMode.light:
|
||||||
setTheme(nextTheme)
|
setTheme(ThemeMode.dark)
|
||||||
|
break
|
||||||
|
case ThemeMode.dark:
|
||||||
|
setTheme(ThemeMode.auto)
|
||||||
|
break
|
||||||
|
case ThemeMode.auto:
|
||||||
|
setTheme(ThemeMode.light)
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { NavbarRight } from '@renderer/components/app/Navbar'
|
import { NavbarRight } from '@renderer/components/app/Navbar'
|
||||||
import { HStack } from '@renderer/components/Layout'
|
import { HStack } from '@renderer/components/Layout'
|
||||||
import { isWindows } from '@renderer/config/constant'
|
import { isLinux, isWindows } from '@renderer/config/constant'
|
||||||
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'
|
||||||
@ -73,7 +73,7 @@ export const McpSettingsNavbar = () => {
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavbarRight style={{ paddingRight: isWindows ? 150 : 12 }}>
|
<NavbarRight style={{ paddingRight: isWindows ? 150 : isLinux ? 120 : 12 }}>
|
||||||
<HStack alignItems="center" gap={5}>
|
<HStack alignItems="center" gap={5}>
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user