Ts changes weren't staged, it compiles still doesnt build building
This commit is contained in:
@@ -78,6 +78,7 @@ export const UnderlineQuestion: React.FC<UnderlineQuestionProps> = ({
|
||||
|
||||
useEffect(() => {
|
||||
validateQuestion(question);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [question]);
|
||||
|
||||
const handlePromptChange = (value: string) => {
|
||||
|
||||
@@ -32,6 +32,7 @@ const useSectionEdit = ({
|
||||
|
||||
const handleEdit = useCallback(() => {
|
||||
setEditing(true);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [sectionId, setEditing, updateRoot]);
|
||||
|
||||
const handleSave = useCallback(() => {
|
||||
@@ -41,17 +42,20 @@ const useSectionEdit = ({
|
||||
setEditing(false);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [setEditing, updateRoot, onSave, sectionId]);
|
||||
|
||||
const handleDiscard = useCallback(() => {
|
||||
setEditing(false);
|
||||
onDiscard?.();
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [setEditing, updateRoot, onDiscard, sectionId]);
|
||||
|
||||
const modeHandle = useCallback(() => {
|
||||
setEditing(!editing);
|
||||
onMode?.();
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [setEditing, editing, updateRoot, onMode, sectionId]);
|
||||
|
||||
return {
|
||||
|
||||
@@ -76,7 +76,8 @@ const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
|
||||
const newSectionsStates = data.parts.map(
|
||||
(part: ReadingPart, index: number) => defaultSectionSettings(module, index + 1, part)
|
||||
);
|
||||
dispatch({type: "UPDATE_MODULE", payload: {
|
||||
dispatch({
|
||||
type: "UPDATE_MODULE", payload: {
|
||||
updates: {
|
||||
sections: newSectionsStates,
|
||||
minTimer: data.minTimer,
|
||||
@@ -84,7 +85,8 @@ const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
|
||||
importing: false,
|
||||
},
|
||||
module
|
||||
}});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -92,11 +94,12 @@ const WordUploader: React.FC<{ module: Module }> = ({ module }) => {
|
||||
} finally {
|
||||
dispatch({ type: "UPDATE_MODULE", payload: { updates: { importing: false }, module } })
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [
|
||||
examFile,
|
||||
solutionsFile,
|
||||
dispatch,
|
||||
module
|
||||
currentModule
|
||||
]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -7,7 +7,7 @@ import { capitalize } from "lodash";
|
||||
import { Difficulty } from "@/interfaces/exam";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { toast } from "react-toastify";
|
||||
import { ModuleState } from "@/stores/examEditor/types";
|
||||
import { ModuleState, SectionState } from "@/stores/examEditor/types";
|
||||
import { Module } from "@/interfaces";
|
||||
import useExamEditorStore from "@/stores/examEditor";
|
||||
import WritingSettings from "./SettingsEditor/writing";
|
||||
@@ -38,8 +38,8 @@ const ExamEditor: React.FC = () => {
|
||||
useEffect(() => {
|
||||
const currentSections = sections;
|
||||
const currentLabels = sectionLabels;
|
||||
let updatedSections;
|
||||
let updatedLabels;
|
||||
let updatedSections: SectionState[];
|
||||
let updatedLabels: any;
|
||||
|
||||
if (numberOfParts > currentSections.length) {
|
||||
const newSections = [...currentSections];
|
||||
@@ -76,6 +76,7 @@ const ExamEditor: React.FC = () => {
|
||||
}
|
||||
}
|
||||
});
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [numberOfParts]);
|
||||
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export default function TrueFalseSolution({prompt, type, id, questions, userSolu
|
||||
{userSolutions &&
|
||||
questions.map((question, index) => {
|
||||
const userSolution = userSolutions.find((x) => x.id === question.id.toString());
|
||||
const solution = question.solution.toString().toLowerCase() as Solution;
|
||||
const solution = question?.solution?.toString().toLowerCase() as Solution;
|
||||
|
||||
return (
|
||||
<div key={question.id.toString()} className="flex flex-col gap-4">
|
||||
|
||||
@@ -8,6 +8,7 @@ interface Props {
|
||||
|
||||
const UserDisplay = (displayUser: User) => (
|
||||
<div className="flex w-full p-4 gap-4 items-center hover:bg-mti-purple-ultralight cursor-pointer transition ease-in-out duration-300">
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img src={displayUser.profilePicture} alt={displayUser.name} className="rounded-full w-10 h-10" />
|
||||
<div className="flex flex-col gap-1 items-start">
|
||||
<span>{displayUser.name}</span>
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
getFilteredRowModel,
|
||||
FilterFn,
|
||||
} from '@tanstack/react-table';
|
||||
import { UserImport } from "./IUserImport";
|
||||
import { UserImport } from "../interfaces/IUserImport";
|
||||
|
||||
const globalFilterFn: FilterFn<any> = (row, columnId, filterValue: string) => {
|
||||
const value = row.getValue(columnId);
|
||||
@@ -198,23 +198,27 @@ export default function Listening({ exam, showSolutions = false, preview = false
|
||||
|
||||
const renderAudioPlayer = () => (
|
||||
<div className="flex flex-col gap-8 w-full bg-mti-gray-seasalt rounded-xl py-8 px-16">
|
||||
{exam.parts[partIndex].audio ? (
|
||||
{exam?.parts[partIndex]?.audio?.source ? (
|
||||
<>
|
||||
<div className="flex flex-col w-full gap-2">
|
||||
<h4 className="text-xl font-semibold">Please listen to the following audio attentively.</h4>
|
||||
<span className="text-base">
|
||||
{exam.parts[partIndex].audio.repeatableTimes > 0
|
||||
? `You will only be allowed to listen to the audio ${exam.parts[partIndex].audio.repeatableTimes - timesListened} time(s).`
|
||||
: "You may listen to the audio as many times as you would like."}
|
||||
{(() => {
|
||||
const audioRepeatTimes = exam?.parts[partIndex]?.audio?.repeatableTimes;
|
||||
return audioRepeatTimes && audioRepeatTimes > 0
|
||||
? `You will only be allowed to listen to the audio ${audioRepeatTimes - timesListened} time(s).`
|
||||
: "You may listen to the audio as many times as you would like.";
|
||||
})()}
|
||||
</span>
|
||||
</div>
|
||||
<div className="rounded-xl flex flex-col gap-4 items-center w-full h-fit">
|
||||
<AudioPlayer
|
||||
key={partIndex}
|
||||
src={exam.parts[partIndex].audio.source}
|
||||
src={exam?.parts[partIndex]?.audio?.source ?? ''}
|
||||
color="listening"
|
||||
onEnd={() => setTimesListened((prev) => prev + 1)}
|
||||
disabled={timesListened === exam.parts[partIndex].audio.repeatableTimes}
|
||||
disabled={exam?.parts[partIndex]?.audio?.repeatableTimes != null &&
|
||||
timesListened === exam.parts[partIndex]?.audio?.repeatableTimes}
|
||||
disablePause
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -23,6 +23,7 @@ export default function Writing({ exam, showSolutions = false, preview = false,
|
||||
const {
|
||||
userSolutions,
|
||||
exerciseIndex,
|
||||
hasExamEnded,
|
||||
setBgColor,
|
||||
setUserSolutions,
|
||||
setHasExamEnded,
|
||||
|
||||
@@ -15,8 +15,8 @@ import ReactDatePicker from "react-datepicker";
|
||||
import clsx from "clsx";
|
||||
import countryCodes from "country-codes-list";
|
||||
import { User, Type as UserType } from "@/interfaces/user";
|
||||
import { Type, UserImport } from "./IUserImport";
|
||||
import UserTable from "./UserTable";
|
||||
import { Type, UserImport } from "../../../interfaces/IUserImport";
|
||||
import UserTable from "../../../components/UserTable";
|
||||
import { EntityWithRoles } from "@/interfaces/entity";
|
||||
import Select from "@/components/Low/Select";
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import Modal from "@/components/Modal";
|
||||
import {checkAccess} from "@/utils/permissions";
|
||||
import useGroups from "@/hooks/useGroups";
|
||||
import Button from "@/components/Low/Button";
|
||||
import { EntityWithRoles } from "@/interfaces/entity";
|
||||
|
||||
const searchFields = [["module"], ["id"], ["createdBy"]];
|
||||
|
||||
@@ -56,7 +57,7 @@ const ExamOwnerSelector = ({options, exam, onSave}: {options: User[]; exam: Exam
|
||||
);
|
||||
};
|
||||
|
||||
export default function ExamList({user}: {user: User}) {
|
||||
export default function ExamList({user, entities}: {user: User; entities: EntityWithRoles[];}) {
|
||||
const [selectedExam, setSelectedExam] = useState<Exam>();
|
||||
|
||||
const {exams, reload} = useExams();
|
||||
|
||||
@@ -21,7 +21,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
||||
|
||||
queryParams.delete('module');
|
||||
|
||||
const result = await axios.get(`${process.env.BACKEND_URL}/${endpoint}${queryParams.size > 0 ? `?${queryParams.toString()}` : ""}`, {
|
||||
const result = await axios.get(`${process.env.BACKEND_URL}/${endpoint}${Array.from(queryParams.entries()).length > 0 ? `?${queryParams.toString()}` : ""}`, {
|
||||
headers: { Authorization: `Bearer ${process.env.BACKEND_JWT}` },
|
||||
});
|
||||
res.status(200).json(result.data);
|
||||
|
||||
Reference in New Issue
Block a user