ENCOA-307
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import useExamEditorStore from "@/stores/examEditor";
|
||||
import ListeningContext from "./listening";
|
||||
import ReadingContext from "./reading";
|
||||
@@ -30,7 +29,7 @@ const LevelContext: React.FC<Props> = ({ sectionId }) => {
|
||||
)}
|
||||
{(readingSection || listeningSection || hasReadingContext) && (
|
||||
<div className="space-y-4 mb-4">
|
||||
{readingSection || hasReadingContext && <ReadingContext sectionId={sectionId} module="level" />}
|
||||
{(readingSection !== undefined || hasReadingContext) && <ReadingContext sectionId={sectionId} module="level" />}
|
||||
{listeningSection && <ListeningContext sectionId={sectionId} listeningSection={listeningSection} module="level" level={true} />}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user