FIXED - Make adding a portfolio project simpler and actually saveable

- Fix critical bug: TabsContent unmounted inactive panels, so the project
  form only submitted the active tab's fields and could never save; add an
  opt-in forceMount that keeps panels mounted (hidden) and use it on all
  four project-form tabs
- Make Sections and Assets optional: a project saves with just Basics and
  Localized Content; new projects start with no sections/assets, and the
  last one can now be removed
- Update wizard progress so empty sections/assets steps count as complete
- Update save hint copy and step labels to reflect the optional steps
- Correct .claude/launch.json dev port to 3014
- Update portfolio-form-progress tests for the optional-steps behaviour
This commit is contained in:
moh
2026-09-20 01:56:50 +02:00
parent a13e33edcd
commit d78450fc47
5 changed files with 56 additions and 25 deletions
+22 -3
View File
@@ -117,10 +117,29 @@ describe("getPortfolioWizardProgress", () => {
expect(getFirstIncompleteWizardStep(progress)).toBe("content");
});
it("sections/assets steps require at least one ready entry", () => {
it("treats sections/assets as optional: empty steps are complete and the project is saveable", () => {
const noEntries = getPortfolioWizardProgress({ ...completeInput, sections: [], assets: [] });
expect(noEntries.find((s) => s.key === "sections")?.complete).toBe(false);
expect(noEntries.find((s) => s.key === "assets")?.complete).toBe(false);
expect(noEntries.find((s) => s.key === "sections")?.complete).toBe(true);
expect(noEntries.find((s) => s.key === "assets")?.complete).toBe(true);
// Basics + content only is enough to save.
expect(getFirstIncompleteWizardStep(noEntries)).toBeNull();
});
it("shows an optional summary when no sections/assets are added", () => {
const noEntries = getPortfolioWizardProgress({ ...completeInput, sections: [], assets: [] });
expect(noEntries.find((s) => s.key === "sections")?.summary).toBe("Optional — no sections added.");
expect(noEntries.find((s) => s.key === "assets")?.summary).toBe(
"Optional — no gallery assets added.",
);
});
it("blocks saving when an added section is incomplete", () => {
const progress = getPortfolioWizardProgress({
...completeInput,
sections: [section({ titleEn: "" })],
});
expect(progress.find((s) => s.key === "sections")?.complete).toBe(false);
expect(getFirstIncompleteWizardStep(progress)).toBe("sections");
});
it("summarizes section/asset readiness counts", () => {