'use client' import { useState } from 'react' import { useFinanzasStore } from '@/lib/store' import { X, CreditCard, Calendar, DollarSign, Palette } from 'lucide-react' import { cn } from '@/lib/utils' interface AddCardModalProps { isOpen: boolean onClose: () => void } const COLORS = [ { name: 'Slate', value: '#64748b' }, { name: 'Blue', value: '#3b82f6' }, { name: 'Cyan', value: '#06b6d4' }, { name: 'Emerald', value: '#10b981' }, { name: 'Violet', value: '#8b5cf6' }, { name: 'Rose', value: '#f43f5e' }, { name: 'Amber', value: '#f59e0b' }, ] export function AddCardModal({ isOpen, onClose }: AddCardModalProps) { const addCreditCard = useFinanzasStore((state) => state.addCreditCard) const [name, setName] = useState('') const [lastFour, setLastFour] = useState('') const [limit, setLimit] = useState('') const [closingDay, setClosingDay] = useState('') const [dueDay, setDueDay] = useState('') const [selectedColor, setSelectedColor] = useState(COLORS[1].value) if (!isOpen) return null const handleSubmit = (e: React.FormEvent) => { e.preventDefault() if (!name || !limit || !closingDay || !dueDay) return addCreditCard({ name, lastFourDigits: lastFour || '****', closingDay: parseInt(closingDay), dueDay: parseInt(dueDay), currentBalance: 0, creditLimit: parseFloat(limit), color: selectedColor }) // Reset setName('') setLastFour('') setLimit('') setClosingDay('') setDueDay('') setSelectedColor(COLORS[1].value) onClose() } return (
{/* Header */}

Nueva Tarjeta

{/* Name & Last 4 */}
setName(e.target.value)} className="w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none" required autoFocus />
setLastFour(e.target.value)} className="w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none text-center tracking-widest" />
{/* Limit */}
$ setLimit(e.target.value)} className="w-full pl-8 pr-4 py-3 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white text-lg font-mono outline-none" required />
{/* Closing Day */}
setClosingDay(e.target.value)} className="w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none" required /> del mes
{/* Due Day */}
setDueDay(e.target.value)} className="w-full px-4 py-2.5 bg-slate-950 border border-slate-800 rounded-lg focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500 text-white outline-none" required /> del mes
{/* Color Picker */}
{COLORS.map((color) => (
) }