Leftovers from the previous commit
This commit is contained in:
@@ -12,7 +12,7 @@ interface Props {
|
|||||||
|
|
||||||
const ReferenceViewer: React.FC<Props> = ({ showReference, selectedReference, options, setShowReference, headings = true}) => (
|
const ReferenceViewer: React.FC<Props> = ({ showReference, selectedReference, options, setShowReference, headings = true}) => (
|
||||||
<div
|
<div
|
||||||
className={`fixed inset-y-0 right-0 w-96 bg-white shadow-lg transform transition-transform duration-300 ease-in-out ${showReference ? 'translate-x-0' : 'translate-x-full'}`}
|
className={`fixed inset-y-0 right-0 w-96 bg-white shadow-lg transform transition-transform duration-300 z-50 ease-in-out ${showReference ? 'translate-x-0' : 'translate-x-full'}`}
|
||||||
>
|
>
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
<div className="p-4 border-b bg-gray-50 flex justify-between items-center">
|
<div className="p-4 border-b bg-gray-50 flex justify-between items-center">
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ExerciseLabel from '../../Shared/ExerciseLabel';
|
|||||||
import MatchSentences from '../../Exercises/MatchSentences';
|
import MatchSentences from '../../Exercises/MatchSentences';
|
||||||
import TrueFalse from '../../Exercises/TrueFalse';
|
import TrueFalse from '../../Exercises/TrueFalse';
|
||||||
import FillBlanksLetters from '../../Exercises/Blanks/Letters';
|
import FillBlanksLetters from '../../Exercises/Blanks/Letters';
|
||||||
|
import MultipleChoice from '../../Exercises/MultipleChoice';
|
||||||
|
|
||||||
const getExerciseItems = (exercises: ReadingExercise[], sectionId: number): ExerciseItem[] => {
|
const getExerciseItems = (exercises: ReadingExercise[], sectionId: number): ExerciseItem[] => {
|
||||||
|
|
||||||
@@ -87,6 +88,24 @@ const getExerciseItems = (exercises: ReadingExercise[], sectionId: number): Exer
|
|||||||
),
|
),
|
||||||
content: <TrueFalse exercise={exercise} sectionId={sectionId} />
|
content: <TrueFalse exercise={exercise} sectionId={sectionId} />
|
||||||
};
|
};
|
||||||
|
case "multipleChoice":
|
||||||
|
firstWordId = exercise.questions[0].id;
|
||||||
|
lastWordId = exercise.questions[exercise.questions.length - 1].id;
|
||||||
|
return {
|
||||||
|
id: index.toString(),
|
||||||
|
sectionId,
|
||||||
|
label: (
|
||||||
|
<ExerciseLabel
|
||||||
|
label={`Multiple Choice Questions #${firstWordId} - #${lastWordId}`}
|
||||||
|
preview={
|
||||||
|
<>
|
||||||
|
"{previewLabel(exercise.prompt)}..."
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
content: <MultipleChoice exercise={exercise} sectionId={sectionId} />
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}).filter(isExerciseItem);
|
}).filter(isExerciseItem);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { FillBlanksExercise, MatchSentencesExercise, TrueFalseExercise, WriteBlanksExercise } from "@/interfaces/exam";
|
import { FillBlanksExercise, MatchSentencesExercise, MultipleChoiceExercise, TrueFalseExercise, WriteBlanksExercise } from "@/interfaces/exam";
|
||||||
|
|
||||||
export default interface ExerciseItem {
|
export default interface ExerciseItem {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -7,7 +7,7 @@ export default interface ExerciseItem {
|
|||||||
content: React.ReactNode;
|
content: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ReadingExercise = FillBlanksExercise | TrueFalseExercise | MatchSentencesExercise | WriteBlanksExercise;
|
export type ReadingExercise = FillBlanksExercise | TrueFalseExercise | MatchSentencesExercise | WriteBlanksExercise | MultipleChoiceExercise;
|
||||||
|
|
||||||
export function isExerciseItem(item: unknown): item is ExerciseItem {
|
export function isExerciseItem(item: unknown): item is ExerciseItem {
|
||||||
return item !== undefined &&
|
return item !== undefined &&
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ export function generate(
|
|||||||
|
|
||||||
const url = `/api/exam/generate/${module}/${sectionId}${queryString ? `?${queryString}` : ''}`;
|
const url = `/api/exam/generate/${module}/${sectionId}${queryString ? `?${queryString}` : ''}`;
|
||||||
|
|
||||||
console.log(config.body);
|
|
||||||
|
|
||||||
const request = config.method === 'POST'
|
const request = config.method === 'POST'
|
||||||
? axios.post(url, config.body)
|
? axios.post(url, config.body)
|
||||||
: axios.get(url);
|
: axios.get(url);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ interface Props {
|
|||||||
|
|
||||||
const GenerateBtn: React.FC<Props> = ({module, sectionId, genType, generateFnc, className}) => {
|
const GenerateBtn: React.FC<Props> = ({module, sectionId, genType, generateFnc, className}) => {
|
||||||
const section = useExamEditorStore((store) => store.modules[module].sections.find((s)=> s.sectionId == sectionId));
|
const section = useExamEditorStore((store) => store.modules[module].sections.find((s)=> s.sectionId == sectionId));
|
||||||
if (section === undefined) return;
|
if (section === undefined) return <></>;
|
||||||
|
|
||||||
const {generating} = section;
|
const {generating} = section;
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const LevelSettings: React.FC = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const section = sections.find((section) => section.sectionId == focusedSection);
|
const section = sections.find((section) => section.sectionId == focusedSection);
|
||||||
if (section === undefined) return;
|
if (section === undefined) return <></>;
|
||||||
|
|
||||||
const currentSection = section.state as LevelPart;
|
const currentSection = section.state as LevelPart;
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const ExercisePicker: React.FC<ExercisePickerProps> = ({
|
|||||||
|
|
||||||
const [pickerOpen, setPickerOpen] = useState(false);
|
const [pickerOpen, setPickerOpen] = useState(false);
|
||||||
|
|
||||||
if (section === undefined) return;
|
if (section === undefined) return <></>;
|
||||||
|
|
||||||
const { state, selectedExercises } = section;
|
const { state, selectedExercises } = section;
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(`An unknown error has occured while import ${module} exam!`);
|
toast.error(`Make sure you've imported a valid word document (.docx)!`);
|
||||||
} finally {
|
} finally {
|
||||||
dispatch({ type: "UPDATE_MODULE", payload: { updates: { importing: false }, module } })
|
dispatch({ type: "UPDATE_MODULE", payload: { updates: { importing: false }, module } })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,8 +115,6 @@ export default function Speaking({ id, title, text, video_url, type, prompts, su
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(preview);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-4 mt-4 w-full">
|
<div className="flex flex-col gap-4 mt-4 w-full">
|
||||||
<div className="flex justify-between w-full gap-8">
|
<div className="flex justify-between w-full gap-8">
|
||||||
|
|||||||
Reference in New Issue
Block a user