got one mcp endpoint

This commit is contained in:
2025-07-16 15:52:30 -06:00
parent 31ab49ed16
commit 5f4417083a
3 changed files with 65 additions and 45 deletions

View File

@@ -1,38 +1,9 @@
"use client";
import { useLocalCoursesSettingsQuery } from "@/hooks/localCourse/localCoursesHooks";
import { LocalCourseSettings } from "@/models/local/localCourseSettings";
import { getDateKey, getTermName, groupByStartDate } from "@/models/local/utils/timeUtils";
import { getCourseUrl } from "@/services/urlUtils";
import Link from "next/link";
function getDateKey(dateString: string) {
return dateString.split("T")[0];
}
function groupByStartDate(courses: LocalCourseSettings[]): {
[key: string]: LocalCourseSettings[];
} {
return courses.reduce(
(acc, course) => {
const { startDate } = course;
const key = getDateKey(startDate);
if (!acc[key]) {
acc[key] = [];
}
acc[key].push(course);
return acc;
},
{} as {
[key: string]: LocalCourseSettings[];
}
);
}
function getTermName(startDate: string) {
const [year, month, ..._rest] = startDate.split("-");
if (month < "04") return "Spring " + year;
if (month < "07") return "Summer " + year;
return "Fall " + year;
}
export default function CourseList() {
const { data: allSettings } = useLocalCoursesSettingsQuery();
@@ -67,4 +38,4 @@ export default function CourseList() {
))}
</div>
);
}
}