Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 39x | // src/contexts/ModalContext.ts
import { createContext } from 'react';
/**
* Defines the names of all modals used in the application.
* Using a type ensures consistency and prevents typos.
*/
export type ModalType = 'profile' | 'voiceAssistant' | 'whatsNew' | 'correctionTool';
/**
* Defines the shape of the context that will be provided to consumers.
*/
export interface ModalContextType {
openModal: (modal: ModalType) => void;
closeModal: (modal: ModalType) => void;
isModalOpen: (modal: ModalType) => boolean;
}
// Create the context with a default value (which should not be used directly).
export const ModalContext = createContext<ModalContextType | undefined>(undefined);
|