All files / features/onboarding steps.ts

100% Statements 4/4
83.33% Branches 5/6
100% Functions 1/1
100% Lines 4/4

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          2x                                                 8x 8x 8x                
/**
 * The ordered onboarding journey (mirrors the Stitch "Glimme Onboarding Journey"
 * design — 11 steps). Each entry is the route for one screen; the index drives
 * the progress bar and the "Step X of 11" label.
 */
export const ONBOARDING_STEPS = [
  "/(onboarding)/welcome",
  "/(onboarding)/why-glimme",
  "/(onboarding)/find-us",
  "/(onboarding)/profile",
  "/(onboarding)/account",
  "/(onboarding)/love-story",
  "/(onboarding)/anniversary",
  "/(onboarding)/pair",
  "/(onboarding)/notifications",
  "/(onboarding)/personalizing",
  "/(onboarding)/success",
] as const;
 
export type OnboardingRoute = (typeof ONBOARDING_STEPS)[number];
 
export type StepInfo = {
  index: number;
  number: number;
  total: number;
  next: OnboardingRoute | null;
  prev: OnboardingRoute | null;
};
 
export function stepInfo(route: OnboardingRoute): StepInfo {
  const total = ONBOARDING_STEPS.length;
  const index = ONBOARDING_STEPS.indexOf(route);
  return {
    index,
    number: index + 1,
    total,
    next: ONBOARDING_STEPS[index + 1] ?? null,
    prev: index > 0 ? (ONBOARDING_STEPS[index - 1] ?? null) : null,
  };
}