Add season calendar to command center

This commit is contained in:
2026-05-25 18:14:55 -04:00
parent a2aa772838
commit 024accfb3d
5 changed files with 261 additions and 58 deletions

View File

@@ -11,6 +11,7 @@ const COUNTRY_ACCENTS: Record<string, string> = {
DEU: '#cdc7c2',
BEL: '#e0a01b',
NLD: '#ef7c1a',
NED: '#ef7c1a',
HUN: '#3f8a4b',
AUT: '#c61f1f',
AZE: '#1f7eaf',
@@ -20,8 +21,11 @@ const COUNTRY_ACCENTS: Record<string, string> = {
SGP: '#c8202c',
BRA: '#2fa84f',
BHR: '#a8132b',
BRN: '#a8132b',
SAU: '#0a7a3b',
KSA: '#0a7a3b',
ARE: '#4d6b2a',
UAE: '#4d6b2a',
QAT: '#7a1e3e',
CHN: '#c8202c',
MEX: '#1f7a4d',
@@ -43,6 +47,46 @@ export function countryDecal(meeting: Meeting | undefined | null): string {
return name.slice(0, 3).toUpperCase() || '—'
}
export function countryFlag(meeting: Meeting | undefined | null): string {
if (meeting?.country_flag && !/^https?:\/\//i.test(meeting.country_flag)) return meeting.country_flag
const code = meeting?.country_code?.toUpperCase()
const iso2 = code ? CODE3_TO_2[code] : ''
if (!iso2) return ''
const offset = 0x1f1e6 - 65
return String.fromCodePoint(iso2.charCodeAt(0) + offset, iso2.charCodeAt(1) + offset)
}
const CODE3_TO_2: Record<string, string> = {
AUS: 'AU',
AUT: 'AT',
AZE: 'AZ',
BEL: 'BE',
BHR: 'BH',
BRN: 'BH',
BRA: 'BR',
CAN: 'CA',
CHN: 'CN',
DEU: 'DE',
GER: 'DE',
ESP: 'ES',
FRA: 'FR',
GBR: 'GB',
HUN: 'HU',
ITA: 'IT',
JPN: 'JP',
MEX: 'MX',
MON: 'MC',
NED: 'NL',
NLD: 'NL',
QAT: 'QA',
SAU: 'SA',
KSA: 'SA',
SGP: 'SG',
UAE: 'AE',
ARE: 'AE',
USA: 'US',
}
export function formatGpDateRange(meeting: Meeting | undefined | null): string {
if (!meeting) return ''
const start = meeting.date_start?.slice(0, 10)