'use client'; import { useState } from 'react'; import { motion } from 'framer-motion'; import { CloseIcon, PlusIcon } from './Icons'; export default function AddFundToGroupModal({ allFunds, currentGroupCodes, onClose, onAdd }) { const [selected, setSelected] = useState(new Set()); const availableFunds = (allFunds || []).filter(f => !(currentGroupCodes || []).includes(f.code)); const toggleSelect = (code) => { setSelected(prev => { const next = new Set(prev); if (next.has(code)) next.delete(code); else next.add(code); return next; }); }; return ( e.stopPropagation()} >
添加基金到分组
{availableFunds.length === 0 ? (

所有基金已在该分组中

) : (
{availableFunds.map((fund) => (
toggleSelect(fund.code)} style={{ cursor: 'pointer' }} >
{selected.has(fund.code) &&
}
{fund.name}
#{fund.code}
))}
)}
); }