import { Button } from '@/components/base/buttons/button'; import { Badge } from '@/components/base/badges/badges'; import { WhatsAppMockup } from './whatsapp-mockup'; import type { WhatsAppTemplate } from '@/types/entities'; interface TemplatePreviewProps { template: WhatsAppTemplate; } const variableDescriptions: Record = { patient_name: "Lead's contact name", hospital_name: 'Clinic or hospital name', campaign_name: 'Linked campaign name', booking_link: 'Appointment booking URL', }; export const TemplatePreview = ({ template }: TemplatePreviewProps) => { const totalSent = template.sendCount ?? 0; const delivered = template.deliveredCount ?? 0; const read = template.readCount ?? 0; const clicked = template.clickedCount ?? 0; const failed = template.failedCount ?? 0; const metrics = [ { label: 'Sent', value: totalSent }, { label: 'Delivered', value: delivered }, { label: 'Read', value: read }, { label: 'Clicked', value: clicked }, { label: 'Failed', value: failed }, ]; return (
{/* Header */}

Template Preview — {template.name}

{/* Body */}
{/* Left: phone mockup */}
{/* Right: details */}
{/* Variables */} {template.variables.length > 0 && (

Variables

{template.variables.map((variable) => (
{`{{${variable}}}`} {variableDescriptions[variable] ?? variable}
))}
)} {/* Linked Campaign */}

Linked Campaign

{template.linkedCampaignName ? ( {template.linkedCampaignName} ) : ( None (Custom) )}
{/* Approval Status */}

Approval Status

{template.approvalStatus === 'APPROVED' ? ( ✓ Approved ) : template.approvalStatus === 'PENDING' ? ( ⏳ Pending Review ) : ( Rejected )}
{/* Performance */}

Performance

{metrics.map((metric) => (

{metric.value}

{metric.label}

))}
{/* Languages */} {template.language.length > 0 && (

Language

{template.language.map((lang) => ( {lang.toUpperCase()} ))}
)}
); };