// Templates empty-state for a brand-new Record.
//
// Surfaces a curated grid of starter templates ("GET STARTED WITH A TEMPLATE").
// Clicking a card opens a full-screen preview modal showing an *anonymized*
// version of the Cedar Narrows WST Project Overview dashboard — i.e. the template the
// real output was built from, with representative/sample data and a banner.
//
// The modal header carries a black "+ Add" button. Clicking it reveals a dashed
// upload zone (drop worksheets / docs / presentations) plus a secondary
// "Create empty" action:
// • Upload → simulate a file upload, close the modal, and trigger the same
// agent dashboard-generation loader used elsewhere, ending on the
// real Cedar Narrows dashboard.
// • Create empty → insert the template (representative data) into the record
// as an editable artifact, no AI fill.
//
// Self-contained: only depends on window globals (React, icons, ProxaP,
// EditableBlock, useOutput).
const { useState: useStateTpl, useEffect: useEffectTpl, useRef: useRefTpl } = React;
/* ===== Template catalogue (renamed for the tunnel / construction domain) ===== */
const TEMPLATE_CARDS = [
{ key: 'overview', title: 'Project overview', thumb: 'kpi' },
{ key: 'safety', title: 'Safety performance scorecard', thumb: 'area' },
{ key: 'monthly', title: 'Monthly progress report', thumb: 'bars' },
{ key: 'daily', title: 'Daily field report', thumb: 'grid' },
{ key: 'cost', title: 'Cost & commercial summary', thumb: 'waterfall' },
{ key: 'weekly', title: 'Weekly status update', thumb: 'kpi' },
];
/* ===== Card thumbnail — a small abstract dashboard sketch =====
Pure CSS/SVG; `variant` lightly changes the chart so the grid has rhythm. */
function TemplateThumb({ variant = 'kpi' }) {
const sparkPts = '2,30 16,24 30,26 44,18 58,21 72,12 86,15 100,7 114,9 126,4';
const areaPts = `${sparkPts} 126,38 2,38`;
return (
{(variant === 'area' || variant === 'kpi') && (
)}
{variant === 'bars' && (
{[40, 64, 52, 78, 60, 88, 70].map((h, i) => (
))}
)}
{variant === 'grid' && (
{Array.from({ length: 8 }).map((_, i) => )}
)}
{variant === 'waterfall' && (
)}
);
}
/* ===== Anonymized dashboard — the body of the preview modal =====
Mirrors the structure of SectionOverview but with representative/sample data
and bracketed placeholders for anything project-specific. Editable when
rendered as an inserted record artifact (Create empty). */
function TplStatTile({ label, value, sub, tone }) {
return (