feat(evolver): TrialsGrid + BaseDiff + BaseHistory 3 컴포넌트

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 02:16:15 +09:00
parent 734bc6532e
commit b99d720179
3 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
import React from 'react';
import {
LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer,
} from 'recharts';
const METRIC_NAMES = ['freq', 'finger', 'gap', 'cooccur', 'divers'];
const COLORS = ['#34d399', '#60a5fa', '#fbbf24', '#f43f5e', '#c084fc'];
export default function BaseHistory({ history }) {
if (!history || history.length === 0) {
return (
<div className="evolver-card base-history empty">
<h2>12 Base 변화</h2>
<p className="muted">학습 이력이 부족합니다.</p>
</div>
);
}
const data = history
.slice()
.reverse()
.map(h => {
const w = h.weight || [0, 0, 0, 0, 0];
return {
date: (h.effective_from || '').slice(5),
freq: w[0], finger: w[1], gap: w[2], cooccur: w[3], divers: w[4],
reason: h.update_reason,
};
});
return (
<div className="evolver-card base-history">
<h2>Base 변화 (최근 {history.length})</h2>
<ResponsiveContainer width="100%" height={280}>
<LineChart data={data}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="date" />
<YAxis domain={[0, 0.5]} />
<Tooltip />
<Legend />
{METRIC_NAMES.map((name, i) => (
<Line key={name} type="monotone" dataKey={name} stroke={COLORS[i]} dot />
))}
</LineChart>
</ResponsiveContainer>
</div>
);
}