Only hooked up the section state had forgot to plugin into Header's isEvaluationEnabled
This commit is contained in:
@@ -106,7 +106,7 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num
|
||||
onPractice: () => {
|
||||
const updatedExercise = {
|
||||
...local,
|
||||
//isPractice: !isPractice,
|
||||
isPractice: !local.isPractice,
|
||||
};
|
||||
const newState = { ...section };
|
||||
newState.exercises = newState.exercises.map((ex) =>
|
||||
@@ -242,8 +242,6 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [answers, blanksState.blanks, blanksState.textMode])
|
||||
|
||||
|
||||
|
||||
useEffect(()=> {
|
||||
setEditingAlert(editing, setAlerts);
|
||||
}, [editing])
|
||||
@@ -266,7 +264,7 @@ const FillBlanksLetters: React.FC<{ exercise: FillBlanksExercise; sectionId: num
|
||||
onDelete={handleDelete}
|
||||
setEditing={setEditing}
|
||||
onPractice={handlePractice}
|
||||
isEvaluationEnabled={true}//local.isPractice}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
>
|
||||
<>
|
||||
{!blanksState.textMode && <Card className="p-4">
|
||||
|
||||
@@ -266,7 +266,7 @@ const FillBlanksMC: React.FC<{ exercise: FillBlanksExercise; sectionId: number }
|
||||
onPractice={handlePractice}
|
||||
setEditing={setEditing}
|
||||
onBlankRemove={handleBlankRemove}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
>
|
||||
{!blanksState.textMode && selectedBlankId && (
|
||||
<Card className="p-4">
|
||||
|
||||
@@ -173,7 +173,7 @@ const WriteBlanksFill: React.FC<{ exercise: WriteBlanksExercise; sectionId: numb
|
||||
onDelete={handleDelete}
|
||||
onPractice={handlePractice}
|
||||
setEditing={setEditing}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
>
|
||||
{!blanksState.textMode && (
|
||||
<Card>
|
||||
|
||||
@@ -38,7 +38,7 @@ interface Props {
|
||||
onDiscard: () => void;
|
||||
onDelete: () => void;
|
||||
onPractice: () => void;
|
||||
isEvaluationEnabled: boolean;
|
||||
isEvaluationEnabled?: boolean;
|
||||
children: ReactNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ const MatchSentences: React.FC<{ exercise: MatchSentencesExercise, sectionId: nu
|
||||
handleDelete={handleDelete}
|
||||
handleDiscard={handleDiscard}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
>
|
||||
<button
|
||||
onClick={() => setShowReference(!showReference)}
|
||||
|
||||
@@ -121,7 +121,7 @@ const UnderlineMultipleChoice: React.FC<{exercise: MultipleChoiceExercise, secti
|
||||
handleDelete={handleDelete}
|
||||
handlePractice={handlePractice}
|
||||
handleDiscard={handleDiscard}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
/>
|
||||
{alerts.length > 0 && <Alert className="mb-6" alerts={alerts} />}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ const MultipleChoice: React.FC<MultipleChoiceProps> = ({ exercise, sectionId, op
|
||||
handleDelete={handleDelete}
|
||||
handleDiscard={handleDiscard}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
/>
|
||||
{alerts.length > 0 && <Alert className="mb-6" alerts={alerts} />}
|
||||
<Card className="mb-6">
|
||||
|
||||
@@ -145,7 +145,7 @@ const InteractiveSpeaking: React.FC<Props> = ({ sectionId, exercise, module = "s
|
||||
handleEdit={handleEdit}
|
||||
handleDiscard={handleDiscard}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
module="speaking"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -174,7 +174,7 @@ const Speaking1: React.FC<Props> = ({ sectionId, exercise, module = "speaking" }
|
||||
handleEdit={handleEdit}
|
||||
handleDiscard={handleDiscard}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
module="speaking"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -149,7 +149,7 @@ const Speaking2: React.FC<Props> = ({ sectionId, exercise, module = "speaking" }
|
||||
handleEdit={handleEdit}
|
||||
handleDiscard={handleDiscard}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
module="speaking"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -239,7 +239,7 @@ const WriteBlanks: React.FC<{ sectionId: number; exercise: WriteBlanksExercise;
|
||||
handleDiscard={handleDiscard}
|
||||
handleDelete={handleDelete}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
/>
|
||||
<div className="space-y-4">
|
||||
{alerts.length > 0 && <Alert alerts={alerts} />}
|
||||
|
||||
@@ -103,7 +103,7 @@ const Writing: React.FC<Props> = ({ sectionId, exercise, module, index }) => {
|
||||
handleEdit={handleEdit}
|
||||
handleDiscard={handleDiscard}
|
||||
handlePractice={handlePractice}
|
||||
isEvaluationEnabled={true}
|
||||
isEvaluationEnabled={!local.isPractice}
|
||||
module={"writing"}
|
||||
/>
|
||||
{alerts.length !== 0 && <Alert alerts={alerts} />}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Module } from "@/interfaces";
|
||||
import clsx from "clsx";
|
||||
import { ReactNode } from "react";
|
||||
import { MdDelete, MdEdit, MdEditOff, MdRefresh, MdSave} from "react-icons/md";
|
||||
import { HiOutlineClipboardCheck, HiOutlineClipboardList} from "react-icons/hi";
|
||||
import { MdDelete, MdEdit, MdEditOff, MdRefresh, MdSave } from "react-icons/md";
|
||||
import { HiOutlineClipboardCheck, HiOutlineClipboardList } from "react-icons/hi";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
@@ -59,7 +59,7 @@ const Header: React.FC<Props> = ({
|
||||
Edit
|
||||
</button>
|
||||
)}
|
||||
{handlePractice &&
|
||||
{handlePractice &&
|
||||
<button
|
||||
onClick={handlePractice}
|
||||
className={clsx(
|
||||
|
||||
Reference in New Issue
Block a user