'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 onSubmitForReview?: () => void onApprove?: (comment?: string) => void onReject?: (comment: string) => void onSendTest?: (email: string) => void } export function EditorTab({ template, version, subject, html, previewHtml, saving, onSubjectChange, onHtmlChange, onSave, onPublish, onPreview, onBack, onSubmitForReview, onApprove, onReject, onSendTest, }: 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} )}
{/* Save — always available for draft/review */} {(!version || version.status === 'draft' || version.status === 'review') && ( )} {/* Submit for Review — only for draft */} {version && version.status === 'draft' && onSubmitForReview && ( )} {/* Approve — only for review status (DSB) */} {version && version.status === 'review' && onApprove && ( )} {/* Reject — only for review status (DSB) */} {version && version.status === 'review' && onReject && ( )} {/* Publish — only for approved */} {version && version.status === 'approved' && ( )} {/* Preview + Test — always when version exists */} {version && ( <> {onSendTest && ( )} )}
{/* Variables */}
Variablen: {(Array.isArray(template.variables) ? template.variables : []).map(v => ( ))}
{/* Split View */}
{/* Editor */}
onSubjectChange(e.target.value)} className="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-purple-500 focus:border-transparent" placeholder="E-Mail Betreff..." />