import prisma from "@/lib/prisma"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { getTranslations } from "next-intl/server"; import { Card, CardContent } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; interface TestcaseTableProps { problemId: string; } export const TestcaseTable = async ({ problemId }: TestcaseTableProps) => { const t = await getTranslations("Testcase.Table"); const testcases = await prisma.testcase.findMany({ where: { problemId }, include: { inputs: true }, orderBy: { createdAt: "asc" }, }); if (testcases.length === 0) { return ( No testcases found for this problem. ); } return ( {testcases.map((testcase, index) => ( {t("Case")} {index + 1} ))} {testcases.map((testcase) => (
{testcase.inputs .sort((a, b) => a.index - b.index) .map((input) => (
))}
))}
); };