import { X } from "lucide-react"; import { useState } from "react"; import { usePortfolioStore } from "../store/portfolioStore"; import { Investment } from "../types"; interface EditInvestmentModalProps { investment: Investment; assetId: string; onClose: () => void; } export const EditInvestmentModal = ({ investment, assetId, onClose }: EditInvestmentModalProps) => { const updateInvestment = usePortfolioStore((state) => state.updateInvestment); const [amount, setAmount] = useState(investment.amount.toString()); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); updateInvestment(assetId, investment.id, { ...investment, amount: parseFloat(amount), }); onClose(); }; return (

Edit Investment

setAmount(e.target.value)} className="w-full p-2 border rounded" step="0.01" min="0" required />
{investment.type === 'periodic' && (

Note: Editing a periodic investment will affect all future investments.

)}
); };