import { prisma } from '@/lib/db'; import { getSession } from '@/lib/auth'; import { redirect } from 'next/navigation'; import { Trash2, CheckCircle } from 'lucide-react'; import { deleteContact, markContactAsRead } from '../actions'; import { revalidatePath } from 'next/cache'; export default async function ContactAdminPage() { const session = await getSession(); if (!session) redirect('/admin/login'); const messages = await prisma.contactMessage.findMany({ orderBy: { createdAt: 'desc' } }); return (

İletişim Mesajları

{messages.map(msg => ( ))} {messages.length === 0 && ( )}
Tarih Gönderen E-posta Konu Mesaj Durum İşlem
{msg.createdAt.toLocaleDateString('tr-TR')} {msg.name} {msg.email} {msg.subject || '-'} {msg.message} {msg.isRead ? ( Okundu ) : ( Yeni )}
{!msg.isRead && (
{ 'use server'; await markContactAsRead(msg.id); revalidatePath('/admin/contact'); }}>
)}
{ 'use server'; await deleteContact(msg.id); revalidatePath('/admin/contact'); }}>
Hiç mesaj bulunamadı.
); }