diff --git a/src/app/(app)/problems/[id]/features/testcase.tsx b/src/app/(app)/problems/[id]/features/testcase.tsx
index 4526fa0..b102c86 100644
--- a/src/app/(app)/problems/[id]/features/testcase.tsx
+++ b/src/app/(app)/problems/[id]/features/testcase.tsx
@@ -1,3 +1,12 @@
+import TestcaseCard from "@/components/testcase-card";
+import { useProblemStore } from "@/providers/problem-store-provider";
+
export default function Testcase() {
- return
Testcase
;
+ const problem = useProblemStore((state) => state.problem);
+
+ return (
+
+
+
+ );
}
diff --git a/src/components/testcase-card.tsx b/src/components/testcase-card.tsx
new file mode 100644
index 0000000..408ce08
--- /dev/null
+++ b/src/components/testcase-card.tsx
@@ -0,0 +1,43 @@
+import {
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
+} from "@/components/ui/tabs";
+import { TestcaseWithDetails } from "@/types/prisma";
+import TestcaseForm from "@/components/testcase-form";
+
+interface TestcaseCardProps {
+ testcases: TestcaseWithDetails;
+}
+
+export default function TestcaseCard({ testcases }: TestcaseCardProps) {
+ return (
+
+
+ {testcases.map((_, index) => (
+
+ Case {index + 1}
+
+ ))}
+
+
+ {testcases.map((testcase, index) => {
+ const formData = testcase.data.reduce((acc, field) => {
+ acc[field.label] = field.value;
+ return acc;
+ }, {} as Record);
+
+ return (
+
+
+
+ );
+ })}
+
+ );
+}
diff --git a/src/components/testcase-form.tsx b/src/components/testcase-form.tsx
new file mode 100644
index 0000000..659dc56
--- /dev/null
+++ b/src/components/testcase-form.tsx
@@ -0,0 +1,66 @@
+"use client";
+
+import * as z from "zod";
+import {
+ Form,
+ FormControl,
+ FormField,
+ FormItem,
+ FormLabel,
+ FormMessage,
+} from "@/components/ui/form";
+import { toast } from "sonner";
+import { useForm } from "react-hook-form";
+import { Input } from "@/components/ui/input";
+import { zodResolver } from "@hookform/resolvers/zod";
+
+const formSchema = z.record(z.string().min(1));
+
+interface TestcaseFormInterface {
+ [key: string]: string | undefined;
+}
+
+export default function TestcaseForm(props: TestcaseFormInterface) {
+ const form = useForm>({
+ resolver: zodResolver(formSchema),
+ defaultValues: props,
+ });
+
+ function onSubmit(values: z.infer) {
+ try {
+ console.log(values);
+ toast.success(JSON.stringify(values, null, 2));
+ } catch (error) {
+ console.error("Form submission error", error);
+ toast.error("Failed to submit the form. Please try again.");
+ }
+ }
+
+ return (
+
+
+ );
+}