import useExamEditorStore from "@/stores/examEditor"; import ListeningContext from "./listening"; import ReadingContext from "./reading"; import GenLoader from "../../Exercises/Shared/GenLoader"; interface Props { sectionId: number; } const LevelContext: React.FC = ({ sectionId }) => { const { currentModule } = useExamEditorStore(); const { generating, readingSection, listeningSection, state } = useExamEditorStore( (state) => state.modules[currentModule].sections.find((section) => section.sectionId === sectionId)! ); const hasReadingContext = 'text' in state && state.text !== undefined && typeof state.text === 'object' && 'content' in state.text && state.text.content !== undefined && state.text.content !== ""; return ( <> {generating && ( (generating === "passage" && ) || (generating === "listeningScript" && ) )} {(readingSection || listeningSection || hasReadingContext) && (
{(readingSection !== undefined || hasReadingContext) && } {listeningSection && }
)} ); }; export default LevelContext;