"use client" import * as React from "react" import { Area, AreaChart, CartesianGrid, XAxis } from "recharts" import { Card, CardAction, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" import { ChartContainer, ChartTooltip, ChartTooltipContent, type ChartConfig, } from "@/components/ui/chart" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select" import { ToggleGroup, ToggleGroupItem, } from "@/components/ui/toggle-group" import { useI18n } from "@/i18n/provider" const chartData = [ { date: "2026-03-01", activeSessions: 18, indexedDocs: 12 }, { date: "2026-03-02", activeSessions: 22, indexedDocs: 15 }, { date: "2026-03-03", activeSessions: 21, indexedDocs: 16 }, { date: "2026-03-04", activeSessions: 28, indexedDocs: 20 }, { date: "2026-03-05", activeSessions: 32, indexedDocs: 24 }, { date: "2026-03-06", activeSessions: 31, indexedDocs: 26 }, { date: "2026-03-07", activeSessions: 36, indexedDocs: 30 }, { date: "2026-03-08", activeSessions: 34, indexedDocs: 32 }, { date: "2026-03-09", activeSessions: 39, indexedDocs: 34 }, { date: "2026-03-10", activeSessions: 41, indexedDocs: 37 }, { date: "2026-03-11", activeSessions: 43, indexedDocs: 40 }, { date: "2026-03-12", activeSessions: 46, indexedDocs: 44 }, { date: "2026-03-13", activeSessions: 44, indexedDocs: 46 }, { date: "2026-03-14", activeSessions: 49, indexedDocs: 50 }, ] export function ChartAreaInteractive() { const t = useI18n() const [timeRange, setTimeRange] = React.useState("14d") const filteredData = chartData.slice(timeRange === "7d" ? -7 : -14) const chartConfig = { activeSessions: { label: t("scaffold.activeSessions"), color: "var(--primary)", }, indexedDocs: { label: t("scaffold.indexedDocs"), color: "var(--chart-2)", }, } satisfies ChartConfig return ( {t("scaffold.recentActivity")} {t("scaffold.activityDescription")} { setTimeRange(value[0] ?? "14d") }} variant="outline" className="hidden *:data-[slot=toggle-group-item]:px-4! @[767px]/card:flex" > {t("scaffold.last14Days")} {t("scaffold.last7Days")} value.slice(5)} /> } /> ) }