File size: 2,281 Bytes
00a912e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import type { MusicSource, MyPlatformAuth, PlatformAuthStatus } from '@music-together/shared'

/** Full platform display names (used in dialogs, titles, descriptions) */
export const PLATFORM_LABELS: Record<MusicSource, string> = {
  netease: '网易云音乐',
  tencent: 'QQ 音乐',
  kugou: '酷狗音乐',
  kugou_concept: '酷狗概念版',
  bilibili: 'B站',
}

/** Short platform labels (used in compact UI like tabs) */
export const PLATFORM_SHORT_LABELS: Record<MusicSource, string> = {
  netease: '网易云',
  tencent: 'QQ 音乐',
  kugou: '酷狗',
  kugou_concept: '概念版',
  bilibili: 'B站',
}

/** Tab highlight colors per platform */
export const PLATFORM_COLORS: Record<MusicSource, string> = {
  netease: 'data-[state=active]:text-red-500',
  tencent: 'data-[state=active]:text-green-500',
  kugou: 'data-[state=active]:text-blue-500',
  kugou_concept: 'data-[state=active]:text-sky-500',
  bilibili: 'data-[state=active]:text-pink-500',
}

/** Active platform selector styles */
export const PLATFORM_ACTIVE: Record<MusicSource, string> = {
  netease: 'bg-red-500/15',
  tencent: 'bg-green-500/15',
  kugou: 'bg-blue-500/15',
  kugou_concept: 'bg-sky-500/15',
  bilibili: 'bg-pink-500/15',
}

/** Active platform text color */
export const PLATFORM_TEXT: Record<MusicSource, string> = {
  netease: 'text-red-500',
  tencent: 'text-green-500',
  kugou: 'text-blue-500',
  kugou_concept: 'text-sky-500',
  bilibili: 'text-pink-500',
}

/** Normalized membership labels shared by all platforms. */
export const VIP_LABELS: Record<number, string> = {
  0: '',
  1: 'VIP',
  2: 'SVIP',
}

export function getVipDisplayLabel(vipType = 0, providerLabel?: string): string {
  return providerLabel?.trim() || VIP_LABELS[vipType] || (vipType > 0 ? 'VIP' : '')
}

/** Find a platform's auth status from the room-wide status list */
export function getPlatformStatus(
  platform: MusicSource,
  statusList: PlatformAuthStatus[],
): PlatformAuthStatus | undefined {
  return statusList.find((s) => s.platform === platform)
}

/** Find the current user's auth status for a platform */
export function getMyPlatformStatus(platform: MusicSource, myStatusList: MyPlatformAuth[]): MyPlatformAuth | undefined {
  return myStatusList.find((s) => s.platform === platform)
}