diff --git a/nextjs/src/app/course/[courseName]/calendar/Day.tsx b/nextjs/src/app/course/[courseName]/calendar/Day.tsx index db3f9b3..25d28fe 100644 --- a/nextjs/src/app/course/[courseName]/calendar/Day.tsx +++ b/nextjs/src/app/course/[courseName]/calendar/Day.tsx @@ -10,7 +10,7 @@ import Link from "next/link"; import { IModuleItem } from "@/models/local/IModuleItem"; import { useLocalCourseSettingsQuery } from "@/hooks/localCourse/localCoursesHooks"; 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 { LocalQuiz } from "@/models/local/quiz/localQuiz"; 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)} onDragOver={(e) => e.preventDefault()} > -
{dayAsDate.getDate()}
+
{todaysAssignments.map(({ assignment, moduleName }) => ( + {dayAsDate.getDate()} + + ); +} + function getTodaysItems(todaysModules: { [moduleName: string]: { assignments: LocalAssignment[]; @@ -127,7 +136,7 @@ function DraggableListItem({ shallow={true} className={ " border rounded-sm px-1 mx-1 break-all " + - " border-slate-600 bg-slate-800 " + + " border-slate-600 bg-slate-800 " + " block " } role="button" diff --git a/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/EditLecture.tsx b/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/EditLecture.tsx new file mode 100644 index 0000000..8d454d4 --- /dev/null +++ b/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/EditLecture.tsx @@ -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 ( +
+
+
+ +
+
+ {/*
{error && error}
*/} + {/* */} +
+
+
+ ); +} diff --git a/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/layout.tsx b/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/layout.tsx new file mode 100644 index 0000000..29538b3 --- /dev/null +++ b/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/layout.tsx @@ -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
; + } + return ( + + + {children} + + + ); +} diff --git a/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/page.tsx b/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/page.tsx new file mode 100644 index 0000000..13c4d4d --- /dev/null +++ b/nextjs/src/app/course/[courseName]/lecture/[lectureDay]/page.tsx @@ -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 ; +} diff --git a/nextjs/src/services/urlUtils.ts b/nextjs/src/services/urlUtils.ts index 437c6d5..c2d72e8 100644 --- a/nextjs/src/services/urlUtils.ts +++ b/nextjs/src/services/urlUtils.ts @@ -1,4 +1,3 @@ - export function getModuleItemUrl( courseName: string, moduleName: string, @@ -14,6 +13,14 @@ export function getModuleItemUrl( encodeURIComponent(itemName) ); } +export function getLectureUrl(courseName: string, lectureDate: string) { + return ( + "/course/" + + encodeURIComponent(courseName) + + "/lecture/" + + encodeURIComponent(lectureDate) + ); +} export function getCourseUrl(courseName: string) { return "/course/" + encodeURIComponent(courseName);