mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-30 02:32:09 +08:00
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.
35 lines
860 B
TypeScript
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'
|
|
>
|
|
}
|