import { db } from "@/db"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; import { Button } from "@/components/ui/button"; import Link from "next/link"; import { Eye, Users } from "lucide-react"; import { DeleteSubmissionButton, DeleteAllSubmissionsButton } from "./client"; export const dynamic = "force-dynamic"; export default async function ResultsListPage() { const submissionsList = await db.query.submissions.findMany({ orderBy: (s, { desc }) => [desc(s.submittedAt)], }); return (

Form Submissions

Review all submissions and individual user answers.

{submissionsList.length > 0 && }
{submissionsList.length === 0 ? ( No submissions yet When users fill out your form, their responses will appear here. ) : ( Submissions Total {submissionsList.length} responses collected. Click view to inspect individual answers. User (Discord) Submitted At Action {submissionsList.map((sub) => { const userLabel = sub.userName ? `${sub.userName} (${sub.userDiscordId || "N/A"})` : sub.userDiscordId || "Anonymous"; return (
{userLabel}
{new Date(sub.submittedAt).toLocaleString()}
); })}
)}
); }