'use client'
import { CATEGORIES, EmailTemplate, STATUS_BADGE, TemplateVersion } from '../_types'
interface EditorTabProps {
template: EmailTemplate | null
version: TemplateVersion | null
subject: string
html: string
previewHtml: string | null
saving: boolean
onSubjectChange: (v: string) => void
onHtmlChange: (v: string) => void
onSave: () => void
onPublish: () => void
onPreview: () => void
onBack: () => void
}
export function EditorTab({
template, version, subject, html, previewHtml, saving,
onSubjectChange, onHtmlChange, onSave, onPublish, onPreview, onBack,
}: EditorTabProps) {
if (!template) {
return (
Waehlen Sie ein Template aus der Liste.
)
}
const cat = CATEGORIES[template.category] || CATEGORIES.general
return (
{template.name}
{cat.label}
{version && (
{(STATUS_BADGE[version.status] || STATUS_BADGE.draft).label}
)}
{version && version.status !== 'published' && (
)}
{version && (
)}
{/* Variables */}
Variablen:
{(template.variables || []).map(v => (
))}
{/* Split View */}
{/* Editor */}
{/* Preview */}
{previewHtml ? (
) : (
)}
)
}