Each page.tsx was >500 LOC (610/602/596). Extracted React components to _components/ and custom hook to _hooks/ per-route, reducing all three page.tsx orchestrators to 107/229/120 LOC respectively. Zero behavior changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
687 B
TypeScript
29 lines
687 B
TypeScript
export function RiskBar({
|
|
label,
|
|
count,
|
|
total,
|
|
color,
|
|
}: {
|
|
label: string
|
|
count: number
|
|
total: number
|
|
color: string
|
|
}) {
|
|
const percentage = total > 0 ? (count / total) * 100 : 0
|
|
|
|
return (
|
|
<div>
|
|
<div className="flex justify-between text-sm mb-1">
|
|
<span className="text-gray-600 dark:text-gray-400">{label}</span>
|
|
<span className="font-medium text-gray-900 dark:text-white">{count}</span>
|
|
</div>
|
|
<div className="w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2">
|
|
<div
|
|
className={`${color} h-2 rounded-full transition-all`}
|
|
style={{ width: `${percentage}%` }}
|
|
/>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|