mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
moving utils
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
import { getWeekNumber } from "./calendarMonthUtils";
|
||||
import Day from "./day/Day";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
import { getMonthsBetweenDates } from "./calendarMonthUtils";
|
||||
import { CalendarMonth } from "./CalendarMonth";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
|
||||
export interface CalendarMonthModel {
|
||||
year: number;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import { useDraggingContext } from "../../context/drag/draggingContext";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDayOfWeek } from "@/models/local/localCourseSettings";
|
||||
|
||||
@@ -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/lectureUtils";
|
||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||
import { useLecturesSuspenseQuery } from "@/hooks/localCourse/lectureHooks";
|
||||
|
||||
export function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import { markdownToHTMLSafe } from "@/services/htmlMarkdownUtils";
|
||||
import { htmlIsCloseEnough } from "@/services/utils/htmlIsCloseEnough";
|
||||
import { ReactNode } from "react";
|
||||
|
||||
@@ -8,7 +8,7 @@ import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import { ReactNode } from "react";
|
||||
import { useCalendarItemsContext } from "../../context/calendarItemsContext";
|
||||
import { getStatus } from "./getStatus";
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import { useAllCourseDataQuery } from "@/hooks/localCourse/localCourseModuleHooks";
|
||||
import { trpc } from "@/services/serverFunctions/trpcClient";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { getDateFromStringOrThrow, dateToMarkdownString } from "@/models/local/timeUtils";
|
||||
import { getDateFromStringOrThrow, dateToMarkdownString } from "@/models/local/utils/timeUtils";
|
||||
|
||||
|
||||
export function getNewLockDate(
|
||||
|
||||
@@ -8,18 +8,17 @@ import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHoo
|
||||
import { useUpdatePageMutation } from "@/hooks/localCourse/pageHooks";
|
||||
import { LocalAssignment } from "@/models/local/assignment/localAssignment";
|
||||
import { Lecture } from "@/models/local/lecture";
|
||||
import { getLectureForDay } from "@/models/local/lectureUtils";
|
||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||
import { LocalCoursePage } from "@/models/local/page/localCoursePage";
|
||||
import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
dateToMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import { Dispatch, SetStateAction, useCallback, DragEvent } from "react";
|
||||
import { DraggableItem } from "./draggingContext";
|
||||
import { getNewLockDate } from "./getNewLockDate";
|
||||
import { trpc } from "@/services/serverFunctions/trpcClient";
|
||||
import { useUpdateQuizMutation } from "@/hooks/localCourse/quizHooks";
|
||||
import { useCourseContext } from "../courseContext";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDayOfWeek } from "@/models/local/localCourseSettings";
|
||||
import { getDateFromString } from "@/models/local/timeUtils";
|
||||
import { getDateFromString } from "@/models/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/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
|
||||
export default async function page({
|
||||
params,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import LecturePreviewPage from "./LecturePreviewPage";
|
||||
|
||||
export default async function Page({
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
getDateFromString,
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
import { Fragment } from "react";
|
||||
import Modal, { useModal } from "../../../../components/Modal";
|
||||
import NewItemForm from "./NewItemForm";
|
||||
|
||||
@@ -8,14 +8,15 @@ import { useModuleNamesQuery } from "@/hooks/localCourse/localCourseModuleHooks"
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { useCreatePageMutation } from "@/hooks/localCourse/pageHooks";
|
||||
import { LocalAssignmentGroup } from "@/models/local/assignment/localAssignmentGroup";
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/timeUtils";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useCourseContext } from "../context/courseContext";
|
||||
import { useCreateQuizMutation } from "@/hooks/localCourse/quizHooks";
|
||||
import {
|
||||
getDateFromString,
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
} from "@/models/local/utils/timeUtils";
|
||||
|
||||
export default function NewItemForm({
|
||||
moduleName: defaultModuleName,
|
||||
|
||||
@@ -6,12 +6,12 @@ import {
|
||||
useLocalCourseSettingsQuery,
|
||||
useUpdateLocalCourseSettingsMutation,
|
||||
} from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDateFromString } from "@/models/local/timeUtils";
|
||||
import { getDateFromString } from "@/models/local/utils/timeUtils";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
holidaysToString,
|
||||
parseHolidays,
|
||||
} from "../../../../models/local/settingsUtils";
|
||||
} from "../../../../models/local/utils/settingsUtils";
|
||||
import { settingsBox } from "./sharedSettings";
|
||||
|
||||
const exampleString = `springBreak:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDateOnlyMarkdownString } from "@/models/local/timeUtils";
|
||||
import { getDateOnlyMarkdownString } from "@/models/local/utils/timeUtils";
|
||||
import React from "react";
|
||||
import { settingsBox } from "./sharedSettings";
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { getDateOnlyMarkdownString } from "@/models/local/timeUtils";
|
||||
import { getLecturePreviewUrl } from "@/services/urlUtils";
|
||||
import Link from "next/link";
|
||||
import { useCourseContext } from "../course/[courseName]/context/courseContext";
|
||||
import { getLectureForDay } from "@/models/local/lectureUtils";
|
||||
import { useLecturesSuspenseQuery as useLecturesQuery } from "@/hooks/localCourse/lectureHooks";
|
||||
import { getLectureForDay } from "@/models/local/utils/lectureUtils";
|
||||
import { getDateOnlyMarkdownString } from "@/models/local/utils/timeUtils";
|
||||
|
||||
export default function OneCourseLectures() {
|
||||
const { courseName } = useCourseContext();
|
||||
|
||||
@@ -10,7 +10,6 @@ export default function TodaysLectures() {
|
||||
const [allSettings] = useLocalCoursesSettingsQuery();
|
||||
return (
|
||||
<div className="w-full">
|
||||
{/* <h3 className="text-center text-slate-400">todays lectures</h3> */}
|
||||
<div className="flex justify-around w-full">
|
||||
<SuspenseAndErrorHandling>
|
||||
{allSettings.map((settings) => (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
verifyDateOrThrow,
|
||||
verifyDateStringOrUndefined,
|
||||
} from "../../timeUtils";
|
||||
} from "../../utils/timeUtils";
|
||||
import { AssignmentSubmissionType } from "../assignmentSubmissionType";
|
||||
import { LocalAssignment } from "../localAssignment";
|
||||
import { RubricItem } from "../rubricItem";
|
||||
|
||||
@@ -2,7 +2,7 @@ import { LocalAssignment } from "./assignment/localAssignment";
|
||||
import { IModuleItem } from "./IModuleItem";
|
||||
import { LocalCoursePage } from "./page/localCoursePage";
|
||||
import { LocalQuiz } from "./quiz/localQuiz";
|
||||
import { getDateFromString } from "./timeUtils";
|
||||
import { getDateFromString } from "./utils/timeUtils";
|
||||
|
||||
export interface LocalModule {
|
||||
name: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import { extractLabelValue } from "../assignment/utils/markdownUtils";
|
||||
import { IModuleItem } from "../IModuleItem";
|
||||
import { verifyDateOrThrow } from "../timeUtils";
|
||||
import { verifyDateOrThrow } from "../utils/timeUtils";
|
||||
|
||||
export interface LocalCoursePage extends IModuleItem {
|
||||
name: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {
|
||||
verifyDateOrThrow,
|
||||
verifyDateStringOrUndefined,
|
||||
} from "../../timeUtils";
|
||||
} from "../../utils/timeUtils";
|
||||
import { LocalQuiz } from "../localQuiz";
|
||||
import { quizQuestionMarkdownUtils } from "./quizQuestionMarkdownUtils";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { parseHolidays } from "../settingsUtils";
|
||||
import { parseHolidays } from "../utils/settingsUtils";
|
||||
|
||||
describe("can parse holiday string", () => {
|
||||
it("can parse empty list", () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
prepLectureForNewSemester,
|
||||
prepPageForNewSemester,
|
||||
prepQuizForNewSemester,
|
||||
} from "../semesterTransferUtils";
|
||||
} from "../utils/semesterTransferUtils";
|
||||
import { LocalQuiz } from "../quiz/localQuiz";
|
||||
import { LocalCoursePage } from "../page/localCoursePage";
|
||||
import { Lecture } from "../lecture";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { dateToMarkdownString, getDateFromString } from "../timeUtils";
|
||||
import { dateToMarkdownString, getDateFromString } from "../utils/timeUtils";
|
||||
|
||||
describe("Can properly handle expected date formats", () => {
|
||||
it("can use AM/PM dates", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Lecture } from "./lecture";
|
||||
import { Lecture } from "../lecture";
|
||||
import { getDateOnlyMarkdownString } from "./timeUtils";
|
||||
|
||||
export function getLectureForDay(weeks: { weekName: string; lectures: Lecture[]; }[], dayAsDate: Date) {
|
||||
@@ -1,7 +1,8 @@
|
||||
import { LocalAssignment } from "./assignment/localAssignment";
|
||||
import { Lecture } from "./lecture";
|
||||
import { LocalCoursePage } from "./page/localCoursePage";
|
||||
import { LocalQuiz } from "./quiz/localQuiz";
|
||||
|
||||
import { LocalAssignment } from "../assignment/localAssignment";
|
||||
import { Lecture } from "../lecture";
|
||||
import { LocalCoursePage } from "../page/localCoursePage";
|
||||
import { LocalQuiz } from "../quiz/localQuiz";
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromString,
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "./timeUtils";
|
||||
@@ -5,9 +5,7 @@ import { axiosClient } from "../axiosUtils";
|
||||
import { markdownToHTMLSafe } from "../htmlMarkdownUtils";
|
||||
import { CanvasRubricCreationResponse } from "@/models/canvas/assignments/canvasRubricCreationResponse";
|
||||
import { assignmentPoints } from "@/models/local/assignment/utils/assignmentPointsUtils";
|
||||
import { getDateFromString } from "@/models/local/timeUtils";
|
||||
import { canvasModuleService } from "./canvasModuleService";
|
||||
import { CanvasModule } from "@/models/canvas/modules/canvasModule";
|
||||
import { getDateFromString } from "@/models/local/utils/timeUtils";
|
||||
import { getRubricCriterion } from "./canvasRubricUtils";
|
||||
|
||||
export const canvasAssignmentService = {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { axiosClient } from "../axiosUtils";
|
||||
import { canvasApi } from "./canvasServiceUtils";
|
||||
import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||
import { markdownToHTMLSafe } from "../htmlMarkdownUtils";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
import { canvasAssignmentService } from "./canvasAssignmentService";
|
||||
import {
|
||||
LocalQuizQuestion,
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
getDayOfWeek,
|
||||
LocalCourseSettings,
|
||||
} from "@/models/local/localCourseSettings";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
|
||||
export async function getLectures(courseName: string) {
|
||||
const courseLectureRoot = path.join(basePath, courseName, lectureFolderName);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { getWeekNumber } from "@/app/course/[courseName]/calendar/calendarMonthUtils";
|
||||
import { extractLabelValue } from "@/models/local/assignment/utils/markdownUtils";
|
||||
import { Lecture } from "@/models/local/lecture";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/timeUtils";
|
||||
import { getDateFromStringOrThrow } from "@/models/local/utils/timeUtils";
|
||||
|
||||
export function parseLecture(fileContent: string): Lecture {
|
||||
try {
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
prepLectureForNewSemester,
|
||||
prepPageForNewSemester,
|
||||
prepQuizForNewSemester,
|
||||
} from "@/models/local/semesterTransferUtils";
|
||||
} from "@/models/local/utils/semesterTransferUtils";
|
||||
|
||||
export const settingsRouter = router({
|
||||
allCoursesSettings: publicProcedure.query(async () => {
|
||||
|
||||
Reference in New Issue
Block a user