-
Notifications
You must be signed in to change notification settings - Fork 6.2k
/
Copy pathstate.ts
47 lines (39 loc) · 1008 Bytes
/
state.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { reactive, markRaw, shallowReactive } from '@common/utils/vueTools'
import music from '@renderer/utils/musicSdk'
export type Source = LX.OnlineSource
export const sources: LX.OnlineSource[] = markRaw([])
for (const source of music.sources) {
if (!music[source.id as LX.OnlineSource]?.leaderboard?.getBoards) continue
sources.push(source.id as LX.OnlineSource)
}
export interface BoardItem {
id: string
name: string
bangid: string
}
export interface Board {
list: BoardItem[]
source: LX.OnlineSource
}
type Boards = Partial<Record<LX.OnlineSource, Board>>
export const boards = shallowReactive<Boards>({})
export interface ListDetailInfo {
list: LX.Music.MusicInfoOnline[]
total: number
page: number
source: LX.OnlineSource | null
limit: number
key: string | null
id: string
noItemLabel: string
}
export const listDetailInfo = reactive<ListDetailInfo>({
list: [],
total: 0,
page: 1,
limit: 30,
key: null,
source: null,
id: '',
noItemLabel: '',
})