import React, { useState } from 'react'; interface AlertManagerProps { alerts: Array<{ price: number; label: string }>; onAdd: (price: number, label: string) => void; onRemove: (price: number) => void; onClose: () => void; currentPrice: number; } const AlertManager: React.FC = ({ alerts, onAdd, onRemove, onClose, currentPrice }) => { const [priceInput, setPriceInput] = useState(currentPrice.toFixed(2)); const [labelInput, setLabelInput] = useState(''); const handleAdd = () => { const price = parseFloat(priceInput); if (!isNaN(price) && price > 0) { onAdd(price, labelInput.trim()); setLabelInput(''); } }; return (
πŸ”” 가격 μ•Œλ¦Ό
setPriceInput(e.target.value)} placeholder="가격" /> setLabelInput(e.target.value)} placeholder="λ©”λͺ¨ (선택)" />
{alerts.length === 0 &&
μ„€μ •λœ μ•Œλ¦Ό μ—†μŒ
} {alerts.map((a, i) => (
{a.price.toFixed(2)} {a.label && {a.label}}
))}
); }; export default AlertManager;