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>
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
'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>
|
|
)
|
|
}
|