Ask the six optional setup questions after size so each tick can change suggested cards, keeping the answers on the draft and off the published Rule.

This commit is contained in:
adilallo committed 2026-11-05 20:26:07 -07:00
1 parent b4bfa157f8
commit bdaf1818d9
23 files changed
+399 -82

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
import type { CreateFlowState } from "../../app/(app)/create/types";
import { TRAIT_KEYS, type TraitKey } from "./deckTypes";
export const EMPTY_SETUP_TRAITS: Record<TraitKey, boolean> = {
network: false,
nonvoters: false,
employer: false,
sponsor: false,
records: false,
risky: false,
};
export function tickedSetupTraitIds(
traits: CreateFlowState["setupTraits"],
): TraitKey[] {
if (!traits) return [];
return TRAIT_KEYS.filter((key) => traits[key] === true);
}
export function setupTraitsFromTickedIds(
ids: readonly string[],
): Record<TraitKey, boolean> {
const ticked = new Set(ids);
const out = { ...EMPTY_SETUP_TRAITS };
for (const key of TRAIT_KEYS) {
out[key] = ticked.has(key);
}
return out;
}
export function hasTickedSetupTrait(
traits: CreateFlowState["setupTraits"],
): boolean {
return tickedSetupTraitIds(traits).length > 0;
}