Create flow cleanup

This commit is contained in:
adilallo
2026-04-11 00:29:15 -06:00
parent a5c6b8971f
commit 60d4ae6dfd
3 changed files with 21 additions and 10 deletions
+11 -3
View File
@@ -85,9 +85,15 @@ function AddPlatformModalContent({
const m = useMessages(); const m = useMessages();
const comm = m.create.communication; const comm = m.create.communication;
const modal = comm.modals[platformCardId as keyof typeof comm.modals]; const modal = comm.modals[platformCardId as keyof typeof comm.modals];
if (!modal || !("sections" in modal)) return null; const defaults =
modal && "sections" in modal
? modal.sections
: {
corePrinciple: "",
logisticsAdmin: "",
codeOfConduct: "",
};
const defaults = modal.sections;
const [sectionValues, setSectionValues] = useState< const [sectionValues, setSectionValues] = useState<
Record<SectionField, string> Record<SectionField, string>
>(() => ({ >(() => ({
@@ -104,6 +110,8 @@ function AddPlatformModalContent({
[markCreateFlowInteraction], [markCreateFlowInteraction],
); );
if (!modal || !("sections" in modal)) return null;
return ( return (
<div className="flex flex-col gap-6"> <div className="flex flex-col gap-6">
{SECTION_FIELDS.map((field) => ( {SECTION_FIELDS.map((field) => (
@@ -147,7 +155,7 @@ export default function CardsPage() {
recommended: true, recommended: true,
}; };
}), }),
[comm.cards], [comm],
); );
const title = expanded ? comm.page.expandedTitle : comm.page.compactTitle; const title = expanded ? comm.page.expandedTitle : comm.page.compactTitle;
+8 -5
View File
@@ -40,11 +40,14 @@ export default function CompletedPage() {
if (!stored) return; if (!stored) return;
const parsed = parseDocumentSectionsForDisplay(stored.document); const parsed = parseDocumentSectionsForDisplay(stored.document);
if (parsed.length === 0) return; if (parsed.length === 0) return;
setDocumentSections(parsed); // One-shot hydration from client-only storage after mount.
setHeaderTitle(stored.title); queueMicrotask(() => {
const sum = setDocumentSections(parsed);
typeof stored.summary === "string" ? stored.summary.trim() : ""; setHeaderTitle(stored.title);
setHeaderDescription(sum.length > 0 ? sum : undefined); const sum =
typeof stored.summary === "string" ? stored.summary.trim() : "";
setHeaderDescription(sum.length > 0 ? sum : undefined);
});
}, []); }, []);
const toast = !toastDismissed ? ( const toast = !toastDismissed ? (
+2 -2
View File
@@ -33,7 +33,7 @@ describe("FinalReviewPage", () => {
expect(screen.getByRole("heading", { level: 1 })).toBeInTheDocument(); expect(screen.getByRole("heading", { level: 1 })).toBeInTheDocument();
}); });
it("renders HeaderLockup with expected title", () => { it("renders lockup title", () => {
render(<FinalReviewPage />); render(<FinalReviewPage />);
expect( expect(
screen.getByRole("heading", { screen.getByRole("heading", {
@@ -42,7 +42,7 @@ describe("FinalReviewPage", () => {
).toBeInTheDocument(); ).toBeInTheDocument();
}); });
it("renders HeaderLockup with expected description", () => { it("renders lockup description", () => {
render(<FinalReviewPage />); render(<FinalReviewPage />);
expect( expect(
screen.getByText( screen.getByText(