import Link from "next/link"; import { redirect } from "next/navigation"; import { ShellPage } from "@/components/page-templates"; import { SectionCard } from "@/components/ui"; import { getSession } from "@/lib/auth"; import { prisma } from "@/lib/prisma"; export default async function ContactDetailPage({ params }: { params: Promise<{ contactId: string }> }) { const { contactId } = await params; const session = await getSession(); if (!session) { redirect("/login"); } const contact = await prisma.contact.findFirst({ where: { id: contactId, tenantId: session.tenantId }, include: { contactTags: { include: { tag: true } }, conversations: true, channel: true } }); if (!contact) { redirect("/contacts?error=contact_not_found"); } return ( Edit contact} >

Nama: {contact.fullName}

Phone: {contact.phoneNumber}

Email: {contact.email || "-"}

Channel: {contact.channel?.channelName || "Unset"}

Opt-in: {contact.optInStatus}

Last interaction: {contact.lastInteractionAt?.toLocaleString() || "-"}

Kembali ke daftar

Total conversations: {contact.conversations.length}

Tags: {contact.contactTags.map((item) => item.tag.name).join(", ") || "-"}

); }