/** * A clickable category in the quiz browser — Books, a book, Lectures, a * year. Shows how many quizzes it holds and how many are still to take. */ import Link from "next/link"; import { ChevronRight } from "lucide-react"; import type { QuizCard } from "@/lib/quiz"; export function QuizCategoryCard({ href, label, quizzes, icon, }: { href: string; label: string; quizzes: QuizCard[]; icon: React.ReactNode; }) { const todo = quizzes.filter((q) => q.my.state !== "completed").length; const n = quizzes.length; return ( {icon} {label} {n} {n === 1 ? "quiz" : "quizzes"} {todo > 0 && todo < n ? ` · ${todo} to do` : ""} {todo === 0 ? " · all finished" : ""} ); }