mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 07:38:33 -06:00
moving v2 to top level
This commit is contained in:
38
src/app/todaysLectures/OneCourseLectures.tsx
Normal file
38
src/app/todaysLectures/OneCourseLectures.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
"use client";
|
||||
|
||||
import { getLecturePreviewUrl } from "@/services/urlUtils";
|
||||
import Link from "next/link";
|
||||
import { useCourseContext } from "../course/[courseName]/context/courseContext";
|
||||
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();
|
||||
const [weeks] = useLecturesQuery();
|
||||
|
||||
const dayAsDate = new Date();
|
||||
const dayAsString = getDateOnlyMarkdownString(dayAsDate);
|
||||
const todaysLecture = getLectureForDay(weeks, dayAsDate);
|
||||
|
||||
if (!todaysLecture) return <></>;
|
||||
return (
|
||||
<Link
|
||||
href={getLecturePreviewUrl(courseName, dayAsString)}
|
||||
shallow={true}
|
||||
prefetch={false}
|
||||
className="
|
||||
border-4 rounded-lg border-slate-500
|
||||
px-3 py-1 m-3 block text-end
|
||||
bg-slate-950
|
||||
transition-all hover:scale-110 hover:shadow-md
|
||||
"
|
||||
>
|
||||
<span className="text-end text-slate-500">lecture</span>
|
||||
<br />
|
||||
<span className="font-bold text-xl">{todaysLecture?.name}</span>
|
||||
<br />
|
||||
<span className="text-slate-500">{courseName}</span>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
26
src/app/todaysLectures/TodaysLectures.tsx
Normal file
26
src/app/todaysLectures/TodaysLectures.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useLocalCoursesSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
|
||||
import OneCourseLectures from "./OneCourseLectures";
|
||||
import { SuspenseAndErrorHandling } from "@/components/SuspenseAndErrorHandling";
|
||||
import CourseContextProvider from "../course/[courseName]/context/CourseContextProvider";
|
||||
import { Fragment } from "react";
|
||||
|
||||
export default function TodaysLectures() {
|
||||
const [allSettings] = useLocalCoursesSettingsQuery();
|
||||
return (
|
||||
<div className="w-full">
|
||||
<div className="flex justify-around w-full">
|
||||
<SuspenseAndErrorHandling>
|
||||
{allSettings.map((settings) => (
|
||||
<Fragment key={settings.name}>
|
||||
<CourseContextProvider localCourseName={settings.name}>
|
||||
<OneCourseLectures />
|
||||
</CourseContextProvider>
|
||||
</Fragment>
|
||||
))}
|
||||
</SuspenseAndErrorHandling>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user