Version 3 of the kit: - Radix UI replaced with Base UI (using the Shadcn UI patterns) - next-intl replaces react-i18next - enhanceAction deprecated; usage moved to next-safe-action - main layout now wrapped with [locale] path segment - Teams only mode - Layout updates - Zod v4 - Next.js 16.2 - Typescript 6 - All other dependencies updated - Removed deprecated Edge CSRF - Dynamic Github Action runner
71 lines
2.0 KiB
TypeScript
71 lines
2.0 KiB
TypeScript
import Link from 'next/link';
|
|
|
|
import {
|
|
createKitEmailsDeps,
|
|
createKitEmailsService,
|
|
} from '@kit/mcp-server/emails';
|
|
import { findWorkspaceRoot } from '@kit/mcp-server/env';
|
|
import {
|
|
CardButton,
|
|
CardButtonHeader,
|
|
CardButtonTitle,
|
|
} from '@kit/ui/card-button';
|
|
import { Heading } from '@kit/ui/heading';
|
|
import { Page, PageBody, PageHeader } from '@kit/ui/page';
|
|
|
|
export const metadata = {
|
|
title: 'Emails',
|
|
};
|
|
|
|
const CATEGORY_LABELS: Record<string, string> = {
|
|
'supabase-auth': 'Supabase Auth Emails',
|
|
transactional: 'Transactional Emails',
|
|
};
|
|
|
|
export default async function EmailsPage() {
|
|
const rootPath = findWorkspaceRoot(process.cwd());
|
|
const service = createKitEmailsService(createKitEmailsDeps(rootPath));
|
|
const { templates, categories } = await service.list();
|
|
|
|
return (
|
|
<Page style={'custom'}>
|
|
<PageHeader
|
|
displaySidebarTrigger={false}
|
|
title="Emails"
|
|
description={'Manage your application Email templates'}
|
|
/>
|
|
|
|
<PageBody className={'gap-y-8'}>
|
|
{categories.map((category) => {
|
|
const categoryTemplates = templates.filter(
|
|
(t) => t.category === category,
|
|
);
|
|
|
|
return (
|
|
<div key={category} className={'flex flex-col space-y-4'}>
|
|
<Heading level={5}>
|
|
{CATEGORY_LABELS[category] ?? category}
|
|
</Heading>
|
|
|
|
<div className={'grid grid-cols-1 gap-4 md:grid-cols-4'}>
|
|
{categoryTemplates.map((template) => (
|
|
<CardButton
|
|
key={template.id}
|
|
render={
|
|
<Link href={`/emails/${template.id}`}>
|
|
<CardButtonHeader>
|
|
<CardButtonTitle>{template.name}</CardButtonTitle>
|
|
</CardButtonHeader>
|
|
</Link>
|
|
}
|
|
/>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
})}
|
|
</PageBody>
|
|
</Page>
|
|
);
|
|
}
|