forked from OurHike/OurHike
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonboardingSteps.ts
More file actions
36 lines (30 loc) · 1.16 KB
/
Copy pathonboardingSteps.ts
File metadata and controls
36 lines (30 loc) · 1.16 KB
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
// Onboarding step counter. See WIREFRAMES.md's Onboarding — Tier 1 section:
// three skippable screens, counter derived from the live step list so a
// skipped step still counts (the total never shrinks mid-flow) and a future
// step (e.g. trail name, still Post-MVP) can be added without touching call
// sites - they all just read ONBOARDING_STEPS.length indirectly.
export interface OnboardingStep {
id: 'what-ourhike-is' | 'map-size' | 'location-permission'
skippable: true
}
export const ONBOARDING_STEPS: OnboardingStep[] = [
{ id: 'what-ourhike-is', skippable: true },
{ id: 'map-size', skippable: true },
{ id: 'location-permission', skippable: true },
]
export interface OnboardingProgressInput {
currentStepId: OnboardingStep['id']
skippedStepIds: OnboardingStep['id'][]
}
export interface OnboardingProgress {
position: number
total: number
label: string
}
export function buildOnboardingProgress({
currentStepId,
}: OnboardingProgressInput): OnboardingProgress {
const total = ONBOARDING_STEPS.length
const position = ONBOARDING_STEPS.findIndex((s) => s.id === currentStepId) + 1
return { position, total, label: `${position} of ${total}` }
}