mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-27 07:58:31 -06:00
day of linting judgement
This commit is contained in:
@@ -75,10 +75,13 @@ export default function EditQuiz({
|
||||
moduleName: string;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [settings] = useLocalCourseSettingsQuery();
|
||||
const { data: settings } = useLocalCourseSettingsQuery();
|
||||
const { courseName } = useCourseContext();
|
||||
const [quiz, { dataUpdatedAt: serverDataUpdatedAt, isFetching }] =
|
||||
useQuizQuery(moduleName, quizName);
|
||||
const {
|
||||
data: quiz,
|
||||
dataUpdatedAt: serverDataUpdatedAt,
|
||||
isFetching,
|
||||
} = useQuizQuery(moduleName, quizName);
|
||||
const updateQuizMutation = useUpdateQuizMutation();
|
||||
const { clientIsAuthoritative, text, textUpdate, monacoKey } =
|
||||
useAuthoritativeUpdates({
|
||||
@@ -122,6 +125,7 @@ export default function EditQuiz({
|
||||
}
|
||||
}
|
||||
setError("");
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (e: any) {
|
||||
setError(e.toString());
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ export function QuizButtons({
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const { courseName } = useCourseContext();
|
||||
const [settings] = useLocalCourseSettingsQuery();
|
||||
const { data: settings } = useLocalCourseSettingsQuery();
|
||||
const { data: canvasQuizzes } = useCanvasQuizzesQuery();
|
||||
|
||||
const [quiz] = useQuizQuery(moduleName, quizName);
|
||||
const { data: quiz } = useQuizQuery(moduleName, quizName);
|
||||
const addToCanvas = useAddQuizToCanvasMutation();
|
||||
const deleteFromCanvas = useDeleteQuizFromCanvasMutation();
|
||||
const deleteLocal = useDeleteQuizMutation();
|
||||
@@ -90,7 +90,11 @@ export function QuizButtons({
|
||||
<div className="flex justify-around gap-3">
|
||||
<button
|
||||
onClick={async () => {
|
||||
await deleteLocal.mutateAsync({ moduleName, quizName, courseName });
|
||||
await deleteLocal.mutateAsync({
|
||||
moduleName,
|
||||
quizName,
|
||||
courseName,
|
||||
});
|
||||
router.push(getCourseUrl(courseName));
|
||||
}}
|
||||
className="btn-danger"
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import CheckIcon from "@/components/icons/CheckIcon";
|
||||
import MarkdownDisplay from "@/components/MarkdownDisplay";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { useQuizQuery } from "@/hooks/localCourse/quizHooks";
|
||||
import {
|
||||
LocalQuizQuestion,
|
||||
QuestionType,
|
||||
} from "@/models/local/quiz/localQuizQuestion";
|
||||
import { markdownToHTMLSafe } from "@/services/htmlMarkdownUtils";
|
||||
import { escapeMatchingText } from "@/services/utils/questionHtmlUtils";
|
||||
|
||||
export default function QuizPreview({
|
||||
@@ -16,8 +14,7 @@ export default function QuizPreview({
|
||||
quizName: string;
|
||||
moduleName: string;
|
||||
}) {
|
||||
const [quiz] = useQuizQuery(moduleName, quizName);
|
||||
const [settings] = useLocalCourseSettingsQuery();
|
||||
const { data: quiz } = useQuizQuery(moduleName, quizName);
|
||||
return (
|
||||
<div style={{ overflow: "scroll", height: "100%" }}>
|
||||
<div className="columns-2">
|
||||
@@ -74,8 +71,6 @@ export default function QuizPreview({
|
||||
}
|
||||
|
||||
function QuizQuestionPreview({ question }: { question: LocalQuizQuestion }) {
|
||||
const [settings] = useLocalCourseSettingsQuery();
|
||||
|
||||
return (
|
||||
<div className="rounded bg-slate-900 px-2">
|
||||
<div className="flex flex-row justify-between text-slate-400">
|
||||
@@ -124,7 +119,10 @@ function QuizQuestionPreview({ question }: { question: LocalQuizQuestion }) {
|
||||
<div></div>
|
||||
)}
|
||||
</div>
|
||||
<MarkdownDisplay markdown={answer.text} className="markdownQuizAnswerPreview" />
|
||||
<MarkdownDisplay
|
||||
markdown={answer.text}
|
||||
className="markdownQuizAnswerPreview"
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -3,10 +3,9 @@ import TextInput from "@/components/form/TextInput";
|
||||
import Modal, { useModal } from "@/components/Modal";
|
||||
import { Spinner } from "@/components/Spinner";
|
||||
import {
|
||||
useAssignmentQuery,
|
||||
useUpdateAssignmentMutation,
|
||||
} from "@/hooks/localCourse/assignmentHooks";
|
||||
import { useQuizQuery, useUpdateQuizMutation } from "@/hooks/localCourse/quizHooks";
|
||||
useQuizQuery,
|
||||
useUpdateQuizMutation,
|
||||
} from "@/hooks/localCourse/quizHooks";
|
||||
import { getModuleItemUrl } from "@/services/urlUtils";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
@@ -21,11 +20,11 @@ export function UpdateQuizName({
|
||||
const modal = useModal();
|
||||
const { courseName } = useCourseContext();
|
||||
const router = useRouter();
|
||||
const [quiz] = useQuizQuery(moduleName, quizName);
|
||||
const { data: quiz } = useQuizQuery(moduleName, quizName);
|
||||
const updateQuiz = useUpdateQuizMutation();
|
||||
const [name, setName] = useState(quiz.name);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Modal
|
||||
@@ -57,11 +56,7 @@ export function UpdateQuizName({
|
||||
);
|
||||
}}
|
||||
>
|
||||
<TextInput
|
||||
value={name}
|
||||
setValue={setName}
|
||||
label={"Rename Quiz"}
|
||||
/>
|
||||
<TextInput value={name} setValue={setName} label={"Rename Quiz"} />
|
||||
<button className="w-full my-3">Save New Name</button>
|
||||
{isLoading && <Spinner />}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user