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
|
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,
|
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))
|
|
|
|
|
2022-07-11 11:06:41 +08:00
|
|
|
export default proxy<UIStates>(initUIStates)
|