{/* Rows */}
- {DAYS.map((day, d) => (
+ {DAYS.map((dayLabel, d) => (
- {day}
+ {dayLabel}
{Array.from({ length: 24 }, (_, h) => {
const intensity = getIntensity(d, h);
const cell = cellMap.get(`${d}-${h}`);
+ const count = cell?.count ?? 0;
return (
0
+ ? "cursor-pointer hover:ring-2 hover:ring-primary/50 hover:scale-110"
+ : "",
)}
- title={`${day} ${h}:00 — ${cell?.count ?? 0} pesan`}
+ onMouseEnter={() => {
+ if (count > 0) {
+ setTooltip({
+ day: dayLabel,
+ hour: `${h}:00`,
+ total: count,
+ clean: cell?.clean ?? 0,
+ warned: cell?.warned ?? 0,
+ flagged: cell?.flagged ?? 0,
+ });
+ }
+ }}
+ onMouseLeave={() => setTooltip(null)}
/>
);
})}
@@ -95,13 +115,51 @@ export function Heatmap({ cells, loading }: HeatmapProps) {
))}
+
+ {/* Tooltip */}
+ {tooltip && (
+
+
+ {tooltip.day} {tooltip.hour}
+
+
+
+ Total
+
+ {tooltip.total}
+
+
+
+ Clean
+ {tooltip.clean}
+
+
+ Warned
+ {tooltip.warned}
+
+
+ Flagged
+ {tooltip.flagged}
+
+
+
+ )}
+
{/* Legend */}
Sepi
-
-
-
-
+
+
+
+
+
Ramai
@@ -113,7 +171,7 @@ function LoadingBox() {
return (
-
+
Memuat data...