'use client' import { FixedDebt, VariableDebt } from '@/lib/types' import { formatCurrency, formatShortDate } from '@/lib/utils' import { cn } from '@/lib/utils' import { Pencil, Trash2, Check } from 'lucide-react' interface DebtCardProps { debt: FixedDebt | VariableDebt type: 'fixed' | 'variable' onTogglePaid: () => void onEdit: () => void onDelete: () => void } const fixedCategoryColors: Record = { housing: 'bg-blue-500/20 text-blue-400 border-blue-500/30', services: 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30', subscription: 'bg-purple-500/20 text-purple-400 border-purple-500/30', other: 'bg-gray-500/20 text-gray-400 border-gray-500/30', } const variableCategoryColors: Record = { shopping: 'bg-pink-500/20 text-pink-400 border-pink-500/30', food: 'bg-orange-500/20 text-orange-400 border-orange-500/30', entertainment: 'bg-indigo-500/20 text-indigo-400 border-indigo-500/30', health: 'bg-red-500/20 text-red-400 border-red-500/30', transport: 'bg-cyan-500/20 text-cyan-400 border-cyan-500/30', other: 'bg-gray-500/20 text-gray-400 border-gray-500/30', } const categoryLabels: Record = { housing: 'Vivienda', services: 'Servicios', subscription: 'Suscripción', shopping: 'Compras', food: 'Comida', entertainment: 'Entretenimiento', health: 'Salud', transport: 'Transporte', other: 'Otro', } export function DebtCard({ debt, type, onTogglePaid, onEdit, onDelete }: DebtCardProps) { const isFixed = type === 'fixed' const categoryColors = isFixed ? fixedCategoryColors : variableCategoryColors const categoryColor = categoryColors[debt.category] || categoryColors.other const getDueInfo = () => { if (isFixed) { const fixedDebt = debt as FixedDebt return `Vence día ${fixedDebt.dueDay}` } else { const variableDebt = debt as VariableDebt return formatShortDate(variableDebt.date) } } return (
{/* Checkbox */} {/* Content */}

{debt.name}

{getDueInfo()}

{formatCurrency(debt.amount)}
{categoryLabels[debt.category] || debt.category} {isFixed && (debt as FixedDebt).isAutoDebit && ( Débito automático )}
{/* Actions */}
) }