import { Metadata } from "next"; import Link from "next/link"; import { auth } from "@/auth"; import { redirect } from "next/navigation"; import { db } from "@/lib/db"; import { PlusCircle, Building2, Mail, User2, FolderOpen } from "lucide-react"; import { Button } from "@/components/ui/button"; import { NewClientDialog } from "@/components/clients/NewClientDialog"; import { cn } from "@/lib/utils"; export const metadata: Metadata = { title: "Clients" }; async function getClients() { return db.client.findMany({ orderBy: { company: "asc" }, include: { _count: { select: { projects: true } } }, }); } export default async function ClientsPage() { const session = await auth(); if (!session || !["ADMIN", "PRODUCER"].includes(session.user.role as string)) { redirect("/dashboard"); } const clients = await getClients(); return (
{clients.length} client{clients.length !== 1 ? "s" : ""} total
No clients yet
Add your first client to start sharing reviews.
{client.company}
{client.isActive ? "Active" : "Inactive"}