"use client"; import { useLocalCoursesSettingsQuery } from "@/features/local/course/localCoursesHooks"; import { getDateKey, getTermName, groupByStartDate, } from "@/models/local/utils/timeUtils"; import { getCourseUrl } from "@/services/urlUtils"; import Link from "next/link"; export default function CourseList() { const { data: allSettings } = useLocalCoursesSettingsQuery(); const coursesByStartDate = groupByStartDate(allSettings); const sortedDates = Object.keys(coursesByStartDate).sort(); return (
{sortedDates.map((startDate) => (
{getTermName(startDate)}
{coursesByStartDate[getDateKey(startDate)].map((settings) => (
{settings.name}
))}
))}
); }