Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1x 1x 3x 2x 5x | import { create } from "zustand";
/**
* Local onboarding state (skeleton). Collects the answers from the onboarding
* journey so later steps can summarize them. In production these are persisted
* to the user's Firestore document; `completed` would live there too.
*/
export type RelationshipStatus =
| "longDistance"
| "closeTogether"
| "dating"
| "engaged"
| "married"
| "other";
export type OnboardingData = {
source: string | null;
displayName: string;
gender: string | null;
age: string;
relationship: RelationshipStatus | null;
anniversary: string | null; // ISO date string
notificationsEnabled: boolean;
completed: boolean;
};
type OnboardingState = OnboardingData & {
patch: (partial: Partial<OnboardingData>) => void;
complete: () => void;
reset: () => void;
};
const initial: OnboardingData = {
source: null,
displayName: "",
gender: null,
age: "",
relationship: null,
anniversary: null,
notificationsEnabled: false,
completed: false,
};
export const useOnboarding = create<OnboardingState>((set) => ({
...initial,
patch: (partial) => set(partial),
complete: () => set({ completed: true }),
reset: () => set(initial),
}));
|