import { Link } from "react-router-dom"; import { useQuery } from "@tanstack/react-query"; import { useTranslation } from "react-i18next"; import { ArrowRight, Calendar, GraduationCap, Sparkles, } from "lucide-react"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Badge } from "@/components/ui/badge"; import { Skeleton } from "@/components/ui/skeleton"; import { coursePlanService } from "@/services/coursePlan.service"; import { describeApiError } from "@/lib/api-client"; import type { CoursePlan } from "@/types"; /** * Student-facing list of AI course plans assigned to the current user. * * Reads from `GET /api/student/course-plans`, which only returns plans * the user has been linked to either directly (Phase D `students` mode) * or via the batch they're enrolled in. The card itself is intentionally * lightweight: tap → drill into `/student/course-plans/:id` for the full * weekly plan and embedded media. */ export default function StudentCoursePlans() { const { t } = useTranslation(); const { data, isLoading, isError, error } = useQuery({ queryKey: ["student-course-plans"], queryFn: () => coursePlanService.studentList(), }); const items = data?.items ?? []; return (
{t("coursePlan.student.listSubtitle")}
{t("coursePlan.student.empty")}