diff --git a/src/preload/index.ts b/src/preload/index.ts index b1c6a215e5..0c9e89ad76 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -455,9 +455,10 @@ const api = { isMaximized: (): Promise => ipcRenderer.invoke(IpcChannel.Windows_IsMaximized), onMaximizedChange: (callback: (isMaximized: boolean) => void): (() => void) => { const channel = IpcChannel.Windows_MaximizedChanged - ipcRenderer.on(channel, (_, isMaximized: boolean) => callback(isMaximized)) + const listener = (_: Electron.IpcRendererEvent, isMaximized: boolean) => callback(isMaximized) + ipcRenderer.on(channel, listener) return () => { - ipcRenderer.removeAllListeners(channel) + ipcRenderer.removeListener(channel, listener) } } } diff --git a/src/renderer/src/components/WindowControls/index.tsx b/src/renderer/src/components/WindowControls/index.tsx index 5b0b8c699b..c31476a881 100644 --- a/src/renderer/src/components/WindowControls/index.tsx +++ b/src/renderer/src/components/WindowControls/index.tsx @@ -2,17 +2,45 @@ import { isLinux, isWin } from '@renderer/config/constant' import { Tooltip } from 'antd' import { Minus, Square, X } from 'lucide-react' import { useEffect, useState } from 'react' +import { SVGProps } from 'react' import { useTranslation } from 'react-i18next' import { ControlButton, WindowControlsContainer } from './WindowControls.styled' -// Custom restore icon - two overlapping squares like Windows -const RestoreIcon: React.FC<{ size?: number }> = ({ size = 14 }) => ( - - {/* Back square (top-right) */} - - {/* Front square (bottom-left) */} - +interface WindowRestoreIconProps extends SVGProps { + size?: string | number +} + +export const WindowRestoreIcon = ({ size = '1.1em', ...props }: WindowRestoreIconProps) => ( + + + + ) @@ -67,7 +95,7 @@ const WindowControls: React.FC = () => { placement="bottom" mouseEnterDelay={DEFAULT_DELAY}> - {isMaximized ? : } + {isMaximized ? : } diff --git a/src/renderer/src/components/app/Navbar.tsx b/src/renderer/src/components/app/Navbar.tsx index 4f5d53a95f..5b1807451b 100644 --- a/src/renderer/src/components/app/Navbar.tsx +++ b/src/renderer/src/components/app/Navbar.tsx @@ -1,6 +1,7 @@ import { isLinux, isMac, isWin } from '@renderer/config/constant' import { useFullscreen } from '@renderer/hooks/useFullscreen' import useNavBackgroundColor from '@renderer/hooks/useNavBackgroundColor' +import { useRuntime } from '@renderer/hooks/useRuntime' import { useNavbarPosition } from '@renderer/hooks/useSettings' import type { FC, PropsWithChildren } from 'react' import type { HTMLAttributes } from 'react' @@ -13,6 +14,7 @@ type Props = PropsWithChildren & HTMLAttributes export const Navbar: FC = ({ children, ...props }) => { const backgroundColor = useNavBackgroundColor() const { isTopNavbar } = useNavbarPosition() + const { minappShow } = useRuntime() if (isTopNavbar) { return null @@ -23,7 +25,7 @@ export const Navbar: FC = ({ children, ...props }) => { {children} - {(isWin || isLinux) && } + {!isTopNavbar && !minappShow && } ) } diff --git a/src/renderer/src/pages/minapps/MinAppsPage.tsx b/src/renderer/src/pages/minapps/MinAppsPage.tsx index b824926ca7..db82bf43a3 100644 --- a/src/renderer/src/pages/minapps/MinAppsPage.tsx +++ b/src/renderer/src/pages/minapps/MinAppsPage.tsx @@ -1,7 +1,6 @@ -import { Navbar, NavbarMain, NavbarRight } from '@renderer/components/app/Navbar' +import { Navbar, NavbarMain } from '@renderer/components/app/Navbar' import App from '@renderer/components/MinApp/MinApp' import Scrollbar from '@renderer/components/Scrollbar' -import { isLinux, isWin } from '@renderer/config/constant' import { useMinapps } from '@renderer/hooks/useMinapps' import { useNavbarPosition } from '@renderer/hooks/useSettings' import { Button, Input } from 'antd' @@ -58,21 +57,13 @@ const AppsPage: FC = () => { value={search} onChange={(e) => setSearch(e.target.value)} /> - - } onClick={MinappSettingsPopup.show} /> - +