mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
more refactor
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
||||
getDateKey,
|
||||
getTermName,
|
||||
groupByStartDate,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { getCourseUrl } from "@/services/urlUtils";
|
||||
import Link from "next/link";
|
||||
|
||||
|
||||
@@ -18,7 +18,10 @@ import { AssignmentSubmissionType } from "@/features/local/assignments/models/as
|
||||
import { getCourseUrl } from "@/services/urlUtils";
|
||||
import { useRouter } from "next/navigation";
|
||||
import React, { Dispatch, SetStateAction, useMemo, useState } from "react";
|
||||
import { DayOfWeek, LocalCourseSettings } from "@/features/local/course/localCourseSettings";
|
||||
import {
|
||||
DayOfWeek,
|
||||
LocalCourseSettings,
|
||||
} from "@/features/local/course/localCourseSettings";
|
||||
|
||||
const sampleCompose = `services:
|
||||
canvas_manager:
|
||||
|
||||
@@ -6,8 +6,8 @@ import { SuspenseAndErrorHandling } from "@/components/SuspenseAndErrorHandling"
|
||||
import {
|
||||
useGlobalSettingsQuery,
|
||||
useUpdateGlobalSettingsMutation,
|
||||
} from "@/hooks/localCourse/globalSettingsHooks";
|
||||
import { useDirectoryIsCourseQuery } from "@/hooks/localCourse/storageDirectoryHooks";
|
||||
} from "@/features/local/globalSettings/globalSettingsHooks";
|
||||
import { useDirectoryIsCourseQuery } from "@/features/local/utils/storageDirectoryHooks";
|
||||
import { FC, useEffect, useRef, useState } from "react";
|
||||
|
||||
export const AddExistingCourseToGlobalSettings = () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assignmentMarkdownSerializer } from "@/features/local/assignments/models/utils/assignmentMarkdownSerializer";
|
||||
import { groupByStartDate } from "@/models/local/utils/timeUtils";
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { groupByStartDate } from "@/features/local/utils/timeUtils";
|
||||
import { fileStorageService } from "@/features/local/utils/fileStorageService";
|
||||
import { createMcpHandler } from "mcp-handler";
|
||||
import { z } from "zod";
|
||||
import { githubClassroomUrlPrompt } from "./github-classroom-prompt";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createTrpcContext } from "@/services/serverFunctions/context";
|
||||
import { trpcAppRouter } from "@/services/serverFunctions/router/app";
|
||||
import { trpcAppRouter } from "@/services/serverFunctions/router/appRouter";
|
||||
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
|
||||
const handler = async (request: Request) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CalendarMonthModel, getWeekNumber } from "./calendarMonthUtils";
|
||||
import { Expandable } from "@/components/Expandable";
|
||||
import { CalendarWeek } from "./CalendarWeek";
|
||||
import { useLocalCourseSettingsQuery } from "@/features/local/course/localCoursesHooks";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/features/local/utils/timeUtils";
|
||||
import UpChevron from "@/components/icons/UpChevron";
|
||||
import DownChevron from "@/components/icons/DownChevron";
|
||||
import { DayOfWeek } from "@/features/local/course/localCourseSettings";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useLocalCourseSettingsQuery } from "@/features/local/course/localCoursesHooks";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/features/local/utils/timeUtils";
|
||||
import { getWeekNumber } from "./calendarMonthUtils";
|
||||
import Day from "./day/Day";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/features/local/utils/timeUtils";
|
||||
import { getMonthsBetweenDates } from "./calendarMonthUtils";
|
||||
import { CalendarMonth } from "./CalendarMonth";
|
||||
import { useLocalCourseSettingsQuery } from "@/features/local/course/localCoursesHooks";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
|
||||
export interface CalendarMonthModel {
|
||||
year: number;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { useDraggingContext } from "../../context/drag/draggingContext";
|
||||
import { useLocalCourseSettingsQuery } from "@/features/local/course/localCoursesHooks";
|
||||
import { ItemInDay } from "./ItemInDay";
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useCourseContext } from "../../context/courseContext";
|
||||
import NewItemForm from "../../modules/NewItemForm";
|
||||
import { DraggableItem } from "../../context/drag/draggingContext";
|
||||
import { useDragStyleContext } from "../../context/drag/dragStyleContext";
|
||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||
import { getLectureForDay } from "@/features/local/utils/lectureUtils";
|
||||
import { useLecturesSuspenseQuery } from "@/features/local/lectures/lectureHooks";
|
||||
import ClientOnly from "@/components/ClientOnly";
|
||||
import { Tooltip } from "@/components/Tooltip";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { LocalAssignment } from "@/features/local/assignments/models/localAssign
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { markdownToHTMLSafe } from "@/services/htmlMarkdownUtils";
|
||||
import { htmlIsCloseEnough } from "@/services/utils/htmlIsCloseEnough";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
@@ -6,7 +6,7 @@ import { LocalAssignment } from "@/features/local/assignments/models/localAssign
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { ReactNode } from "react";
|
||||
import { useCalendarItemsContext } from "../../context/calendarItemsContext";
|
||||
import { getStatus } from "./getStatus";
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use client";
|
||||
import { getDateFromStringOrThrow, dateToMarkdownString } from "@/models/local/utils/timeUtils";
|
||||
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
dateToMarkdownString,
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
|
||||
export function getNewLockDate(
|
||||
originalDueDate: string,
|
||||
@@ -9,15 +11,18 @@ export function getNewLockDate(
|
||||
): string | undefined {
|
||||
// todo: preserve previous due date / lock date offset
|
||||
const dueDate = getDateFromStringOrThrow(originalDueDate, "dueAt date");
|
||||
const lockDate = originalLockDate === undefined
|
||||
? undefined
|
||||
: getDateFromStringOrThrow(originalLockDate, "lockAt date");
|
||||
const lockDate =
|
||||
originalLockDate === undefined
|
||||
? undefined
|
||||
: getDateFromStringOrThrow(originalLockDate, "lockAt date");
|
||||
|
||||
const originalOffset = lockDate === undefined ? undefined : lockDate.getTime() - dueDate.getTime();
|
||||
const originalOffset =
|
||||
lockDate === undefined ? undefined : lockDate.getTime() - dueDate.getTime();
|
||||
|
||||
const newLockDate = originalOffset === undefined
|
||||
? undefined
|
||||
: new Date(dayAsDate.getTime() + originalOffset);
|
||||
const newLockDate =
|
||||
originalOffset === undefined
|
||||
? undefined
|
||||
: new Date(dayAsDate.getTime() + originalOffset);
|
||||
|
||||
return newLockDate === undefined
|
||||
? undefined
|
||||
|
||||
@@ -7,12 +7,12 @@ import { useLocalCourseSettingsQuery } from "@/features/local/course/localCourse
|
||||
import { useUpdatePageMutation } from "@/features/local/pages/pageHooks";
|
||||
import { LocalAssignment } from "@/features/local/assignments/models/localAssignment";
|
||||
import { Lecture } from "@/features/local/lectures/lectureModel";
|
||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||
import { getLectureForDay } from "@/features/local/utils/lectureUtils";
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
dateToMarkdownString,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { Dispatch, SetStateAction, useCallback, DragEvent } from "react";
|
||||
import { DraggableItem } from "./draggingContext";
|
||||
import { getNewLockDate } from "./getNewLockDate";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useLocalCourseSettingsQuery } from "@/features/local/course/localCoursesHooks";
|
||||
import { getDateFromString } from "@/models/local/utils/timeUtils";
|
||||
import { getDateFromString } from "@/features/local/utils/timeUtils";
|
||||
import { getLectureWeekName } from "@/services/fileStorage/utils/lectureUtils";
|
||||
import { getCourseUrl, getLecturePreviewUrl } from "@/services/urlUtils";
|
||||
import { useCourseContext } from "../../context/courseContext";
|
||||
|
||||
@@ -2,7 +2,7 @@ import EditLecture from "./EditLecture";
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function page({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import LecturePreviewPage from "./LecturePreviewPage";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
getDateFromString,
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { Fragment } from "react";
|
||||
import Modal, { useModal } from "../../../../components/Modal";
|
||||
import NewItemForm from "./NewItemForm";
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
getDateFromString,
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
} from "@/features/local/utils/timeUtils";
|
||||
import { useCreateAssignmentMutation } from "@/features/local/assignments/assignmentHooks";
|
||||
|
||||
export default function NewItemForm({
|
||||
|
||||
@@ -6,12 +6,12 @@ import {
|
||||
useLocalCourseSettingsQuery,
|
||||
useUpdateLocalCourseSettingsMutation,
|
||||
} from "@/features/local/course/localCoursesHooks";
|
||||
import { getDateFromString } from "@/models/local/utils/timeUtils";
|
||||
import { getDateFromString } from "@/features/local/utils/timeUtils";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
holidaysToString,
|
||||
parseHolidays,
|
||||
} from "../../../../models/local/utils/settingsUtils";
|
||||
} from "../../../../features/local/utils/settingsUtils";
|
||||
import { settingsBox } from "./sharedSettings";
|
||||
|
||||
const exampleString = `springBreak:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useLocalCourseSettingsQuery } from "@/features/local/course/localCoursesHooks";
|
||||
import { getDateOnlyMarkdownString } from "@/models/local/utils/timeUtils";
|
||||
import { getDateOnlyMarkdownString } from "@/features/local/utils/timeUtils";
|
||||
import React from "react";
|
||||
import { settingsBox } from "./sharedSettings";
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import { Suspense } from "react";
|
||||
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
|
||||
import { MyToaster } from "./MyToaster";
|
||||
import { createServerSideHelpers } from "@trpc/react-query/server";
|
||||
import { trpcAppRouter } from "@/services/serverFunctions/router/app";
|
||||
import { trpcAppRouter } from "@/services/serverFunctions/router/appRouter";
|
||||
import { createTrpcContext } from "@/services/serverFunctions/context";
|
||||
import superjson from "superjson";
|
||||
import { fileStorageService } from "@/services/fileStorage/fileStorageService";
|
||||
import { fileStorageService } from "@/features/local/utils/fileStorageService";
|
||||
import { ClientCacheInvalidation } from "../components/realtime/ClientCacheInvalidation";
|
||||
import { getTitle } from "@/services/titleUtils";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -4,8 +4,8 @@ import { getLecturePreviewUrl } from "@/services/urlUtils";
|
||||
import Link from "next/link";
|
||||
import { useCourseContext } from "../course/[courseName]/context/courseContext";
|
||||
import { useLecturesSuspenseQuery as useLecturesQuery } from "@/features/local/lectures/lectureHooks";
|
||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||
import { getDateOnlyMarkdownString } from "@/models/local/utils/timeUtils";
|
||||
import { getLectureForDay } from "@/features/local/utils/lectureUtils";
|
||||
import { getDateOnlyMarkdownString } from "@/features/local/utils/timeUtils";
|
||||
|
||||
export default function OneCourseLectures() {
|
||||
const { courseName } = useCourseContext();
|
||||
|
||||
Reference in New Issue
Block a user