@@ -280,10 +280,28 @@ const isAiring = Boolean(startTime && endTime) && program !== null;
280
280
history: number[] | undefined,
281
281
currentCount: number,
282
282
): void {
283
+ // If we have history from the API, use it
283
284
if (history && Array.isArray(history) && history.length > 0) {
284
- // Use the history from the API if available
285
285
this.visitorHistory = history;
286
286
} else {
287
+ // If no history provided, try to get initial data from the dataset
288
+ const initialData = this.dataset.initialVisitors;
289
+ if (initialData) {
290
+ try {
291
+ const parsed = JSON.parse(initialData);
292
+ if (
293
+ parsed.history &&
294
+ Array.isArray(parsed.history) &&
295
+ parsed.history.length > 0
296
+ ) {
297
+ this.visitorHistory = parsed.history;
298
+ return;
299
+ }
300
+ } catch (error) {
301
+ console.error("Failed to parse initial visitor data:", error);
302
+ }
303
+ }
304
+
287
305
// Fallback to updating with just the current count
288
306
this.visitorHistory = [...this.visitorHistory.slice(1), currentCount];
289
307
}
@@ -608,15 +626,9 @@ const isAiring = Boolean(startTime && endTime) && program !== null;
608
626
}
609
627
610
628
#visitors {
611
- color: var(--phosphor-inactive);
612
629
display: flex;
613
630
align-items: center;
614
631
gap: 0.5em;
615
-
616
- &[data-active="true"] {
617
- color: var(--phosphor-active);
618
- text-shadow: var(--phosphor-glow);
619
- }
620
632
}
621
633
622
634
.visitor-trend {
@@ -666,10 +678,10 @@ const isAiring = Boolean(startTime && endTime) && program !== null;
666
678
#visitors[data-active="true"] {
667
679
.visitor-trend rect {
668
680
filter: drop-shadow(
669
- 0 0 2px color-mix(in srgb, currentColor 50 %, transparent)
681
+ 0 0 2px color-mix(in srgb, currentColor 30 %, transparent)
670
682
)
671
- drop-shadow(0 0 4px color-mix(in srgb, currentColor 40 %, transparent))
672
- drop-shadow(0 0 8px color-mix(in srgb, currentColor 30 %, transparent));
683
+ drop-shadow(0 0 4px color-mix(in srgb, currentColor 20 %, transparent))
684
+ drop-shadow(0 0 8px color-mix(in srgb, currentColor 15 %, transparent));
673
685
}
674
686
}
675
687
</style >
0 commit comments