"use client"; import { ONBOARDING_STEP_ORDER, type OnboardingStep, } from "@multica/core/onboarding"; import { cn } from "@multica/ui/lib/utils"; import { useT } from "../../i18n"; /** * Horizontal step indicator shown at the top of every onboarding step * except Welcome. * * Layout: a row of dots on the left (one per step in * `ONBOARDING_STEP_ORDER`) and a plaintext "Step N of M" counter on * the right. The dots show three states driven by the current step's * position in the canonical order: * * - `done` filled with primary color (index < current) * - `current` filled + ring for emphasis (index === current) * - `pending` hollow / muted (index > current) * * The indicator derives both its dots and text from the same source — * the canonical ONBOARDING_STEP_ORDER plus the caller-provided * `currentStep` — so adding, removing, or reordering a step only * requires editing the array. * * Not rendered on the Welcome screen: the caller (OnboardingFlow) * decides whether to include this component based on whether the * current render step is "welcome". See flow orchestrator for the * mapping from local UI step to the canonical `OnboardingStep`. */ export function StepHeader({ currentStep }: { currentStep: OnboardingStep }) { const { t } = useT("onboarding"); const total = ONBOARDING_STEP_ORDER.length; const currentIndex = ONBOARDING_STEP_ORDER.indexOf(currentStep); // Defensive: unknown step → render a disabled-looking header rather // than throw. Happens if the caller's local step union and the store // enum drift during refactors. const safeIndex = currentIndex === -1 ? 0 : currentIndex; return (