mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
more refactor
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user