YesPlayMusic/packages/web/states/uiStates.ts
2023-03-03 03:12:27 +08:00

36 lines
856 B
TypeScript

import { IpcChannels } from '@/shared/IpcChannels'
import { proxy } from 'valtio'
interface UIStates {
showLyricPanel: boolean
showLoginPanel: boolean
hideTopbarBackground: boolean
mobileShowPlayingNext: boolean
blurBackgroundImage: string | null
fullscreen: boolean
playingVideoID: number | null
isPauseVideos: boolean
}
const initUIStates: UIStates = {
showLyricPanel: false,
showLoginPanel: false,
hideTopbarBackground: false,
mobileShowPlayingNext: false,
blurBackgroundImage: null,
fullscreen: false,
playingVideoID: null,
isPauseVideos: false,
}
window.ipcRenderer
?.invoke(IpcChannels.IsMaximized)
.then(isMaximized => (initUIStates.fullscreen = !!isMaximized))
const uiStates = proxy<UIStates>(initUIStates)
export default uiStates
export const closeVideoPlayer = () => {
uiStates.playingVideoID = null
}