Create custom flow UI

This commit is contained in:
adilallo
2026-04-17 22:25:24 -06:00
parent eedb70f9f3
commit 36dcb79870
38 changed files with 1227 additions and 250 deletions
@@ -26,4 +26,28 @@ describe("getProportionBarProgressForCreateFlowStep", () => {
"2-0",
);
});
it("uses 2-1 on communication-methods", () => {
expect(
getProportionBarProgressForCreateFlowStep("communication-methods"),
).toBe("2-1");
});
it("uses 2-2 on membership-methods", () => {
expect(
getProportionBarProgressForCreateFlowStep("membership-methods"),
).toBe("2-2");
});
it("uses 2-3 on decision-approaches (Figma Flow — Right Rail)", () => {
expect(
getProportionBarProgressForCreateFlowStep("decision-approaches"),
).toBe("2-3");
});
it("uses 3-0 on conflict-management (start of Review segment)", () => {
expect(
getProportionBarProgressForCreateFlowStep("conflict-management"),
).toBe("3-0");
});
});
+1 -1
View File
@@ -56,7 +56,7 @@ describe("createFlowStateSchema", () => {
it("accepts known fields and passthrough keys", () => {
const r = createFlowStateSchema.safeParse({
title: "My rule",
currentStep: "cards",
currentStep: "communication-methods",
customField: { nested: [1, 2] },
});
expect(r.success).toBe(true);
+5 -2
View File
@@ -16,7 +16,10 @@ describe("flowSteps", () => {
});
it("getNextStep returns next step in order", () => {
expect(getNextStep("right-rail")).toBe("confirm-stakeholders");
expect(getNextStep("communication-methods")).toBe("membership-methods");
expect(getNextStep("membership-methods")).toBe("decision-approaches");
expect(getNextStep("decision-approaches")).toBe("conflict-management");
expect(getNextStep("conflict-management")).toBe("confirm-stakeholders");
expect(getNextStep("confirm-stakeholders")).toBe("final-review");
});
@@ -67,6 +70,6 @@ describe("flowSteps", () => {
const opts = { skipCommunitySave: true } as const;
expect(getNextStep("community-size", opts)).toBe("community-upload");
expect(getNextStep("review", opts)).toBe("core-values");
expect(getPreviousStep("cards", opts)).toBe("core-values");
expect(getPreviousStep("communication-methods", opts)).toBe("core-values");
});
});
+12 -18
View File
@@ -2,27 +2,12 @@ import { describe, it, expect } from "vitest";
import { migrateLegacyCreateFlowState } from "../../lib/create/migrateLegacyCreateFlowState";
describe("migrateLegacyCreateFlowState", () => {
it("maps communityReflection to communitySaveEmail when save email empty", () => {
it("passes through object payloads", () => {
const out = migrateLegacyCreateFlowState({
title: "T",
communityReflection: "old@example.com",
});
expect(out.communitySaveEmail).toBe("old@example.com");
expect("communityReflection" in out).toBe(false);
});
it("does not overwrite existing communitySaveEmail", () => {
const out = migrateLegacyCreateFlowState({
communityReflection: "old@example.com",
communitySaveEmail: "kept@example.com",
});
expect(out.communitySaveEmail).toBe("kept@example.com");
});
it("rewrites currentStep slug", () => {
const out = migrateLegacyCreateFlowState({
currentStep: "community-reflection",
currentStep: "community-save",
});
expect(out.title).toBe("T");
expect(out.currentStep).toBe("community-save");
});
@@ -30,4 +15,13 @@ describe("migrateLegacyCreateFlowState", () => {
expect(migrateLegacyCreateFlowState(null)).toEqual({});
expect(migrateLegacyCreateFlowState(undefined)).toEqual({});
});
it("renames legacy right-rail step to decision-approaches", () => {
const out = migrateLegacyCreateFlowState({
currentStep: "right-rail",
title: "T",
});
expect(out.currentStep).toBe("decision-approaches");
expect(out.title).toBe("T");
});
});