refactor(admin): split roadmap page.tsx into colocated components

Split 876-LOC page.tsx into 146 LOC with 7 colocated components
(RoadmapCard, CreateRoadmapModal, CreateItemModal, ImportWizard,
RoadmapDetailView split into header + items table), plus _types.ts,
_constants.ts, and _api.ts. Behavior preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-04-14 22:52:20 +02:00
parent d5287f4bdd
commit 6571b580dc
11 changed files with 778 additions and 738 deletions

View File

@@ -0,0 +1,62 @@
import type { Roadmap, RoadmapStats } from '../_types'
import { statusColors, statusLabels } from '../_constants'
export function RoadmapDetailHeader({
roadmap,
stats,
onCreateItem,
}: {
roadmap: Roadmap
stats: RoadmapStats | null
onCreateItem: () => void
}) {
return (
<div className="bg-white rounded-xl border-2 border-gray-200 p-6 mb-6">
<div className="flex items-start justify-between mb-4">
<div>
<h2 className="text-xl font-bold text-gray-900">{roadmap.title}</h2>
<p className="text-sm text-gray-500 mt-1">{roadmap.description}</p>
</div>
<span className={`px-3 py-1 text-sm rounded-full ${statusColors[roadmap.status]}`}>
{statusLabels[roadmap.status]}
</span>
</div>
<div className="mb-4">
<div className="flex justify-between text-sm text-gray-500 mb-1">
<span>{roadmap.completed_items}/{roadmap.total_items} Items abgeschlossen</span>
<span>{roadmap.progress}%</span>
</div>
<div className="w-full h-3 bg-gray-100 rounded-full overflow-hidden">
<div className="h-full bg-purple-500 rounded-full transition-all" style={{ width: `${roadmap.progress}%` }} />
</div>
</div>
{stats && (
<div className="grid grid-cols-4 gap-4 mb-4">
<div className="bg-gray-50 rounded-lg p-3 text-center">
<div className="text-2xl font-bold text-red-600">{stats.overdue_items}</div>
<div className="text-xs text-gray-500">Ueberfaellig</div>
</div>
<div className="bg-gray-50 rounded-lg p-3 text-center">
<div className="text-2xl font-bold text-yellow-600">{stats.upcoming_items}</div>
<div className="text-xs text-gray-500">Anstehend</div>
</div>
<div className="bg-gray-50 rounded-lg p-3 text-center">
<div className="text-2xl font-bold text-gray-900">{stats.total_effort_days}</div>
<div className="text-xs text-gray-500">Aufwand (Tage)</div>
</div>
<div className="bg-gray-50 rounded-lg p-3 text-center">
<div className="text-2xl font-bold text-purple-600">{stats.progress}%</div>
<div className="text-xs text-gray-500">Fortschritt</div>
</div>
</div>
)}
<button onClick={onCreateItem}
className="px-3 py-1.5 text-sm bg-purple-600 text-white rounded-lg hover:bg-purple-700">
Neues Item
</button>
</div>
)
}