Fix organization setup flow: redirect to onboarding for incomplete setup
This commit is contained in:
38
components/charts/RadarPerformanceChart.tsx
Normal file
38
components/charts/RadarPerformanceChart.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import { ResponsiveContainer, RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, Tooltip, Legend } from 'recharts';
|
||||
|
||||
export interface RadarMetric {
|
||||
label: string;
|
||||
value: number; // 0-100
|
||||
max?: number;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
title?: string;
|
||||
data: RadarMetric[];
|
||||
height?: number;
|
||||
color?: string;
|
||||
}
|
||||
|
||||
const RadarPerformanceChart: React.FC<Props> = ({ title, data, height = 320, color = '#3b82f6' }) => {
|
||||
const chartData = data.map(d => ({ subject: d.label, A: d.value, fullMark: d.max ?? 100 }));
|
||||
return (
|
||||
<div className="w-full h-full">
|
||||
{title && <h4 className="text-sm font-medium text-[--text-secondary] mb-2">{title}</h4>}
|
||||
<div style={{ width: '100%', height }}>
|
||||
<ResponsiveContainer>
|
||||
<RadarChart data={chartData} margin={{ top: 10, right: 30, bottom: 10, left: 10 }}>
|
||||
<PolarGrid stroke="var(--border-color)" />
|
||||
<PolarAngleAxis dataKey="subject" tick={{ fill: 'var(--text-secondary)', fontSize: 11 }} />
|
||||
<PolarRadiusAxis angle={30} domain={[0, 100]} tick={{ fill: 'var(--text-secondary)', fontSize: 10 }} />
|
||||
<Radar name={title || 'Score'} dataKey="A" stroke={color} fill={color} fillOpacity={0.35} />
|
||||
<Tooltip wrapperStyle={{ fontSize: 12 }} contentStyle={{ background: 'var(--background-secondary)', border: '1px solid var(--border-color)' }} />
|
||||
<Legend wrapperStyle={{ fontSize: 12 }} />
|
||||
</RadarChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default RadarPerformanceChart;
|
||||
30
components/charts/ScoreBarList.tsx
Normal file
30
components/charts/ScoreBarList.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import React from 'react';
|
||||
|
||||
interface ScoreItem { label: string; value: number; max?: number; }
|
||||
interface Props { title?: string; items: ScoreItem[]; color?: string; }
|
||||
|
||||
const ScoreBarList: React.FC<Props> = ({ title, items, color = '#6366f1' }) => {
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
{title && <h4 className="text-sm font-medium text-[--text-secondary]">{title}</h4>}
|
||||
<ul className="space-y-2">
|
||||
{items.map(it => {
|
||||
const pct = Math.min(100, Math.round((it.value / (it.max ?? 100)) * 100));
|
||||
return (
|
||||
<li key={it.label} className="space-y-1">
|
||||
<div className="flex justify-between text-xs text-[--text-secondary]">
|
||||
<span>{it.label}</span>
|
||||
<span>{it.value}{it.max ? `/${it.max}` : ''}</span>
|
||||
</div>
|
||||
<div className="h-2 bg-[--background-secondary] rounded overflow-hidden">
|
||||
<div className="h-full transition-all" style={{ width: pct + '%', background: color }} />
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ScoreBarList;
|
||||
Reference in New Issue
Block a user