2022-08-03 23:48:39 +08:00
|
|
|
import { IpcChannels } from '@/shared/IpcChannels'
|
2022-07-11 11:06:41 +08:00
|
|
|
import { proxy } from 'valtio'
|
|
|
|
|
|
|
|
interface UIStates {
|
|
|
|
showLyricPanel: boolean
|
|
|
|
showLoginPanel: boolean
|
|
|
|
hideTopbarBackground: boolean
|
|
|
|
librarySelectedTab: 'playlists' | 'albums' | 'artists' | 'videos'
|
|
|
|
mobileShowPlayingNext: boolean
|
2022-08-03 23:48:39 +08:00
|
|
|
blurBackgroundImage: string | null
|
|
|
|
fullscreen: boolean
|
2023-01-07 14:39:03 +08:00
|
|
|
playingVideoID: number | null
|
2022-07-11 11:06:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const initUIStates: UIStates = {
|
|
|
|
showLyricPanel: false,
|
|
|
|
showLoginPanel: false,
|
|
|
|
hideTopbarBackground: false,
|
|
|
|
librarySelectedTab: 'playlists',
|
|
|
|
mobileShowPlayingNext: false,
|
2022-08-03 23:48:39 +08:00
|
|
|
blurBackgroundImage: null,
|
2022-10-28 20:29:04 +08:00
|
|
|
fullscreen: false,
|
2023-01-07 14:39:03 +08:00
|
|
|
playingVideoID: null,
|
2022-07-11 11:06:41 +08:00
|
|
|
}
|
|
|
|
|
2022-10-28 20:29:04 +08:00
|
|
|
window.ipcRenderer
|
|
|
|
?.invoke(IpcChannels.IsMaximized)
|
|
|
|
.then(isMaximized => (initUIStates.fullscreen = !!isMaximized))
|
|
|
|
|
2023-01-07 14:39:03 +08:00
|
|
|
const uiStates = proxy<UIStates>(initUIStates)
|
|
|
|
export default uiStates
|
|
|
|
|
|
|
|
export const closeVideoPlayer = () => {
|
|
|
|
uiStates.playingVideoID = null
|
|
|
|
}
|