managarten/memoro/apps/mobile/features/onboarding/contexts/OnboardingContext.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

43 lines
1.4 KiB
TypeScript

import React, { createContext, useContext, ReactNode } from 'react';
import { useOnboardingToasts } from '~/features/toast/onboarding/onboardingToasts';
interface OnboardingContextValue {
showPageOnboardingToast: (pageName: any) => void;
cleanupPageToast: (pageName: any) => void;
pageOnboardingModal: {
visible: boolean;
pageName: string | null;
title: string;
message: string;
features: Array<{ icon: string; title: string; description: string }>;
actionLabel: string;
};
closePageOnboardingModal: () => void;
showCompletionToast: () => void;
handleFirstRecordingCompleted: () => void;
hasCompletedFirstRecording: boolean;
hasSeenCompletionCelebration: boolean;
pageOnboardingSeen: Record<string, boolean>;
isLoading: boolean;
resetOnboardingForTesting: () => void;
}
const OnboardingContext = createContext<OnboardingContextValue | undefined>(undefined);
export const OnboardingProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
const onboardingData = useOnboardingToasts();
return (
<OnboardingContext.Provider value={onboardingData}>
{children}
</OnboardingContext.Provider>
);
};
export const usePageOnboarding = () => {
const context = useContext(OnboardingContext);
if (!context) {
throw new Error('usePageOnboarding must be used within OnboardingProvider');
}
return context;
};