import Link from 'next/link'; import { getDataSource, EmailTemplate } from '@/lib/database'; import DeleteButton from './DeleteButton'; export default async function AdminEmailTemplates() { // Fetch email templates from the database const dataSource = await getDataSource(); const emailTemplateRepository = dataSource.getRepository(EmailTemplate); const emailTemplates = await emailTemplateRepository.find({ order: { createdAt: 'DESC' } }); return (

Email Templates

Add New Template
{emailTemplates.length > 0 ? ( emailTemplates.map((template) => ( )) ) : ( )}
Title Created Modified Actions
{template.title} {new Date(template.createdAt).toLocaleDateString()} {new Date(template.createdAt).toLocaleTimeString()} {new Date(template.modifiedAt).toLocaleDateString()} {new Date(template.modifiedAt).toLocaleTimeString()} Edit
No email templates found. Create your first template!
); }