Skip setup questions on the template path and collect name, photo, and description without recommendations.

Customize opens a dialog then walks the template decks; Use without changes lands on final review with Has Name Field. Template cards stay first, the engine is not called, and the catalog no longer shows a recommended tag.
This commit is contained in:
adilallo committed 2026-11-09 17:34:33 -07:00
1 parent 53d236d0d5
commit 6498d52541
37 files changed
+1450 -733

No files matched your search

+32 -40
View File
@@ -50,26 +50,32 @@ export const FIRST_STEP: CreateFlowStep = FLOW_STEP_ORDER[0];
export type CreateFlowNavigationOptions = {
skipCommunitySave?: boolean;
/**
* Template **Use without changes**: collect community name, description, and
* optional photo only. Skips intro, structure, size, setup questions, save,
* community review, and the custom-rule authoring segment.
* Template path. Skips size, kind, scale, maturity, and setup questions.
* Customize still walks values and the four decks; Use without changes
* jumps to final review. Identity is collected in the Customize dialog or
* on the final-review Rule card.
*/
useWithoutChangesIdentityOnly?: boolean;
templatePathMode?: "customize" | "useWithoutChanges";
};
/**
* Community + custom-rule steps skipped when
* {@link CreateFlowNavigationOptions.useWithoutChangesIdentityOnly} is set.
* Remaining identity steps: `community-name` → `community-context` →
* `community-upload`, then `final-review`.
* Community questionnaire skipped on both template-path modes. Identity is
* collected in the Customize dialog or on the final-review Rule card.
*/
const USE_WITHOUT_CHANGES_IDENTITY_SKIP = new Set<CreateFlowStep>([
const TEMPLATE_PATH_COMMUNITY_SKIP = new Set<CreateFlowStep>([
"informational",
"community-name",
"community-structure",
"community-context",
"community-size",
"setup-questions",
"community-upload",
"community-save",
"review",
]);
/** Use without changes does not run values or the four decks unless + Add opens one. */
const TEMPLATE_PATH_DECK_SKIP = new Set<CreateFlowStep>([
"core-values",
"communication-methods",
"membership-methods",
@@ -82,9 +88,11 @@ function shouldSkipStep(
options?: CreateFlowNavigationOptions,
): boolean {
if (options?.skipCommunitySave && step === "community-save") return true;
return Boolean(
options?.useWithoutChangesIdentityOnly &&
USE_WITHOUT_CHANGES_IDENTITY_SKIP.has(step),
if (!options?.templatePathMode) return false;
if (TEMPLATE_PATH_COMMUNITY_SKIP.has(step)) return true;
return (
options.templatePathMode === "useWithoutChanges" &&
TEMPLATE_PATH_DECK_SKIP.has(step)
);
}
@@ -128,13 +136,10 @@ export function getPreviousStep(
* Where the create-flow footer Back action should go. Usually the previous
* step in {@link FLOW_STEP_ORDER}.
*
* Template **Use without changes** exceptions:
* - Direct from a template (`useWithoutChangesIdentityOnly`): Back from
* `community-name` returns to template review; Back from
* `final-review` is `community-upload`.
* - In-flow (`?fromFlow=1`, community identity already collected): Back
* from `final-review` returns to template review instead of
* `conflict-management`.
* Template path:
* - Customize: Back from `core-values` returns to template review; Back from
* `final-review` is the conflict deck.
* - Use without changes: Back from `final-review` returns to template review.
*/
export type CreateFlowBackTarget =
| { kind: "step"; step: CreateFlowStep }
@@ -149,19 +154,14 @@ export function resolveCreateFlowBackTarget(
typeof templateReviewBackSlug === "string"
? templateReviewBackSlug.trim()
: "";
if (
currentStep === "community-name" &&
options?.useWithoutChangesIdentityOnly &&
slug.length > 0
) {
return { kind: "templateReview", slug };
}
if (
currentStep === "final-review" &&
slug.length > 0 &&
!options?.useWithoutChangesIdentityOnly
) {
return { kind: "templateReview", slug };
const mode = options?.templatePathMode;
if (slug.length > 0) {
if (currentStep === "core-values" && mode === "customize") {
return { kind: "templateReview", slug };
}
if (currentStep === "final-review" && mode !== "customize") {
return { kind: "templateReview", slug };
}
}
const prev = getPreviousStep(currentStep, options);
return prev != null ? { kind: "step", step: prev } : null;
@@ -289,14 +289,6 @@ export function isDirectTemplateReviewEntry(
);
}
/**
* Only set from `/create/review` “Create from template” with `fromFlow=1`.
* Enables facet-ranked `GET /api/templates` + “RECOMMENDED” on the grid; omit
* on profile and marketing so stale localStorage facets never show badges.
*/
export const TEMPLATES_FACET_RECOMMEND_QUERY = "recommendTemplates" as const;
export const TEMPLATES_FACET_RECOMMEND_VALUE = "1" as const;
/** `/create/completed?celebrate=1` — post-publish toast; set only after **initial** POST publish, not PATCH updates. */
export const CREATE_FLOW_COMPLETED_CELEBRATE_QUERY = "celebrate" as const;
export const CREATE_FLOW_COMPLETED_CELEBRATE_VALUE = "1" as const;