import { useEffect, useState } from 'react';
import PageHeader from '@/components/workshop/PageHeader';
import BoundaryNotice from '@/components/workshop/BoundaryNotice';
import LoadingPanel from '@/components/workshop/LoadingPanel';
import MetricCard from '@/components/dashboard/MetricCard';
import { dashboardService } from '@/services/dashboardService';
export default function Dashboard() { const [data,setData]=useState(null); useEffect(()=>{dashboardService.summary().then(setData)},[]); if(!data)return <LoadingPanel/>; const cards=[['Active cover projects',data.active,'/projects?active=true'],['Measurements awaiting completion',data.measurements,'/measurements?status=open'],['Awaiting customer clarification',data.clarification,'/projects?status=Awaiting+customer+clarification'],['Designs awaiting selection',data.selection,'/projects?status=Designs+awaiting+selection'],['Awaiting workshop review',data.review,'/projects?status=Awaiting+workshop+review'],['Quotes awaiting acceptance',0,'/not-implemented?feature=Quotes'],['Orders awaiting payment',0,'/not-implemented?feature=Orders'],['NDIS / plan approval',0,'/not-implemented?feature=Orders'],['Covers awaiting print',0,'/not-implemented?feature=Manufacturing'],['Currently printing',0,'/not-implemented?feature=Manufacturing'],['Awaiting final inspection',0,'/not-implemented?feature=Manufacturing'],['Ready to ship',0,'/not-implemented?feature=Shipping'],['Recently completed',data.completed.length,'/projects?status=Complete'],['Returning customers',data.returning,'/customers?returning=true']]; return <><PageHeader eyebrow="Private Prosthetic Cover Design and Production Studio" title="Workshop Dashboard" description="Live workshop records. Production areas not yet built show zero and are explicitly marked on opening."/><BoundaryNotice/><div className="mt-6 grid gap-4 sm:grid-cols-2 xl:grid-cols-4">{cards.map(c=><MetricCard key={c[0]} label={c[0]} value={c[1]} to={c[2]}/>)}</div><div className="mt-6 grid gap-4 md:grid-cols-3"><MetricCard label="SHiREVault connection" value="Unavailable" detail="Base44 cannot mount the private network drive" to="/migration-readiness"/><MetricCard label="Last verified export" value="None" detail="Not yet implemented — Stage 4" to="/migration-readiness"/><MetricCard label="Last verified backup" value="None" detail="Not claimed while Base44-hosted" to="/migration-readiness"/></div></> }