import Link from "next/link"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/components/ui/table"; import prisma from "@/lib/prisma"; import { Difficulty } from "@prisma/client"; const getDifficultyColor = (difficulty: Difficulty) => { switch (difficulty) { case "EASY": return "text-green-500"; case "MEDIUM": return "text-yellow-500"; case "HARD": return "text-red-500"; default: return "text-gray-500"; } }; export default async function ProblemsetPage() { const problems = await prisma.problem.findMany({ where: { published: true }, orderBy: { id: "asc", }, select: { id: true, title: true, difficulty: true, }, }); return ( Id Title Difficulty {problems.map((problem, index) => ( {index + 1} {problem.title} {problem.difficulty} ))}
); }