// Atlas · Step 3 — Outline (dynamic from real parsedScope + outline) const { useState: useStateOutline } = React; function StepOutline({ outline: outlineRaw, setOutline, reportId, parsedScope, intake, goBack, goNext, goForward, readOnly }) { const outline = Array.isArray(outlineRaw) ? outlineRaw : []; const [chat, setChat] = useStateOutline(""); const [chatLoading, setChatLoading] = useStateOutline(false); const [revisionDone, setRevisionDone] = useStateOutline(false); const [changeSummary, setChangeSummary] = useStateOutline(null); const [flags, setFlags] = useStateOutline([]); const [dismissedFlags, setDismissedFlags] = useStateOutline(new Set()); const [previousOutline, setPreviousOutline] = useStateOutline(null); const clean = (s) => s ? s.replace(/<[^>]+>/g, "") : ""; const flagIcon = (type) => ({ COVERAGE_GAP: "⚠", OUT_OF_SCOPE: "⚠", SCOPE_DRIFT: "ℹ", STRUCTURAL_WARNING: "·" }[type] || "·"); const handleUndo = async () => { if (!previousOutline) return; setOutline(previousOutline); setFlags([]); setDismissedFlags(new Set()); setPreviousOutline(null); setRevisionDone(false); setChangeSummary(null); try { await fetch(`/api/outline/${reportId}`, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ chapters: previousOutline }), }); } catch (_) {} }; const { FORMATS } = window.ATLAS_DATA; const formatLabel = FORMATS.find((f) => f.id === (intake?.format || "pptx"))?.label || "PowerPoint"; const title = parsedScope?.title || "Your report"; const subtitle = parsedScope?.subtitle || ""; const allQuestions = parsedScope?.questions || []; // "Q1, Q3" → "questions 1 and 3" const formatQuestionRefs = (str) => { if (!str) return null; const nums = str.match(/\d+/g); if (!nums || nums.length === 0) return null; const labels = nums.map(n => n); if (labels.length === 1) return `question ${labels[0]}`; return `questions ${labels.slice(0, -1).join(", ")} and ${labels[labels.length - 1]}`; }; return (
Atlas will deliver a {formatLabel} with{" "} {outline.length > 0 ? outline.length : "the"} chapter{outline.length !== 1 ? "s" : ""}{" "} outlined below. Review and request any changes before approving.
{/* Chat with Outline Agent */} {!readOnly &&{clean(c.blurb)} {formatQuestionRefs(c.addresses_questions) && ( {" "}Covers {formatQuestionRefs(c.addresses_questions)}. )}