'use client'; import { MoreHorizontal, Eye, Settings, Calendar, Tag, FileText, ArrowRight } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/lib/utils'; import Link from 'next/link'; import type { Template } from './index'; interface TemplateCardProps { template: Template; index: number; onViewDetails: (template: Template) => void; } export function TemplateCard({ template, index, onViewDetails }: TemplateCardProps) { const IconComponent = template.icon; const getStatusColor = (status: string) => { switch (status) { case 'active': return 'bg-emerald-500'; case 'coming-soon': return 'bg-amber-500'; case 'draft': return 'bg-gray-500'; default: return 'bg-gray-500'; } }; const getStatusText = (status: string) => { switch (status) { case 'active': return 'Disponible'; case 'coming-soon': return 'Próximamente'; case 'draft': return 'Borrador'; default: return 'Desconocido'; } }; const getStatusBadgeClass = (status: string) => { switch (status) { case 'active': return 'bg-emerald-100 dark:bg-emerald-900/20 text-emerald-700 dark:text-emerald-400'; case 'coming-soon': return 'bg-amber-100 dark:bg-amber-900/20 text-amber-700 dark:text-amber-400'; case 'draft': return 'bg-gray-100 dark:bg-gray-900/20 text-gray-700 dark:text-gray-400'; default: return 'bg-gray-100 dark:bg-gray-900/20 text-gray-700 dark:text-gray-400'; } }; const CardContent = () => (
{/* Header with icon and info */}

{template.name}

{template.category}

{/* Template description */}

{template.description}

{/* Template info */}
{template.contentCount !== undefined && (
Contenidos
{template.contentCount}
)}
Categoría
{template.category}
{/* Solo mostrar fecha si realmente existe y no es coming-soon */} {template.createdAt && template.status !== 'coming-soon' && (
Creación
{new Date(template.createdAt).toLocaleDateString('es-ES', { year: 'numeric', month: 'short', day: 'numeric' })}
)} {/* Para plantillas próximamente, mostrar estado en lugar de fecha */} {template.status === 'coming-soon' && (
Estado
En desarrollo
)}
{/* Status and action buttons */}
{getStatusText(template.status)}
{template.status === 'active' && template.route && (
Abrir
)}
); return (
{template.status === 'active' && template.route ? ( ) : (
onViewDetails(template)}>
)}
); }