mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-25 23:28:33 -06:00
starting lecture UI
This commit is contained in:
@@ -10,7 +10,7 @@ import Link from "next/link";
|
|||||||
import { IModuleItem } from "@/models/local/IModuleItem";
|
import { IModuleItem } from "@/models/local/IModuleItem";
|
||||||
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||||
import { getDayOfWeek } from "@/models/local/localCourse";
|
import { getDayOfWeek } from "@/models/local/localCourse";
|
||||||
import { getModuleItemUrl } from "@/services/urlUtils";
|
import { getLectureUrl, getModuleItemUrl } from "@/services/urlUtils";
|
||||||
import { LocalAssignment } from "@/models/local/assignment/localAssignment";
|
import { LocalAssignment } from "@/models/local/assignment/localAssignment";
|
||||||
import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
import { LocalQuiz } from "@/models/local/quiz/localQuiz";
|
||||||
import { LocalCoursePage } from "@/models/local/page/localCoursePage";
|
import { LocalCoursePage } from "@/models/local/page/localCoursePage";
|
||||||
@@ -44,7 +44,7 @@ export default function Day({ day, month }: { day: string; month: number }) {
|
|||||||
onDrop={(e) => itemDrop(e, day)}
|
onDrop={(e) => itemDrop(e, day)}
|
||||||
onDragOver={(e) => e.preventDefault()}
|
onDragOver={(e) => e.preventDefault()}
|
||||||
>
|
>
|
||||||
<div className="ms-1">{dayAsDate.getDate()}</div>
|
<DayTitle day={day} dayAsDate={dayAsDate} />
|
||||||
<div>
|
<div>
|
||||||
{todaysAssignments.map(({ assignment, moduleName }) => (
|
{todaysAssignments.map(({ assignment, moduleName }) => (
|
||||||
<DraggableListItem
|
<DraggableListItem
|
||||||
@@ -75,6 +75,15 @@ export default function Day({ day, month }: { day: string; month: number }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function DayTitle({ day, dayAsDate }: { day: string; dayAsDate: Date }) {
|
||||||
|
const { courseName } = useCourseContext();
|
||||||
|
return (
|
||||||
|
<Link className="ms-1" href={getLectureUrl(courseName, day)}>
|
||||||
|
{dayAsDate.getDate()}
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getTodaysItems(todaysModules: {
|
function getTodaysItems(todaysModules: {
|
||||||
[moduleName: string]: {
|
[moduleName: string]: {
|
||||||
assignments: LocalAssignment[];
|
assignments: LocalAssignment[];
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
"use client";
|
||||||
|
|
||||||
|
import { MonacoEditor } from "@/components/editor/MonacoEditor";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
export default function EditLecture({ lectureDay }: { lectureDay: string }) {
|
||||||
|
const [text, setText] = useState("");
|
||||||
|
return (
|
||||||
|
<div className="h-full flex flex-col">
|
||||||
|
<div className="columns-2 min-h-0 flex-1">
|
||||||
|
<div className="flex-1 h-full">
|
||||||
|
<MonacoEditor value={text} onChange={setText} />
|
||||||
|
</div>
|
||||||
|
<div className="h-full">
|
||||||
|
{/* <div className="text-red-300">{error && error}</div> */}
|
||||||
|
{/* <AssignmentPreview assignment={assignment} /> */}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { Suspense } from "react";
|
||||||
|
import CourseContextProvider from "../../context/CourseContextProvider";
|
||||||
|
|
||||||
|
export default async function LectureLayout({
|
||||||
|
children,
|
||||||
|
params: { courseName, lectureDay },
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode;
|
||||||
|
params: { courseName: string; lectureDay: string };
|
||||||
|
}) {
|
||||||
|
const decodedCourseName = decodeURIComponent(courseName);
|
||||||
|
if (courseName.includes(".js.map")) {
|
||||||
|
console.log("cannot load course that is .js.map " + decodedCourseName);
|
||||||
|
return <div></div>;
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Suspense>
|
||||||
|
<CourseContextProvider localCourseName={decodedCourseName}>
|
||||||
|
{children}
|
||||||
|
</CourseContextProvider>
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import React from "react";
|
||||||
|
import EditLecture from "./EditLecture";
|
||||||
|
|
||||||
|
export default function page({
|
||||||
|
params: { lectureDay },
|
||||||
|
}: {
|
||||||
|
params: { lectureDay: string };
|
||||||
|
}) {
|
||||||
|
const decodedLectureDay = decodeURIComponent(lectureDay);
|
||||||
|
console.log(decodedLectureDay);
|
||||||
|
return <EditLecture lectureDay={decodedLectureDay} />;
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
export function getModuleItemUrl(
|
export function getModuleItemUrl(
|
||||||
courseName: string,
|
courseName: string,
|
||||||
moduleName: string,
|
moduleName: string,
|
||||||
@@ -14,6 +13,14 @@ export function getModuleItemUrl(
|
|||||||
encodeURIComponent(itemName)
|
encodeURIComponent(itemName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
export function getLectureUrl(courseName: string, lectureDate: string) {
|
||||||
|
return (
|
||||||
|
"/course/" +
|
||||||
|
encodeURIComponent(courseName) +
|
||||||
|
"/lecture/" +
|
||||||
|
encodeURIComponent(lectureDate)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function getCourseUrl(courseName: string) {
|
export function getCourseUrl(courseName: string) {
|
||||||
return "/course/" + encodeURIComponent(courseName);
|
return "/course/" + encodeURIComponent(courseName);
|
||||||
|
|||||||
Reference in New Issue
Block a user