1 import type { ReactNode } from 'react';
2 import { createContext, useContext } from 'react';
4 import type { CalendarModelEventManager } from '@proton/calendar';
6 const CalendarModelEventManagerContext = createContext<CalendarModelEventManager | null>(null);
10 calendarModelEventManager: CalendarModelEventManager;
13 const CalendarModelEventManagerProvider = ({ children, calendarModelEventManager }: Props) => {
15 <CalendarModelEventManagerContext.Provider value={calendarModelEventManager}>
17 </CalendarModelEventManagerContext.Provider>
21 export const useCalendarModelEventManager = () => {
22 const state = useContext(CalendarModelEventManagerContext);
24 throw new Error('Trying to use uninitialized ModelEventManagerProvider');
29 export default CalendarModelEventManagerProvider;