'use client' import { useState, useEffect } from 'react' import Link from 'next/link' interface EmailStats { total: number sent: number pending: number failed: number processing: number } export default function HomePage() { const [emailStats, setEmailStats] = useState({ total: 0, sent: 0, pending: 0, failed: 0, processing: 0 }) const [loading, setLoading] = useState(true) useEffect(() => { fetchEmailStats() }, []) const fetchEmailStats = async () => { try { const response = await fetch('/api/test-email') const data = await response.json() if (data.outbox?.emails) { const emails = data.outbox.emails const stats: EmailStats = { total: emails.length, sent: emails.filter((email: any) => email.status === 'sent').length, pending: emails.filter((email: any) => email.status === 'pending').length, failed: emails.filter((email: any) => email.status === 'failed').length, processing: emails.filter((email: any) => email.status === 'processing').length } setEmailStats(stats) } } catch (error) { console.error('Error fetching email statistics:', error) } finally { setLoading(false) } } const StatCard = ({ label, value, color, description }: { label: string; value: number; color: string; description: string }) => (
{value}
{label}
{description}
) return (
{/* Header */}

๐Ÿ“ง PayloadCMS Mailing Plugin

Development Dashboard

๐Ÿ“Š Admin Panel ๐Ÿงช Test Interface
{/* Email Statistics */}

Email Statistics

{loading ? (
Loading email statistics...
) : (
{emailStats.processing > 0 && ( )}
)}
{/* Quick Actions */}

Quick Actions

๐ŸŽฏ Test Email Sending

Send test emails using templates with the interactive testing interface.

Open Test Interface โ†’

๐Ÿ“ Manage Templates

Create and edit email templates in the Payload admin interface.

Manage Templates โ†’

๐Ÿ“ฌ Email Queue

View and manage the email outbox and delivery status.

View Email Queue โ†’
{/* Footer */}
PayloadCMS Mailing Plugin Development Environment
) }