refactor(admin): split multi-tenant page.tsx into colocated components

Extract types, constants, helpers, and UI pieces (LoadingSkeleton,
EmptyState, StatCard, ComplianceRing, Modal, TenantCard,
CreateTenantModal, EditTenantModal, TenantDetailModal) into
_components/ and _types.ts to bring page.tsx from 1663 LOC to
432 LOC (under the 500 hard cap). Behavior preserved.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-04-11 22:47:59 +02:00
parent 74927c6f66
commit dca0c96f2a
13 changed files with 1268 additions and 1246 deletions

View File

@@ -0,0 +1,51 @@
'use client'
import React from 'react'
export function StatCard({
label,
value,
icon,
color,
}: {
label: string
value: string | number
icon: React.ReactNode
color: 'indigo' | 'green' | 'blue' | 'red'
}) {
const colorMap = {
indigo: {
iconBg: 'bg-indigo-100',
iconText: 'text-indigo-600',
valueBg: '',
},
green: {
iconBg: 'bg-green-100',
iconText: 'text-green-600',
valueBg: '',
},
blue: {
iconBg: 'bg-blue-100',
iconText: 'text-blue-600',
valueBg: '',
},
red: {
iconBg: 'bg-red-100',
iconText: 'text-red-600',
valueBg: '',
},
}
const c = colorMap[color]
return (
<div className="bg-white rounded-xl border border-slate-200 p-5 hover:shadow-sm transition-shadow">
<div className="flex items-center gap-3 mb-3">
<div className={`w-10 h-10 rounded-lg ${c.iconBg} flex items-center justify-center`}>
<span className={c.iconText}>{icon}</span>
</div>
<span className="text-sm font-medium text-slate-500">{label}</span>
</div>
<div className="text-2xl font-bold text-slate-900">{value}</div>
</div>
)
}