Skip to content

Your favorite shift management application!

feat: Add advanced shift statistics with charts and i18n updates (#80)

panteL077525925880
diff --git a/app/api/shifts/stats/route.ts b/app/api/shifts/stats/route.ts
index e74f994..30db93e 100644
--- a/app/api/shifts/stats/route.ts
+++ b/app/api/shifts/stats/route.ts
@@ -83,7 +83,9 @@ export async function GET(request: Request) {
// Fetch shifts for the period, excluding shifts from iCloud syncs or presets that are hidden from stats
const result = await db
.select({
+ id: shifts.id,
title: shifts.title,
+ date: shifts.date,
startTime: shifts.startTime,
endTime: shifts.endTime,
isAllDay: shifts.isAllDay,
@@ -111,6 +113,12 @@ export async function GET(request: Request) {
// Group by title and calculate stats
const statsMap = new Map<string, { count: number; totalMinutes: number }>();
+ const dailyStats = new Map<
+ string,
+ { count: number; totalMinutes: number }
+ >();
+ let minDuration = Infinity;
+ let maxDuration = 0;
result.forEach((shift) => {
const existing = statsMap.get(shift.title) || {
@@ -118,10 +126,44 @@ export async function GET(request: Request) {
totalMinutes: 0,
};
existing.count++;
- existing.totalMinutes += shift.isAllDay
+ const duration = shift.isAllDay
? 0
: calculateShiftDuration(shift.startTime, shift.endTime);
+ existing.totalMinutes += duration;
statsMap.set(shift.title, existing);
+
+ // Track min/max duration (exclude all-day shifts)
+ if (!shift.isAllDay && duration > 0) {
+ minDuration = Math.min(minDuration, duration);
+ maxDuration = Math.max(maxDuration, duration);
+ }
+
+ // Daily breakdown for trend analysis
+ const shiftDate = shift.date;
+ if (shiftDate) {
+ try {
+ // Handle both Date objects and Unix timestamps (in seconds for SQLite)
+ const date =
+ shiftDate instanceof Date
+ ? shiftDate
+ : typeof shiftDate === "number"
+ ? new Date(shiftDate * 1000) // Convert seconds to milliseconds
+ : new Date(shiftDate);
+
+ if (!isNaN(date.getTime())) {
+ const dateKey = date.toISOString().split("T")[0];
+ const dailyExisting = dailyStats.get(dateKey) || {
+ count: 0,
+ totalMinutes: 0,
+ };
+ dailyExisting.count++;
+ dailyExisting.totalMinutes += duration;
+ dailyStats.set(dateKey, dailyExisting);
+ }
+ } catch {
+ // Skip invalid dates
+ }
+ }
});
// Transform result to object format
@@ -136,18 +178,45 @@ export async function GET(request: Request) {
{} as Record<string, { count: number; totalMinutes: number }>
);
- // Calculate total duration
+ // Calculate total duration and averages
const totalMinutes = Object.values(stats).reduce(
(sum, data) => sum + data.totalMinutes,
0
);
+ const totalShifts = result.length;
+ const avgMinutesPerShift = totalShifts > 0 ? totalMinutes / totalShifts : 0;
+
+ // Calculate days with shifts for accurate daily average
+ const daysWithShifts = dailyStats.size;
+ const avgShiftsPerDay =
+ daysWithShifts > 0 ? totalShifts / daysWithShifts : 0;
+ const avgMinutesPerDay =
+ daysWithShifts > 0 ? totalMinutes / daysWithShifts : 0;
+
+ // Convert daily stats to array for trend visualization
+ const trendData = Array.from(dailyStats.entries())
+ .map(([date, data]) => ({
+ date,
+ count: data.count,
+ totalMinutes: data.totalMinutes,
+ }))
+ .sort((a, b) => a.date.localeCompare(b.date));
+
return NextResponse.json({
period,
startDate: startDate.toISOString(),
endDate: endDate.toISOString(),
stats,
totalMinutes,
+ totalShifts,
+ avgMinutesPerShift: Math.round(avgMinutesPerShift),
+ avgShiftsPerDay: Math.round(avgShiftsPerDay * 10) / 10,
+ avgMinutesPerDay: Math.round(avgMinutesPerDay),
+ minDuration: minDuration === Infinity ? 0 : minDuration,
+ maxDuration,
+ daysWithShifts,
+ trendData,
});
} catch (error) {
console.error("Failed to fetch shift statistics:", error);
diff --git a/components/calendar-grid.tsx b/components/calendar-grid.tsx
index 2a584df..ddea41f 100644
--- a/components/calendar-grid.tsx
+++ b/components/calendar-grid.tsx
@@ -107,13 +107,13 @@ export function CalendarGrid({
return (
<div className="grid grid-cols-7 gap-0 sm:gap-1.5 mb-6">
{[
- t("calendar_grid.monday"),
- t("calendar_grid.tuesday"),
- t("calendar_grid.wednesday"),
- t("calendar_grid.thursday"),
- t("calendar_grid.friday"),
- t("calendar_grid.saturday"),
- t("calendar_grid.sunday"),
+ t("common.weekday.monday"),
+ t("common.weekday.tuesday"),
+ t("common.weekday.wednesday"),
+ t("common.weekday.thursday"),
+ t("common.weekday.friday"),
+ t("common.weekday.saturday"),
+ t("common.weekday.sunday"),
].map((day) => (
<div
key={day}
diff --git a/components/shift-stats.tsx b/components/shift-stats.tsx
index 8b5a9ed..5d24d66 100644
--- a/components/shift-stats.tsx
+++ b/components/shift-stats.tsx
@@ -3,17 +3,74 @@
import { useState, useEffect, useCallback, useRef } from "react";
import { useTranslations } from "next-intl";
import { Button } from "@/components/ui/button";
-import { BarChart3, ChevronDown, ChevronUp } from "lucide-react";
+import {
+ BarChart3,
+ ChevronDown,
+ ChevronUp,
+ PieChart,
+ Radar as RadarIcon,
+} from "lucide-react";
import { getCachedPassword } from "@/lib/password-cache";
import { formatDuration } from "@/lib/date-utils";
import { Skeleton } from "@/components/ui/skeleton";
+// Hook for responsive radius that's SSR-safe
+function useResponsiveRadius() {
+ const [radius, setRadius] = useState(120); // Safe default for SSR
+
+ useEffect(() => {
+ if (typeof window === "undefined") return;
+
+ const updateRadius = () => {
+ setRadius(window.innerWidth < 640 ? 80 : 120);
+ };
+
+ // Set initial value
+ updateRadius();
+
+ // Add resize listener
+ window.addEventListener("resize", updateRadius);
+
+ // Cleanup
+ return () => window.removeEventListener("resize", updateRadius);
+ }, []);
+
+ return radius;
+}
+
+import {
+ PieChart as RechartsPieChart,
+ Pie,
+ Cell,
+ ResponsiveContainer,
+ Tooltip,
+ BarChart,
+ Bar,
+ XAxis,
+ YAxis,
+ CartesianGrid,
+ Legend,
+ RadarChart,
+ PolarGrid,
+ PolarAngleAxis,
+ PolarRadiusAxis,
+ Radar,
+} from "recharts";
+
interface ShiftStats {
period: string;
startDate: string;
endDate: string;
stats: Record<string, { count: number; totalMinutes: number }>;
totalMinutes: number;
+ totalShifts: number;
+ avgMinutesPerShift: number;
+ avgShiftsPerDay: number;
+ avgMinutesPerDay: number;
+ minDuration: number;
+ maxDuration: number;
+ daysWithShifts: number;
+ trendData: Array<{ date: string; count: number; totalMinutes: number }>;
}
interface ShiftStatsProps {
@@ -22,6 +79,23 @@ interface ShiftStatsProps {
refreshTrigger?: number;
}
+type ViewMode = "overview" | "pie" | "bar" | "radar";
+
+const CHART_COLORS = [
+ "#3b82f6", // primary blue
+ "#8b5cf6", // purple
+ "#ec4899", // pink
+ "#f59e0b", // amber
+ "#10b981", // green
+ "#06b6d4", // cyan
+ "#f97316", // orange
+ "#6366f1", // indigo
+ "#14b8a6", // teal
+ "#a855f7", // violet
+ "#ef4444", // red
+ "#22c55e", // lime
+];
+
export function ShiftStats({
calendarId,
currentDate,
@@ -29,10 +103,12 @@ export function ShiftStats({
}: ShiftStatsProps) {
const t = useTranslations();
const [period, setPeriod] = useState<"week" | "month" | "year">("month");
+ const [viewMode, setViewMode] = useState<ViewMode>("overview");
const [stats, setStats] = useState<ShiftStats | null>(null);
const [loading, setLoading] = useState(false);
const [isExpanded, setIsExpanded] = useState(true);
const isInitialLoadRef = useRef(true);
+ const outerRadius = useResponsiveRadius();
const fetchStats = useCallback(
async (silent = false) => {
@@ -80,13 +156,77 @@ export function ShiftStats({
if (!calendarId) return null;
- const totalShifts =
- stats && stats.stats
- ? Object.values(stats.stats).reduce((sum, data) => sum + data.count, 0)
- : 0;
-
+ const totalShifts = stats?.totalShifts || 0;
const totalMinutes = stats?.totalMinutes || 0;
+ // Prepare data for charts
+ const pieData = stats
+ ? Object.entries(stats.stats).map(([title, data]) => ({
+ name: title,
+ value: data.count,
+ hours: Math.round((data.totalMinutes / 60) * 10) / 10,
+ }))
+ : [];
+
+ const barData = stats
+ ? Object.entries(stats.stats)
+ .map(([title, data]) => ({
+ name: title.length > 15 ? title.substring(0, 15) + "..." : title,
+ fullName: title,
+ shifts: data.count,
+ hours: Math.round((data.totalMinutes / 60) * 10) / 10,
+ }))
+ .sort((a, b) => b.shifts - a.shifts)
+ : [];
+
+ // Prepare data for radar chart (top shift types by hours)
+ const radarData = stats
+ ? Object.entries(stats.stats)
+ .sort(([, a], [, b]) => b.totalMinutes - a.totalMinutes)
+ .slice(0, 6) // Top 6 shift types
+ .map(([title, data]) => ({
+ type: title.length > 12 ? title.substring(0, 12) + "..." : title,
+ fullName: title,
+ hours: Math.round((data.totalMinutes / 60) * 10) / 10,
+ shifts: data.count,
+ avgHours: data.count
+ ? Math.round((data.totalMinutes / data.count / 60) * 10) / 10
+ : 0,
+ }))
+ : [];
+
+ const CustomTooltip = ({
+ active,
+ payload,
+ }: {
+ active?: boolean;
+ payload?: Array<{
+ name: string;
+ value: number;
+ color: string;
+ dataKey?: string;
+ payload: { fullName?: string; name?: string };
+ }>;
+ }) => {
+ if (active && payload && payload.length) {
+ return (
+ <div className="bg-card/95 backdrop-blur-sm border border-border rounded-lg p-3 shadow-lg">
+ <p className="font-semibold text-sm mb-1">
+ {payload[0].payload.fullName || payload[0].name}
+ </p>
+ {payload.map((entry) => (
+ <p key={entry.name} className="text-xs text-muted-foreground">
+ <span style={{ color: entry.color }}>{entry.name}:</span>{" "}
+ {entry.value}
+ {entry.name === "hours" || entry.dataKey === "hours" ? "h" : ""}
+ </p>
+ ))}
+ </div>
+ );
+ }
+ return null;
+ };
+
return (
<div className="border border-border/50 rounded-xl bg-gradient-to-b from-card/80 via-card/60 to-card/40 backdrop-blur-sm overflow-hidden shadow-lg">
{/* Header */}
@@ -119,49 +259,6 @@ export function ShiftStats({
)}
</>
)}
- {!isExpanded && stats && totalShifts > 0 && (
- <div className="hidden sm:flex gap-1.5">
- <span
- className={`h-6 text-xs px-2 inline-flex items-center justify-center rounded-md font-medium transition-colors ${
- period === "week"
- ? "bg-primary text-primary-foreground"
- : "border border-input bg-background hover:bg-accent hover:text-accent-foreground"
- }`}
- onClick={(e) => {
- e.stopPropagation();
- setPeriod("week");
- }}
- >
- {t("stats.week")}
- </span>
- <span
- className={`h-6 text-xs px-2 inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer ${
- period === "month"
- ? "bg-primary text-primary-foreground"
- : "border border-input bg-background hover:bg-accent hover:text-accent-foreground"
- }`}
- onClick={(e) => {
- e.stopPropagation();
- setPeriod("month");
- }}
- >
- {t("stats.month")}
- </span>
- <span
- className={`h-6 text-xs px-2 inline-flex items-center justify-center rounded-md font-medium transition-colors cursor-pointer ${
- period === "year"
- ? "bg-primary text-primary-foreground"
- : "border border-input bg-background hover:bg-accent hover:text-accent-foreground"
- }`}
- onClick={(e) => {
- e.stopPropagation();
- setPeriod("year");
- }}
- >
- {t("stats.year")}
- </span>
- </div>
- )}
{isExpanded ? (
<ChevronUp className="h-4 w-4 text-muted-foreground" />
) : (
@@ -173,7 +270,7 @@ export function ShiftStats({
{/* Content */}
{isExpanded && (
<div className="px-3 sm:px-4 pb-3 sm:pb-4 space-y-4 border-t border-border/30 bg-muted/20">
- {/* Period Selector - Mobile and Desktop when expanded */}
+ {/* Period Selector */}
<div className="flex gap-2 pt-4">
<Button
variant={period === "week" ? "default" : "outline"}
@@ -201,94 +298,330 @@ export function ShiftStats({
</Button>
</div>
+ {/* View Mode Selector */}
+ {stats && Object.keys(stats.stats).length > 0 && (
+ <div className="grid grid-cols-2 sm:flex gap-2">
+ <Button
+ variant={viewMode === "overview" ? "default" : "outline"}
+ size="sm"
+ onClick={() => setViewMode("overview")}
+ className="sm:flex-none h-8 text-xs transition-all"
+ >
+ <BarChart3 className="h-3.5 w-3.5 mr-1.5" />
+ {t("stats.overview")}
+ </Button>
+ <Button
+ variant={viewMode === "pie" ? "default" : "outline"}
+ size="sm"
+ onClick={() => setViewMode("pie")}
+ className="sm:flex-none h-8 text-xs transition-all"
+ >
+ <PieChart className="h-3.5 w-3.5 mr-1.5" />
+ {t("stats.distribution")}
+ </Button>
+ <Button
+ variant={viewMode === "bar" ? "default" : "outline"}
+ size="sm"
+ onClick={() => setViewMode("bar")}
+ className="sm:flex-none h-8 text-xs transition-all"
+ >
+ <BarChart3 className="h-3.5 w-3.5 mr-1.5" />
+ {t("stats.comparison")}
+ </Button>
+ <Button
+ variant={viewMode === "radar" ? "default" : "outline"}
+ size="sm"
+ onClick={() => setViewMode("radar")}
+ className="sm:flex-none h-8 text-xs transition-all"
+ >
+ <RadarIcon className="h-3.5 w-3.5 mr-1.5" />
+ {t("stats.radar")}
+ </Button>
+ </div>
+ )}
+
{/* Stats Display */}
{loading ? (
<div className="space-y-3">
<Skeleton className="h-20 w-full rounded-lg" />
- <Skeleton className="h-16 w-full rounded-lg" />
- <Skeleton className="h-16 w-full rounded-lg" />
+ <Skeleton className="h-64 w-full rounded-lg" />
</div>
) : stats && Object.keys(stats.stats).length > 0 ? (
<div className="space-y-3.5">
- {/* Total Statistics Card */}
- <div className="p-3 rounded-lg bg-gradient-to-br from-primary/10 via-primary/5 to-transparent border border-primary/20">
- <div className="flex items-center justify-between gap-3">
- <span className="font-semibold text-xs sm:text-sm flex items-center gap-2">
- <div className="w-1 h-4 bg-gradient-to-b from-primary to-primary/50 rounded-full shadow-sm shadow-primary/20"></div>
- {t("stats.total")}
- </span>
- <div className="flex items-center gap-3">
- {/* Shift Count */}
- <div className="flex flex-col items-end">
- <span className="text-[10px] text-muted-foreground font-medium mb-0.5">
- {t("common.shifts")}
- </span>
- <div className="px-2.5 py-1 rounded-md bg-gradient-to-r from-primary/20 to-primary/10 border border-primary/30">
- <span className="font-bold text-base sm:text-lg bg-gradient-to-r from-primary to-primary/70 bg-clip-text text-transparent">
- {totalShifts}
- </span>
+ {/* Overview Mode - Enhanced Cards */}
+ {viewMode === "overview" && (
+ <>
+ {/* Summary Statistics Grid */}
+ <div className="grid grid-cols-2 sm:grid-cols-3 gap-2">
+ <div className="p-3 rounded-lg bg-gradient-to-br from-primary/10 via-primary/5 to-transparent border border-primary/20">
+ <div className="text-[10px] text-muted-foreground font-medium mb-1">
+ {t("stats.totalShifts")}
+ </div>
+ <div className="text-xl font-bold bg-gradient-to-r from-primary to-primary/70 bg-clip-text text-transparent">
+ {totalShifts}
</div>
</div>
- {totalMinutes > 0 && (
- <>
- <div className="h-8 w-px bg-gradient-to-b from-transparent via-border to-transparent"></div>
- {/* Duration */}
- <div className="flex flex-col items-end">
- <span className="text-[10px] text-muted-foreground font-medium mb-0.5">
- {t("stats.hours")}
- </span>
- <div className="px-2.5 py-1 rounded-md bg-gradient-to-r from-primary/20 to-primary/10 border border-primary/30">
- <span className="font-bold text-base sm:text-lg bg-gradient-to-r from-primary to-primary/70 bg-clip-text text-transparent">
- {formatDuration(totalMinutes)}
+ <div className="p-3 rounded-lg bg-gradient-to-br from-primary/10 via-primary/5 to-transparent border border-primary/20">
+ <div className="text-[10px] text-muted-foreground font-medium mb-1">
+ {t("stats.totalHours")}
+ </div>
+ <div className="text-xl font-bold bg-gradient-to-r from-primary to-primary/70 bg-clip-text text-transparent">
+ {formatDuration(totalMinutes)}
+ </div>
+ </div>
+ <div className="p-3 rounded-lg bg-gradient-to-br from-card via-card/80 to-card/60 border border-border/40">
+ <div className="text-[10px] text-muted-foreground font-medium mb-1">
+ {t("stats.avgPerShift")}
+ </div>
+ <div className="text-xl font-bold text-foreground">
+ {formatDuration(stats.avgMinutesPerShift)}
+ </div>
+ </div>
+ </div>
+
+ {/* Additional Metrics */}
+ <div className="grid grid-cols-2 gap-2">
+ {stats.minDuration > 0 && (
+ <div className="p-3 rounded-lg bg-gradient-to-br from-card via-card/80 to-card/60 border border-border/40">
+ <div className="text-[10px] text-muted-foreground font-medium mb-1">
+ {t("stats.shortestShift")}
+ </div>
+ <div className="text-lg font-bold text-foreground">
+ {formatDuration(stats.minDuration)}
+ </div>
+ </div>
+ )}
+ {stats.maxDuration > 0 && (
+ <div className="p-3 rounded-lg bg-gradient-to-br from-card via-card/80 to-card/60 border border-border/40">
+ <div className="text-[10px] text-muted-foreground font-medium mb-1">
+ {t("stats.longestShift")}
+ </div>
+ <div className="text-lg font-bold text-foreground">
+ {formatDuration(stats.maxDuration)}
+ </div>
+ </div>
+ )}
+ </div>
+
+ {/* Individual Shift Types List */}
+ <div className="space-y-2">
+ <h4 className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
+ {t("stats.byType")}
+ </h4>
+ {Object.entries(stats.stats)
+ .sort(([, a], [, b]) => b.count - a.count)
+ .map(([title, data]) => (
+ <div
+ key={title}
+ className="group relative p-3 rounded-lg bg-gradient-to-br from-card via-card/80 to-card/60 border border-border/40 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 transition-all duration-200"
+ >
+ <div className="flex justify-between items-center gap-3">
+ <span className="text-sm font-semibold truncate flex-shrink min-w-0 group-hover:text-primary transition-colors">
+ {title}
</span>
+ <div className="flex items-center gap-3 flex-shrink-0">
+ <div className="w-24 sm:w-32 h-2 bg-muted/50 rounded-full overflow-hidden border border-border/20 shadow-inner">
+ <div
+ className="h-full bg-gradient-to-r from-primary via-primary/90 to-primary/80 transition-all duration-300 shadow-sm"
+ style={{
+ width: `${
+ (data.count / totalShifts) * 100
+ }%`,
+ }}
+ />
+ </div>
+ <div className="min-w-[2.5rem] px-2 py-1 rounded-md bg-primary/10 border border-primary/20">
+ <span className="font-bold text-sm text-primary text-center block">
+ {data.count}
+ </span>
+ </div>
+ {data.totalMinutes > 0 && (
+ <div className="min-w-[3rem] sm:min-w-[3.5rem] px-2 py-1 rounded-md bg-primary/10 border border-primary/20">
+ <span className="font-semibold text-xs sm:text-sm text-primary text-center block">
+ {formatDuration(data.totalMinutes)}
+ </span>
+ </div>
+ )}
+ </div>
</div>
</div>
- </>
- )}
+ ))}
+ </div>
+ </>
+ )}
+
+ {/* Pie Chart Mode */}
+ {viewMode === "pie" && (
+ <div className="space-y-3">
+ <div className="h-[300px] sm:h-[400px] min-h-[300px]">
+ <ResponsiveContainer
+ width="100%"
+ height="100%"
+ minHeight={300}
+ >
+ <RechartsPieChart>
+ <Pie
+ data={pieData}
+ cx="50%"
+ cy="50%"
+ labelLine={false}
+ label={({ name, percent }) =>
+ `${name}: ${((percent ?? 0) * 100).toFixed(0)}%`
+ }
+ outerRadius={outerRadius}
+ fill="#8884d8"
+ dataKey="value"
+ animationBegin={0}
+ animationDuration={800}
+ >
+ {pieData.map((_, index) => (
+ <Cell
+ key={`cell-${index}`}
+ fill={CHART_COLORS[index % CHART_COLORS.length]}
+ />
+ ))}
+ </Pie>
+ <Tooltip content={<CustomTooltip />} />
+ </RechartsPieChart>
+ </ResponsiveContainer>
+ </div>
+ <div className="grid grid-cols-2 sm:grid-cols-3 gap-2">
+ {pieData.map((entry, index) => (
+ <div
+ key={entry.name}
+ className="flex items-center gap-2 p-2 rounded-lg bg-card/50 border border-border/30 hover:bg-card/70 hover:border-primary/30 transition-all"
+ >
+ <div
+ className="w-3 h-3 rounded-sm flex-shrink-0"
+ style={{
+ backgroundColor:
+ CHART_COLORS[index % CHART_COLORS.length],
+ }}
+ />
+ <div className="flex-1 min-w-0">
+ <div className="text-xs font-medium truncate">
+ {entry.name}
+ </div>
+ <div className="text-[10px] text-muted-foreground">
+ {entry.value} × {entry.hours}h
+ </div>
+ </div>
+ </div>
+ ))}
</div>
</div>
- </div>
+ )}
- {/* Individual Shift Types */}
- {Object.entries(stats.stats)
- .sort(([, a], [, b]) => b.count - a.count)
- .map(([title, data]) => (
- <div
- key={title}
- className="group relative p-3 rounded-lg bg-gradient-to-br from-card via-card/80 to-card/60 border border-border/40 hover:border-primary/30 hover:shadow-md hover:shadow-primary/5 transition-all duration-200"
+ {/* Bar Chart Mode */}
+ {viewMode === "bar" && (
+ <div className="h-[350px] sm:h-[450px] min-h-[350px]">
+ <ResponsiveContainer
+ width="100%"
+ height="100%"
+ minHeight={350}
>
- <div className="flex justify-between items-center gap-3">
- <span className="text-sm font-semibold truncate flex-shrink min-w-0 group-hover:text-primary transition-colors">
- {title}
- </span>
- <div className="flex items-center gap-3 flex-shrink-0">
- {/* Progress Bar */}
- <div className="w-24 sm:w-32 h-2 bg-muted/50 rounded-full overflow-hidden border border-border/20 shadow-inner">
- <div
- className="h-full bg-gradient-to-r from-primary via-primary/90 to-primary/80 transition-all duration-300 shadow-sm"
- style={{
- width: `${(data.count / totalShifts) * 100}%`,
- }}
- />
- </div>
- {/* Count Badge */}
- <div className="min-w-[2.5rem] px-2 py-1 rounded-md bg-primary/10 border border-primary/20">
- <span className="font-bold text-sm text-primary text-center block">
- {data.count}
- </span>
- </div>
- {/* Duration Badge */}
- {data.totalMinutes > 0 && (
- <div className="min-w-[3rem] sm:min-w-[3.5rem] px-2 py-1 rounded-md bg-primary/10 border border-primary/20">
- <span className="font-semibold text-xs sm:text-sm text-primary text-center block">
- {formatDuration(data.totalMinutes)}
- </span>
+ <BarChart data={barData}>
+ <CartesianGrid strokeDasharray="3 3" opacity={0.1} />
+ <XAxis
+ dataKey="name"
+ tick={{ fontSize: 12 }}
+ angle={-45}
+ textAnchor="end"
+ height={80}
+ />
+ <YAxis tick={{ fontSize: 12 }} />
+ <Tooltip content={<CustomTooltip />} />
+ <Legend />
+ <Bar
+ dataKey="shifts"
+ fill={CHART_COLORS[0]}
+ name={t("common.shifts")}
+ radius={[4, 4, 0, 0]}
+ animationDuration={1000}
+ />
+ <Bar
+ dataKey="hours"
+ fill={CHART_COLORS[1]}
+ name={t("stats.hours")}
+ radius={[4, 4, 0, 0]}
+ animationDuration={1000}
+ />
+ </BarChart>
+ </ResponsiveContainer>
+ </div>
+ )}
+
+ {/* Radar Chart - Performance metrics for top shift types */}
+ {viewMode === "radar" && radarData.length > 0 && (
+ <div className="space-y-3">
+ <div className="h-[350px] sm:h-[450px] min-h-[350px]">
+ <ResponsiveContainer
+ width="100%"
+ height="100%"
+ minHeight={350}
+ >
+ <RadarChart data={radarData}>
+ <PolarGrid stroke={CHART_COLORS[0]} opacity={0.2} />
+ <PolarAngleAxis
+ dataKey="type"
+ tick={{ fontSize: 11, fill: "currentColor" }}
+ />
+ <PolarRadiusAxis
+ angle={90}
+ domain={[0, "auto"]}
+ tick={{ fontSize: 10 }}
+ />
+ <Radar
+ name={t("stats.totalHours")}
+ dataKey="hours"
+ stroke={CHART_COLORS[0]}
+ fill={CHART_COLORS[0]}
+ fillOpacity={0.6}
+ animationDuration={1000}
+ />
+ <Radar
+ name={t("stats.avgHoursPerShift")}
+ dataKey="avgHours"
+ stroke={CHART_COLORS[2]}
+ fill={CHART_COLORS[2]}
+ fillOpacity={0.4}
+ animationDuration={1000}
+ />
+ <Tooltip content={<CustomTooltip />} />
+ <Legend />
+ </RadarChart>
+ </ResponsiveContainer>
+ </div>
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
+ {radarData.map((entry) => (
+ <div
+ key={entry.fullName}
+ className="flex items-center gap-2 p-2 rounded-lg bg-card/50 border border-border/30"
+ >
+ <div
+ className="w-3 h-3 rounded-sm flex-shrink-0"
+ style={{
+ backgroundColor: CHART_COLORS[0],
+ }}
+ />
+ <div className="flex-1 min-w-0">
+ <div className="text-xs font-medium truncate">
+ {entry.fullName}
</div>
- )}
+ <div className="text-[10px] text-muted-foreground">
+ {entry.shifts} × ⌀{entry.avgHours}h
+ </div>
+ </div>
</div>
- </div>
+ ))}
+ </div>
+ <div className="p-3 rounded-lg bg-muted/30 border border-border/30">
+ <p className="text-xs text-muted-foreground text-center">
+ {t("stats.radarDescription")}
+ </p>
</div>
- ))}
+ </div>
+ )}
</div>
) : (
<p className="text-sm text-muted-foreground py-6 text-center">
diff --git a/messages/de.json b/messages/de.json
index 6ee8301..0f5a801 100644
--- a/messages/de.json
+++ b/messages/de.json
@@ -24,7 +24,16 @@
"deleteError": "{item} konnte nicht gelöscht werden",
"deleteConfirm": "{item} \"{name}\" wirklich löschen?",
"deleteConfirmWithWarning": "{item} \"{name}\" wirklich löschen? {warning}",
- "shifts": "Schichten"
+ "shifts": "Schichten",
+ "weekday": {
+ "monday": "Mo",
+ "tuesday": "Di",
+ "wednesday": "Mi",
+ "thursday": "Do",
+ "friday": "Fr",
+ "saturday": "Sa",
+ "sunday": "So"
+ }
},
"validation": {
"passwordMatch": "Passwörter stimmen nicht überein",
@@ -143,15 +152,7 @@
"hidePresets": "Vorlagen ausblenden",
"hiddenFromStats": "Aus Statistik ausgeblendet"
},
- "calendar_grid": {
- "monday": "Mo",
- "tuesday": "Di",
- "wednesday": "Mi",
- "thursday": "Do",
- "friday": "Fr",
- "saturday": "Sa",
- "sunday": "So"
- },
+
"view": {
"settingsTitle": "Ansichtseinstellungen",
"settingsDescription": "Passe an, wie Schichten in allen Kalendern angezeigt werden",
@@ -182,9 +183,20 @@
"week": "Woche",
"month": "Monat",
"year": "Jahr",
- "total": "Gesamt",
"noData": "Keine Schichten in diesem Zeitraum",
- "hours": "Stunden"
+ "hours": "Stunden",
+ "overview": "Übersicht",
+ "distribution": "Verteilung",
+ "comparison": "Vergleich",
+ "radar": "Radar",
+ "totalShifts": "Schichten gesamt",
+ "totalHours": "Stunden gesamt",
+ "avgPerShift": "⌀ pro Schicht",
+ "shortestShift": "Kürzeste Schicht",
+ "longestShift": "Längste Schicht",
+ "byType": "Nach Schichttyp",
+ "avgHoursPerShift": "⌀ Stunden/Schicht",
+ "radarDescription": "Vergleiche Top-Schichttypen nach Gesamtstunden und Durchschnitt"
},
"sync": {
"refreshing": "Aktualisiere Daten...",
diff --git a/messages/en.json b/messages/en.json
index 99181eb..1b32a10 100644
--- a/messages/en.json
+++ b/messages/en.json
@@ -24,7 +24,16 @@
"deleteError": "Failed to delete {item}",
"deleteConfirm": "Really delete {item} \"{name}\"?",
"deleteConfirmWithWarning": "Really delete {item} \"{name}\"? {warning}",
- "shifts": "Shifts"
+ "shifts": "Shifts",
+ "weekday": {
+ "monday": "Mon",
+ "tuesday": "Tue",
+ "wednesday": "Wed",
+ "thursday": "Thu",
+ "friday": "Fri",
+ "saturday": "Sat",
+ "sunday": "Sun"
+ }
},
"validation": {
"passwordMatch": "Passwords do not match",
@@ -143,15 +152,7 @@
"hidePresets": "Hide presets",
"hiddenFromStats": "Hidden from statistics"
},
- "calendar_grid": {
- "monday": "Mon",
- "tuesday": "Tue",
- "wednesday": "Wed",
- "thursday": "Thu",
- "friday": "Fri",
- "saturday": "Sat",
- "sunday": "Sun"
- },
+
"view": {
"settingsTitle": "View Settings",
"settingsDescription": "Customize how shifts are displayed in all calendars",
@@ -182,9 +183,20 @@
"week": "Week",
"month": "Month",
"year": "Year",
- "total": "Total",
"noData": "No shifts in this period",
- "hours": "Hours"
+ "hours": "Hours",
+ "overview": "Overview",
+ "distribution": "Distribution",
+ "comparison": "Comparison",
+ "radar": "Radar",
+ "totalShifts": "Total Shifts",
+ "totalHours": "Total Hours",
+ "avgPerShift": "⌀ per Shift",
+ "shortestShift": "Shortest Shift",
+ "longestShift": "Longest Shift",
+ "byType": "By Type",
+ "avgHoursPerShift": "⌀ Hours/Shift",
+ "radarDescription": "Compare top shift types by total hours and average"
},
"sync": {
"refreshing": "Refreshing data...",
diff --git a/messages/it.json b/messages/it.json
index 23b5859..8e525fd 100644
--- a/messages/it.json
+++ b/messages/it.json
@@ -24,7 +24,16 @@
"deleteError": "Impossibile eliminare {item}",
"deleteConfirm": "Eliminare davvero {item} \"{name}\"?",
"deleteConfirmWithWarning": "Eliminare davvero {item} \"{name}\"? {warning}",
- "shifts": "Turni"
+ "shifts": "Turni",
+ "weekday": {
+ "monday": "Lun",
+ "tuesday": "Mar",
+ "wednesday": "Mer",
+ "thursday": "Gio",
+ "friday": "Ven",
+ "saturday": "Sab",
+ "sunday": "Dom"
+ }
},
"validation": {
"passwordMatch": "Le password non corrispondono",
@@ -143,15 +152,7 @@
"showPresets": "Mostra preset",
"hidePresets": "Nascondi preset"
},
- "calendar_grid": {
- "monday": "Lun",
- "tuesday": "Mar",
- "wednesday": "Mer",
- "thursday": "Gio",
- "friday": "Ven",
- "saturday": "Sab",
- "sunday": "Dom"
- },
+
"view": {
"settingsTitle": "Impostazioni Vista",
"settingsDescription": "Personalizza come vengono visualizzati i turni in tutti i calendari",
@@ -181,9 +182,20 @@
"week": "Settimana",
"month": "Mese",
"year": "Anno",
- "total": "Totale",
"noData": "Nessun turno in questo periodo",
- "hours": "Ore"
+ "hours": "Ore",
+ "overview": "Panoramica",
+ "distribution": "Distribuzione",
+ "comparison": "Confronto",
+ "radar": "Radar",
+ "totalShifts": "Turni totali",
+ "totalHours": "Ore totali",
+ "avgPerShift": "⌀ per turno",
+ "shortestShift": "Turno più breve",
+ "longestShift": "Turno più lungo",
+ "byType": "Per tipo",
+ "avgHoursPerShift": "⌀ Ore/Turno",
+ "radarDescription": "Confronta i tipi di turno principali per ore totali e media"
},
"sync": {
"refreshing": "Aggiornamento dati...",
diff --git a/package-lock.json b/package-lock.json
index 221dd49..cda45a3 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -34,6 +34,7 @@
"react-colorful": "^5.6.1",
"react-day-picker": "^9.11.3",
"react-dom": "^19.2.1",
+ "recharts": "^3.6.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0"
},
@@ -2980,6 +2981,42 @@
"integrity": "sha512-HPwpGIzkl28mWyZqG52jiqDJ12waP11Pa1lGoiyUkIEuMLBP0oeK/C89esbXrxsky5we7dfd8U58nm0SgAWpVw==",
"license": "MIT"
},
+ "node_modules/@reduxjs/toolkit": {
+ "version": "2.11.2",
+ "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz",
+ "integrity": "sha512-Kd6kAHTA6/nUpp8mySPqj3en3dm0tdMIgbttnQ1xFMVpufoj+ADi8pXLBsd4xzTRHQa7t/Jv8W5UnCuW4kuWMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.0.0",
+ "@standard-schema/utils": "^0.3.0",
+ "immer": "^11.0.0",
+ "redux": "^5.0.1",
+ "redux-thunk": "^3.1.0",
+ "reselect": "^5.1.0"
+ },
+ "peerDependencies": {
+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",
+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"
+ },
+ "peerDependenciesMeta": {
+ "react": {
+ "optional": true
+ },
+ "react-redux": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@reduxjs/toolkit/node_modules/immer": {
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/immer/-/immer-11.0.1.tgz",
+ "integrity": "sha512-naDCyggtcBWANtIrjQEajhhBEuL9b0Zg4zmlWK2CzS6xCWSE39/vvf4LqnMjUAWHBhot4m9MHCM/Z+mfWhUkiA==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/immer"
+ }
+ },
"node_modules/@rtsao/scc": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",
@@ -2993,6 +3030,18 @@
"integrity": "sha512-bXHSaW5jRTmke9Vd0h5P7BtWZG9Znqb8gSDxZnxaGSJnGwPLDPfS+3g0BKzeWqzgZPsIVZkM7m2tbo18cm5HBw==",
"license": "MIT"
},
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "license": "MIT"
+ },
+ "node_modules/@standard-schema/utils": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",
+ "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",
+ "license": "MIT"
+ },
"node_modules/@swc/core-darwin-arm64": {
"version": "1.15.3",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.3.tgz",
@@ -3469,6 +3518,69 @@
"@types/node": "*"
}
},
+ "node_modules/@types/d3-array": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",
+ "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-color": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
+ "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-ease": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
+ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-interpolate": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
+ "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-color": "*"
+ }
+ },
+ "node_modules/@types/d3-path": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
+ "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-scale": {
+ "version": "4.0.9",
+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
+ "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-time": "*"
+ }
+ },
+ "node_modules/@types/d3-shape": {
+ "version": "3.1.7",
+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz",
+ "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/d3-path": "*"
+ }
+ },
+ "node_modules/@types/d3-time": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
+ "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",
+ "license": "MIT"
+ },
+ "node_modules/@types/d3-timer": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
+ "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",
+ "license": "MIT"
+ },
"node_modules/@types/estree": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
@@ -3520,6 +3632,12 @@
"@types/react": "^19.2.0"
}
},
+ "node_modules/@types/use-sync-external-store": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",
+ "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",
+ "license": "MIT"
+ },
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "8.49.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.49.0.tgz",
@@ -4701,6 +4819,127 @@
"devOptional": true,
"license": "MIT"
},
+ "node_modules/d3-array": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",
+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",
+ "license": "ISC",
+ "dependencies": {
+ "internmap": "1 - 2"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-color": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",
+ "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-ease": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz",
+ "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==",
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-format": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz",
+ "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-interpolate": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",
+ "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-color": "1 - 3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-path": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",
+ "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-scale": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",
+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-array": "2.10.0 - 3",
+ "d3-format": "1 - 3",
+ "d3-interpolate": "1.2.0 - 3",
+ "d3-time": "2.1.1 - 3",
+ "d3-time-format": "2 - 4"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-shape": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",
+ "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-path": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-time": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",
+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-array": "2 - 3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-time-format": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",
+ "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",
+ "license": "ISC",
+ "dependencies": {
+ "d3-time": "1 - 3"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/d3-timer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",
+ "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/damerau-levenshtein": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz",
@@ -4801,6 +5040,12 @@
"integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
"license": "MIT"
},
+ "node_modules/decimal.js-light": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
+ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",
+ "license": "MIT"
+ },
"node_modules/decompress-response": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
@@ -5277,6 +5522,16 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/es-toolkit": {
+ "version": "1.43.0",
+ "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.43.0.tgz",
+ "integrity": "sha512-SKCT8AsWvYzBBuUqMk4NPwFlSdqLpJwmy6AP322ERn8W2YLIB6JBXnwMI2Qsh2gfphT3q7EKAxKb23cvFHFwKA==",
+ "license": "MIT",
+ "workspaces": [
+ "docs",
+ "benchmarks"
+ ]
+ },
"node_modules/esbuild": {
"version": "0.25.12",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
@@ -5777,6 +6032,12 @@
"node": ">=0.10.0"
}
},
+ "node_modules/eventemitter3": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
+ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
+ "license": "MIT"
+ },
"node_modules/expand-template": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
@@ -6321,6 +6582,16 @@
"node": ">= 4"
}
},
+ "node_modules/immer": {
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz",
+ "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/immer"
+ }
+ },
"node_modules/import-fresh": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
@@ -6375,6 +6646,15 @@
"node": ">= 0.4"
}
},
+ "node_modules/internmap": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",
+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/intl-messageformat": {
"version": "10.7.18",
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.18.tgz",
@@ -8153,9 +8433,31 @@
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
- "dev": true,
"license": "MIT"
},
+ "node_modules/react-redux": {
+ "version": "9.2.0",
+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
+ "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/use-sync-external-store": "^0.0.6",
+ "use-sync-external-store": "^1.4.0"
+ },
+ "peerDependencies": {
+ "@types/react": "^18.2.25 || ^19",
+ "react": "^18.0 || ^19",
+ "redux": "^5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "redux": {
+ "optional": true
+ }
+ }
+ },
"node_modules/react-remove-scroll": {
"version": "2.7.2",
"resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.7.2.tgz",
@@ -8239,6 +8541,51 @@
"node": ">= 6"
}
},
+ "node_modules/recharts": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.6.0.tgz",
+ "integrity": "sha512-L5bjxvQRAe26RlToBAziKUB7whaGKEwD3znoM6fz3DrTowCIC/FnJYnuq1GEzB8Zv2kdTfaxQfi5GoH0tBinyg==",
+ "license": "MIT",
+ "workspaces": [
+ "www"
+ ],
+ "dependencies": {
+ "@reduxjs/toolkit": "1.x.x || 2.x.x",
+ "clsx": "^2.1.1",
+ "decimal.js-light": "^2.5.1",
+ "es-toolkit": "^1.39.3",
+ "eventemitter3": "^5.0.1",
+ "immer": "^10.1.1",
+ "react-redux": "8.x.x || 9.x.x",
+ "reselect": "5.1.1",
+ "tiny-invariant": "^1.3.3",
+ "use-sync-external-store": "^1.2.2",
+ "victory-vendor": "^37.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/redux": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
+ "license": "MIT"
+ },
+ "node_modules/redux-thunk": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",
+ "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",
+ "license": "MIT",
+ "peerDependencies": {
+ "redux": "^5.0.0"
+ }
+ },
"node_modules/reflect.getprototypeof": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
@@ -8283,6 +8630,12 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/reselect": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",
+ "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",
+ "license": "MIT"
+ },
"node_modules/resolve": {
"version": "1.22.11",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz",
@@ -9012,6 +9365,12 @@
"node": ">=6"
}
},
+ "node_modules/tiny-invariant": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
+ "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==",
+ "license": "MIT"
+ },
"node_modules/tinyglobby": {
"version": "0.2.15",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",
@@ -9428,12 +9787,43 @@
}
}
},
+ "node_modules/use-sync-external-store": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",
+ "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
"node_modules/util-deprecate": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"license": "MIT"
},
+ "node_modules/victory-vendor": {
+ "version": "37.3.6",
+ "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",
+ "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==",
+ "license": "MIT AND ISC",
+ "dependencies": {
+ "@types/d3-array": "^3.0.3",
+ "@types/d3-ease": "^3.0.0",
+ "@types/d3-interpolate": "^3.0.1",
+ "@types/d3-scale": "^4.0.2",
+ "@types/d3-shape": "^3.1.0",
+ "@types/d3-time": "^3.0.0",
+ "@types/d3-timer": "^3.0.0",
+ "d3-array": "^3.1.6",
+ "d3-ease": "^3.0.1",
+ "d3-interpolate": "^3.0.1",
+ "d3-scale": "^4.0.2",
+ "d3-shape": "^3.1.0",
+ "d3-time": "^3.0.0",
+ "d3-timer": "^3.0.1"
+ }
+ },
"node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
diff --git a/package.json b/package.json
index f1c479b..e22ad61 100644
--- a/package.json
+++ b/package.json
@@ -44,6 +44,7 @@
"react-colorful": "^5.6.1",
"react-day-picker": "^9.11.3",
"react-dom": "^19.2.1",
+ "recharts": "^3.6.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0"
},