Files
LegacyHUB/frontend/src/widgets/IngestionStatsChart.tsx
Vadim Malanov 7f72171572 chore: bootstrap repository with governance docs
Initialize git, add Apache-2.0 LICENSE, .gitattributes (LF line
endings), AGENTS.md (entry points, stack, discovery order, baseline
checks), RUNBOOK.md (dev boot, prod deploy with overlay, ingestion,
failures, rollback, scaling notes), .env.prod.example with rotated
credential placeholders, and dev-only warnings on .env.example.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:41:50 +03:00

93 lines
3.1 KiB
TypeScript

import {
Area,
AreaChart,
CartesianGrid,
Legend,
ResponsiveContainer,
Tooltip,
XAxis,
YAxis,
} from "recharts";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
interface Props {
data: { date: string; ingested: number; failed: number }[];
}
export function IngestionStatsChart({ data }: Props) {
return (
<Card>
<CardHeader>
<div className="flex items-center justify-between gap-4">
<div>
<CardTitle>Ingestion volume</CardTitle>
<CardDescription>Documents processed per day · last 14 days</CardDescription>
</div>
<Legend
verticalAlign="top"
iconType="circle"
wrapperStyle={{ fontSize: 11, color: "hsl(var(--muted-foreground))" }}
/>
</div>
</CardHeader>
<CardContent className="h-[260px]">
<ResponsiveContainer width="100%" height="100%">
<AreaChart data={data} margin={{ top: 5, right: 8, left: -10, bottom: 0 }}>
<defs>
<linearGradient id="ingested" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" stopColor="hsl(var(--primary))" stopOpacity={0.4} />
<stop offset="100%" stopColor="hsl(var(--primary))" stopOpacity={0} />
</linearGradient>
<linearGradient id="failed" x1="0" x2="0" y1="0" y2="1">
<stop offset="0%" stopColor="hsl(var(--destructive))" stopOpacity={0.35} />
<stop offset="100%" stopColor="hsl(var(--destructive))" stopOpacity={0} />
</linearGradient>
</defs>
<CartesianGrid stroke="hsl(var(--border))" strokeOpacity={0.5} vertical={false} />
<XAxis
dataKey="date"
tickFormatter={(v) => v.slice(5)}
stroke="hsl(var(--muted-foreground))"
fontSize={11}
tickLine={false}
axisLine={false}
/>
<YAxis
stroke="hsl(var(--muted-foreground))"
fontSize={11}
tickLine={false}
axisLine={false}
/>
<Tooltip
cursor={{ stroke: "hsl(var(--border))", strokeDasharray: "3 3" }}
contentStyle={{
background: "hsl(var(--popover))",
border: "1px solid hsl(var(--border))",
borderRadius: 12,
fontSize: 12,
boxShadow: "0 12px 40px -12px rgba(15,23,42,0.18)",
}}
/>
<Area
type="monotone"
dataKey="ingested"
stroke="hsl(var(--primary))"
strokeWidth={2}
fill="url(#ingested)"
name="Ingested"
/>
<Area
type="monotone"
dataKey="failed"
stroke="hsl(var(--destructive))"
strokeWidth={1.5}
fill="url(#failed)"
name="Failed"
/>
</AreaChart>
</ResponsiveContainer>
</CardContent>
</Card>
);
}