mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
organizing file storage
This commit is contained in:
@@ -12,7 +12,7 @@ export default function CourseSettingsLink() {
|
||||
<div>
|
||||
{settings.name}
|
||||
|
||||
<Link href={getCourseSettingsUrl(courseName)} shallow={true}>
|
||||
<Link className="mx-3 underline" href={getCourseSettingsUrl(courseName)} shallow={true}>
|
||||
Course Settings
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
10
nextjs/src/app/course/[courseName]/CourseTitle.tsx
Normal file
10
nextjs/src/app/course/[courseName]/CourseTitle.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
"use client"
|
||||
|
||||
import { useCourseContext } from "./context/courseContext"
|
||||
|
||||
export default function CourseTitle() {
|
||||
const {courseName}= useCourseContext()
|
||||
return (
|
||||
<title>{courseName}</title>
|
||||
)
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => {
|
||||
<h3
|
||||
className={
|
||||
"text-2xl transition-all duration-500 " +
|
||||
"hover:text-slate-50 underline hover:scale-105 "
|
||||
"hover:text-slate-50 underline hover:scale-105 `"
|
||||
}
|
||||
onClick={toggleCollapse}
|
||||
role="button"
|
||||
@@ -36,7 +36,7 @@ export const CalendarMonth = ({ month }: { month: CalendarMonthModel }) => {
|
||||
|
||||
<div
|
||||
id={monthName}
|
||||
className={"collapsable " + (isCollapsed ? "" : "expand")}
|
||||
className={"collapsible " + (isCollapsed ? "" : "expand")}
|
||||
>
|
||||
<div className="grid grid-cols-7 text-center fw-bold">
|
||||
{weekDaysList.map((day) => (
|
||||
|
||||
@@ -11,6 +11,9 @@ import { IModuleItem } from "@/models/local/IModuleItem";
|
||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { getDayOfWeek } from "@/models/local/localCourse";
|
||||
import { getModuleItemUrl } from "@/services/urlUtils";
|
||||
import { LocalAssignment } from "@/models/local/assignment/localAssignment";
|
||||
import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||
import { LocalCoursePage } from "@/models/local/page/localCoursePage";
|
||||
|
||||
export default function Day({ day, month }: { day: string; month: number }) {
|
||||
const dayAsDate = getDateFromStringOrThrow(
|
||||
@@ -74,9 +77,9 @@ export default function Day({ day, month }: { day: string; month: number }) {
|
||||
|
||||
function getTodaysItems(todaysModules: {
|
||||
[moduleName: string]: {
|
||||
assignments: import("/home/alexm/projects/canvasManagement/nextjs/src/models/local/assignment/localAssignment").LocalAssignment[];
|
||||
quizzes: import("/home/alexm/projects/canvasManagement/nextjs/src/models/local/quiz/localQuiz").LocalQuiz[];
|
||||
pages: import("/home/alexm/projects/canvasManagement/nextjs/src/models/local/page/localCoursePage").LocalCoursePage[];
|
||||
assignments: LocalAssignment[];
|
||||
quizzes: LocalQuiz[];
|
||||
pages: LocalCoursePage[];
|
||||
};
|
||||
}) {
|
||||
const todaysAssignments = todaysModules
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
import { ReactNode } from "react";
|
||||
import { useCourseContext } from "./courseContext";
|
||||
import {
|
||||
useAllCourseDataQuery,
|
||||
} from "@/hooks/localCourse/localCoursesHooks";
|
||||
import {
|
||||
CalendarItemsContext,
|
||||
CalendarItemsInterface,
|
||||
} from "./calendarItemsContext";
|
||||
import {
|
||||
dateToMarkdownString,
|
||||
getDateFromStringOrThrow,
|
||||
getDateOnlyMarkdownString,
|
||||
} from "@/models/local/timeUtils";
|
||||
import { LocalAssignment } from "@/models/local/assignment/localAssignment";
|
||||
import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||
import { LocalCoursePage } from "@/models/local/page/localCoursePage";
|
||||
import { useAllCourseDataQuery } from "@/hooks/localCourse/localCourseModuleHooks";
|
||||
|
||||
export default function CalendarItemsContextProvider({
|
||||
children,
|
||||
|
||||
36
nextjs/src/app/course/[courseName]/modules/CreateModule.tsx
Normal file
36
nextjs/src/app/course/[courseName]/modules/CreateModule.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import TextInput from "@/components/form/TextInput";
|
||||
import { useCreateModuleMutation } from "@/hooks/localCourse/localCourseModuleHooks";
|
||||
import React, { useState } from "react";
|
||||
|
||||
export default function CreateModule() {
|
||||
const createModule = useCreateModuleMutation();
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [moduleName, setModuleName] = useState("");
|
||||
return (
|
||||
<>
|
||||
<button onClick={() => setShowForm((v) => !v)}>
|
||||
{showForm ? "Hide Form" : "Create Module"}
|
||||
</button>
|
||||
<div className={"collapsible " + (showForm ? "expand" : "")}>
|
||||
<form
|
||||
onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
if (moduleName) {
|
||||
await createModule.mutateAsync(moduleName);
|
||||
setModuleName("");
|
||||
}
|
||||
}}
|
||||
className="p-1 border border-slate-500 rounded-md my-1 flex flex-row gap-3 justify-between"
|
||||
>
|
||||
<TextInput
|
||||
className="flex-grow"
|
||||
value={moduleName}
|
||||
setValue={setModuleName}
|
||||
label={"New Module Name"}
|
||||
/>
|
||||
<button className="mt-auto">Add</button>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
"use client";
|
||||
import { useModuleNamesQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import { useModuleNamesQuery } from "@/hooks/localCourse/localCourseModuleHooks";
|
||||
import ExpandableModule from "./ExpandableModule";
|
||||
import CreateModule from "./CreateModule";
|
||||
|
||||
export default function ModuleList() {
|
||||
const { data: moduleNames } = useModuleNamesQuery();
|
||||
return (
|
||||
<div>
|
||||
<CreateModule />
|
||||
{moduleNames.map((m) => (
|
||||
<ExpandableModule key={m} moduleName={m}/>
|
||||
<ExpandableModule key={m} moduleName={m} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,27 +3,31 @@ import CourseSettingsLink from "./CourseSettingsLink";
|
||||
import ModuleList from "./modules/ModuleList";
|
||||
import DraggingContextProvider from "./context/DraggingContextProvider";
|
||||
import Link from "next/link";
|
||||
import CourseTitle from "./CourseTitle";
|
||||
|
||||
export default async function CoursePage({}: {}) {
|
||||
return (
|
||||
<div className="h-full flex flex-col">
|
||||
<div className="flex flex-row min-h-0">
|
||||
<DraggingContextProvider>
|
||||
<div className="flex-1 min-h-0">
|
||||
<div className="pb-1 ps-5">
|
||||
<Link href={"/"} className="btn">
|
||||
Back to Course List
|
||||
</Link>
|
||||
</div>
|
||||
<>
|
||||
<CourseTitle />
|
||||
<div className="h-full flex flex-col">
|
||||
<div className="flex flex-row min-h-0">
|
||||
<DraggingContextProvider>
|
||||
<div className="flex-1 min-h-0">
|
||||
<div className="pb-1 ps-5">
|
||||
<Link href={"/"} className="btn">
|
||||
Back to Course List
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
<CourseCalendar />
|
||||
</div>
|
||||
<div className="w-96 p-3">
|
||||
<CourseSettingsLink />
|
||||
<ModuleList />
|
||||
</div>
|
||||
</DraggingContextProvider>
|
||||
<CourseCalendar />
|
||||
</div>
|
||||
<div className="w-96 p-3">
|
||||
<CourseSettingsLink />
|
||||
<ModuleList />
|
||||
</div>
|
||||
</DraggingContextProvider>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user