diff --git a/app/page.jsx b/app/page.jsx index daf173d..15173cb 100644 --- a/app/page.jsx +++ b/app/page.jsx @@ -281,7 +281,7 @@ function TradeModal({ type, fund, holding, onClose, onConfirm, pendingTrades = [ }); const [isAfter3pm, setIsAfter3pm] = useState(nowInTz().hour() >= 15); const [calcShare, setCalcShare] = useState(null); - + const currentPendingTrades = useMemo(() => { return pendingTrades.filter(t => t.fundCode === fund?.code); }, [pendingTrades, fund]); @@ -302,7 +302,7 @@ function TradeModal({ type, fund, holding, onClose, onConfirm, pendingTrades = [ setShowPendingList(false); } }, [showPendingList, currentPendingTrades]); - + const getEstimatePrice = () => fund?.estPricedCoverage > 0.05 ? fund?.estGsz : (typeof fund?.gsz === 'number' ? fund?.gsz : Number(fund?.dwjz)); const [price, setPrice] = useState(getEstimatePrice()); const [loadingPrice, setLoadingPrice] = useState(false); @@ -312,7 +312,7 @@ function TradeModal({ type, fund, holding, onClose, onConfirm, pendingTrades = [ if (date && fund?.code) { setLoadingPrice(true); setActualDate(null); - + let queryDate = date; if (isAfter3pm) { queryDate = toTz(date).add(1, 'day').format('YYYY-MM-DD'); @@ -347,7 +347,7 @@ function TradeModal({ type, fund, holding, onClose, onConfirm, pendingTrades = [ } else { sellFee = parseFloat(feeValue) || 0; } - + const estimatedReturn = sellAmount - sellFee; useEffect(() => { @@ -390,7 +390,7 @@ function TradeModal({ type, fund, holding, onClose, onConfirm, pendingTrades = [ const isValid = isBuy ? (!!amount && !!feeRate && !!date && calcShare !== null) : (!!share && !!date); - + const handleSetShareFraction = (fraction) => { if(availableShare > 0) { setShare((availableShare * fraction).toFixed(2)); @@ -429,12 +429,12 @@ function TradeModal({ type, fund, holding, onClose, onConfirm, pendingTrades = [ {!showPendingList && !showConfirm && currentPendingTrades.length > 0 && ( -