"use client"; import { Toggle } from "@/components/form/Toggle"; import { useLocalCoursesSettingsQuery } from "@/features/local/course/localCoursesHooks"; import { useGlobalSettingsQuery, useUpdateGlobalSettingsMutation, } from "@/features/local/globalSettings/globalSettingsHooks"; import { getDateKey, getTermName, groupByStartDate, } from "@/features/local/utils/timeUtils"; import { getCourseUrl } from "@/services/urlUtils"; import Link from "next/link"; import { useState } from "react"; import Modal, { useModal } from "@/components/Modal"; import { Spinner } from "@/components/Spinner"; export default function CourseList() { const { data: allSettings } = useLocalCoursesSettingsQuery(); const [isDeleting, setIsDeleting] = useState(false); const coursesByStartDate = groupByStartDate(allSettings); const sortedDates = Object.keys(coursesByStartDate).sort(); return (