This commit is contained in:
2026-04-05 00:43:23 +05:30
commit 8be37d3e92
425 changed files with 101853 additions and 0 deletions

View File

@@ -0,0 +1,96 @@
"use client";
import { SatisfactionPoint } from "@/lib/types";
import {
LineChart,
Line,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
} from "recharts";
interface Props {
data: SatisfactionPoint[];
}
export default function SatisfactionChart({ data }: Props) {
if (!data || data.length === 0) {
return (
<div className="flex items-center justify-center h-48 text-slate-600 text-xs font-mono">
No satisfaction data yet
</div>
);
}
return (
<div className="relative">
{/* Legend */}
<div className="flex gap-4 justify-end mb-3 text-[10px] font-mono">
<div className="flex items-center gap-1.5">
<span className="size-1.5 rounded-full bg-[#B7A6FB] shadow-[0_0_5px_#B7A6FB]" />
<span className="text-slate-400">Agent A</span>
</div>
<div className="flex items-center gap-1.5">
<span className="size-1.5 rounded-full bg-cyan-400 shadow-[0_0_5px_#22d3ee]" />
<span className="text-slate-400">Agent B</span>
</div>
</div>
<ResponsiveContainer width="100%" height={200}>
<LineChart data={data} margin={{ top: 4, right: 8, left: -20, bottom: 0 }}>
<CartesianGrid strokeDasharray="3 3" stroke="rgba(255,255,255,0.04)" />
<XAxis
dataKey="round"
tick={{ fill: "#475569", fontSize: 10, fontFamily: "JetBrains Mono" }}
axisLine={{ stroke: "rgba(255,255,255,0.05)" }}
tickLine={false}
/>
<YAxis
domain={[0, 100]}
tick={{ fill: "#475569", fontSize: 10, fontFamily: "JetBrains Mono" }}
axisLine={false}
tickLine={false}
tickFormatter={(v) => `${v}%`}
/>
<Tooltip
contentStyle={{
background: "rgba(7, 3, 18, 0.9)",
border: "1px solid rgba(183, 166, 251, 0.2)",
borderRadius: 8,
backdropFilter: "blur(12px)",
}}
labelStyle={{ color: "#94a3b8", fontFamily: "JetBrains Mono", fontSize: 10 }}
itemStyle={{ color: "#e2e8f0", fontFamily: "JetBrains Mono", fontSize: 11 }}
formatter={(value: number | undefined) => [`${(value ?? 0).toFixed(0)}%`]}
/>
<Line
type="monotone"
dataKey="score_a"
stroke="#B7A6FB"
strokeWidth={1.5}
dot={{ fill: "#000", stroke: "#B7A6FB", strokeWidth: 1, r: 2 }}
activeDot={{ r: 4, fill: "#B7A6FB", stroke: "white", strokeWidth: 1 }}
name="Agent A"
/>
<Line
type="monotone"
dataKey="score_b"
stroke="#22d3ee"
strokeWidth={1.5}
dot={{ fill: "#000", stroke: "#22d3ee", strokeWidth: 1, r: 2 }}
activeDot={{ r: 4, fill: "#22d3ee", stroke: "white", strokeWidth: 1 }}
name="Agent B"
/>
</LineChart>
</ResponsiveContainer>
</div>
);
}
interface Props {
data: SatisfactionPoint[];
}