"use client"; import React from 'react'; import { Mail, Edit2, Trash2, Eye, Copy, Calendar } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { MailTemplate } from '@/lib/api/mail'; interface MailTemplateCardProps { template: MailTemplate; onEdit: (template: MailTemplate) => void; onDelete: (template: MailTemplate) => void; onPreview: (template: MailTemplate) => void; onDuplicate?: (template: MailTemplate) => void; } export default function MailTemplateCard({ template, onEdit, onDelete, onPreview, onDuplicate, }: MailTemplateCardProps) { const formatDate = (dateString: string) => { return new Date(dateString).toLocaleDateString('ko-KR', { year: 'numeric', month: '2-digit', day: '2-digit', }); }; const getCategoryColor = (category?: string) => { const colors: Record = { welcome: 'bg-blue-100 text-blue-700 border-blue-300', promotion: 'bg-purple-100 text-purple-700 border-purple-300', notification: 'bg-green-100 text-green-700 border-green-300', newsletter: 'bg-orange-100 text-orange-700 border-orange-300', system: 'bg-gray-100 text-gray-700 border-gray-300', }; return colors[category || ''] || 'bg-gray-100 text-gray-700 border-gray-300'; }; return (
{/* 헤더 */}

{template.name}

{template.subject}

{template.category && ( {template.category} )}
{/* 본문 미리보기 */}

컴포넌트 {template.components.length}개

{template.components.slice(0, 3).map((component, idx) => (
{component.type} {component.type === 'text' && component.content && ( {component.content.replace(/<[^>]*>/g, '').substring(0, 30)}... )}
))} {template.components.length > 3 && (

+{template.components.length - 3}개 더보기

)}
{/* 메타 정보 */}
{formatDate(template.createdAt)}
{template.updatedAt !== template.createdAt && ( 수정됨 )}
{/* 액션 버튼 */}
{onDuplicate && ( )}
); }