| 1 | import { useCallback } from "react"; |
| 2 | |
| 3 | import { ensureClientSettingsHydrated, persistClientSettingsUpdate } from "../hooks/useSettings"; |
| 4 | |
| 5 | /** |
| 6 | * Marks first-run onboarding finished (or skipped) so FirstRunGate never |
| 7 | * routes to the welcome wizard again. The gate itself lives in |
| 8 | * `components/onboarding/FirstRunGate.tsx`. |
| 9 | */ |
| 10 | export function useCompleteOnboarding(): () => Promise<void> { |
| 11 | return useCallback(async () => { |
| 12 | await ensureClientSettingsHydrated(); |
| 13 | const onboardingCompletedAt = new Date().toISOString(); |
| 14 | await persistClientSettingsUpdate((current) => ({ ...current, onboardingCompletedAt })); |
| 15 | }, []); |
| 16 | } |