import { prisma } from '@/lib/prisma' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Building2, MessageSquare, CheckCircle, XCircle, Clock } from 'lucide-react' export default async function DashboardPage() { const [totalClients, activeClients, pendingCount, sentCount, failedCount] = await Promise.all([ prisma.client.count(), prisma.client.count({ where: { isActive: true } }), prisma.smsQueue.count({ where: { status: { in: ['PENDING', 'RETRYING'] } } }), prisma.smsQueue.count({ where: { status: 'SENT' } }), prisma.smsQueue.count({ where: { status: 'FAILED' } }), ]) const recentLogs = await prisma.smsLog.findMany({ take: 10, orderBy: { sentAt: 'desc' }, include: { client: { select: { name: true } }, queue: true }, }) const stats = [ { title: 'Total Clients', value: totalClients, sub: `${activeClients} active`, icon: Building2, color: 'text-blue-600' }, { title: 'Pending SMS', value: pendingCount, sub: 'In queue', icon: Clock, color: 'text-yellow-600' }, { title: 'SMS Sent', value: sentCount, sub: 'All time', icon: CheckCircle, color: 'text-green-600' }, { title: 'Failed SMS', value: failedCount, sub: 'Needs attention', icon: XCircle, color: 'text-red-600' }, ] return (
Overview of your NFC Attendance Hub
{stat.sub}
No SMS activity yet
) : (