mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
more reformatting and linting
This commit is contained in:
@@ -195,14 +195,13 @@ export function useItemDropOnDay({
|
||||
}
|
||||
},
|
||||
[
|
||||
courseName,
|
||||
modal,
|
||||
setIsDragging,
|
||||
setIsLoading,
|
||||
setModalCallback,
|
||||
setModalText,
|
||||
settings.defaultDueTime.hour,
|
||||
settings.defaultDueTime.minute,
|
||||
settings.name,
|
||||
settings,
|
||||
updateAssignmentMutation,
|
||||
updateLectureMutation,
|
||||
updatePageMutation,
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { Suspense } from "react";
|
||||
import { getQueryClient } from "@/app/providersQueryClientUtils";
|
||||
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
|
||||
import { hydrateCanvasCourse } from "@/hooks/hookHydration";
|
||||
import { createServerSideHelpers } from "@trpc/react-query/server";
|
||||
import { trpcAppRouter } from "@/services/trpc/router/app";
|
||||
import { createTrpcContext } from "@/services/trpc/context";
|
||||
import superjson from "superjson";
|
||||
import CourseContextProvider from "./context/CourseContextProvider";
|
||||
|
||||
export default async function CourseLayout({
|
||||
@@ -22,20 +14,11 @@ export default async function CourseLayout({
|
||||
console.log("cannot load course that is .js.map " + decodedCourseName);
|
||||
return <div></div>;
|
||||
}
|
||||
// const settings = await fileStorageService.settings.getCourseSettings(
|
||||
// decodedCourseName
|
||||
// );
|
||||
// const queryClient = getQueryClient();
|
||||
// await hydrateCanvasCourse(settings.canvasId, queryClient);
|
||||
// const dehydratedState = dehydrate(queryClient);
|
||||
|
||||
return (
|
||||
<Suspense>
|
||||
{/* <HydrationBoundary state={dehydratedState}> */}
|
||||
<CourseContextProvider localCourseName={decodedCourseName}>
|
||||
{children}
|
||||
</CourseContextProvider>
|
||||
{/* </HydrationBoundary> */}
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ Date: ${lectureDay}
|
||||
return () => {
|
||||
clearTimeout(handler);
|
||||
};
|
||||
}, [lecture, text, updateLecture]);
|
||||
}, [courseName, lecture, settings, text, updateLecture]);
|
||||
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
|
||||
@@ -7,9 +7,8 @@ import { useQueryClient } from "@tanstack/react-query";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import { useCourseContext } from "../../context/courseContext";
|
||||
import { deleteLecture } from "@/services/fileStorage/lectureFileStorageService";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { lectureKeys } from "@/hooks/localCourse/lectureKeys";
|
||||
import { useDeleteLectureMutation } from "@/hooks/localCourse/lectureHooks";
|
||||
|
||||
export default function LectureButtons({ lectureDay }: { lectureDay: string }) {
|
||||
const queryClient = useQueryClient();
|
||||
@@ -18,6 +17,7 @@ export default function LectureButtons({ lectureDay }: { lectureDay: string }) {
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const modal = useModal();
|
||||
const deleteLecture = useDeleteLectureMutation();
|
||||
|
||||
return (
|
||||
<div className="p-5 flex flex-row justify-end gap-3">
|
||||
@@ -39,9 +39,10 @@ export default function LectureButtons({ lectureDay }: { lectureDay: string }) {
|
||||
onClick={async () => {
|
||||
setIsLoading(true);
|
||||
router.push(getCourseUrl(courseName));
|
||||
await deleteLecture(courseName, settings, lectureDay);
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: lectureKeys.allLectures(courseName),
|
||||
await deleteLecture.mutateAsync({
|
||||
courseName,
|
||||
settings,
|
||||
lectureDay,
|
||||
});
|
||||
}}
|
||||
disabled={isLoading}
|
||||
|
||||
@@ -140,7 +140,7 @@ function OtherSettings({
|
||||
}) {
|
||||
const { data: canvasCourses } = useCourseListInTermQuery(selectedTerm.id);
|
||||
const [allSettings] = useLocalCoursesSettingsQuery();
|
||||
const { data: emptyDirectories } = useEmptyDirectoriesQuery();
|
||||
const [emptyDirectories] = useEmptyDirectoriesQuery();
|
||||
|
||||
const populatedCanvasCourseIds = allSettings.map((s) => s.canvasId);
|
||||
const availableCourses = canvasCourses.filter(
|
||||
|
||||
@@ -8,3 +8,12 @@ export const useLectureUpdateMutation = () => {
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const useDeleteLectureMutation = () => {
|
||||
const utils = trpc.useUtils();
|
||||
return trpc.lectures.deleteLecture.useMutation({
|
||||
onSuccess: () => {
|
||||
utils.lectures.getLectures.invalidate();
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -9,16 +9,8 @@ import { pageRouter } from "./pageRouter";
|
||||
import { quizRouter } from "./quizRouter";
|
||||
import { settingsRouter } from "./settingsRouter";
|
||||
|
||||
export const helloRouter = router({
|
||||
sayHello: publicProcedure.query(() => {
|
||||
// runs on the server I think
|
||||
console.log("hello world router on the server?");
|
||||
return { greeting: `Hello World!` };
|
||||
}),
|
||||
});
|
||||
|
||||
export const trpcAppRouter = router({
|
||||
hello: helloRouter,
|
||||
assignment: assignmentRouter,
|
||||
lectures: lectureRouter,
|
||||
settings: settingsRouter,
|
||||
|
||||
@@ -37,4 +37,15 @@ export const lectureRouter = router({
|
||||
}
|
||||
}
|
||||
),
|
||||
deleteLecture: publicProcedure
|
||||
.input(
|
||||
z.object({
|
||||
courseName: z.string(),
|
||||
lectureDay: z.string(),
|
||||
settings: zodLocalCourseSettings,
|
||||
})
|
||||
)
|
||||
.mutation(async ({ input: { courseName, settings, lectureDay } }) => {
|
||||
await deleteLecture(courseName, settings, lectureDay);
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user