Files
clash-verge-rev/src/hooks/use-window.ts
T
Tunglies e56711b2db refactor(frontend): drop unused params, props and api surface
Remove the never-read _revalidate argument of mutateVerge and its 16
call-site placeholders, seven never-passed props of the split chip
editor, the unconsumed refreshDecorated context member, the now-orphaned
toggleFullscreen control, the unused translate argument of the notice
message handler, the reserved-but-unset ServiceConfig.timeout field and
unreachable branches in parseNoticeExtras.
2026-10-28 06:30:46 +08:00

35 lines
860 B
TypeScript

import { use } from 'react'
import { WindowContext, type WindowContextType } from '@/providers/window'
const useWindow = () => {
const context = use(WindowContext)
if (context === undefined) {
throw new Error('useWindow must be used within WindowProvider')
}
return context
}
export const useWindowControls = () => {
const { maximized, minimize, toggleMaximize, close, currentWindow } =
useWindow()
return {
maximized,
minimize,
toggleMaximize,
close,
currentWindow,
} satisfies Pick<
WindowContextType,
'maximized' | 'minimize' | 'toggleMaximize' | 'close' | 'currentWindow'
>
}
export const useWindowDecorations = () => {
const { decorated, toggleDecorations } = useWindow()
return { decorated, toggleDecorations } satisfies Pick<
WindowContextType,
'decorated' | 'toggleDecorations'
>
}