ENCOA-307

This commit is contained in:
Carlos-Mesquita
2025-01-05 17:46:11 +00:00
parent af9f70880a
commit 0739e044a1
5 changed files with 135 additions and 129 deletions

View File

@@ -11,11 +11,10 @@ import { Module } from "@/interfaces";
interface Props {
module: Module;
sectionId: number;
level?: boolean;
}
const ReadingContext: React.FC<Props> = ({ sectionId, module, level = false }) => {
const ReadingContext: React.FC<Props> = ({ sectionId, module }) => {
const { dispatch } = useExamEditorStore();
const sectionState = useExamEditorStore(
(state) => state.modules[module].sections.find((section) => section.sectionId === sectionId)!
@@ -55,7 +54,7 @@ const ReadingContext: React.FC<Props> = ({ sectionId, module, level = false }) =
}
});
useEffect(()=> {
useEffect(() => {
if (readingPart.text === undefined) {
setTitle('');
setContent('');
@@ -74,7 +73,9 @@ const ReadingContext: React.FC<Props> = ({ sectionId, module, level = false }) =
useEffect(() => {
const passageRes = levelGenResults.find((res) => res.generating === "passage");
const passageRes = [...levelGenResults].reverse()
.find((res) => res.generating === "passage");
if (levelGenResults && passageRes) {
setEditing(true);
setTitle(passageRes.result[0].title);