diff --git a/frontend/src/components/PortfolioPanel.tsx b/frontend/src/components/PortfolioPanel.tsx index 7bbb956..6a57474 100644 --- a/frontend/src/components/PortfolioPanel.tsx +++ b/frontend/src/components/PortfolioPanel.tsx @@ -13,12 +13,13 @@ * 한국/미국 시장 구분: * - 종목 코드가 6자리 숫자면 KR, 그 외는 US */ -import React from 'react' +import React, { useMemo } from 'react' import { useQuery } from '@tanstack/react-query' import api from '../lib/api' -import { Activity, TrendingUp, Clock } from 'lucide-react' +import { Activity, TrendingUp, Clock, UserCircle, Globe } from 'lucide-react' import { Position } from '../types/trading' import { isUsStock } from '../utils/stockUtils' +import { groupHoldings, GroupedHolding } from '../utils/portfolioGrouping' import AccountSetupNotice from './AccountSetupNotice' import DayTradingStatusBar from './DayTradingStatusBar' @@ -95,9 +96,12 @@ const PortfolioItem = React.memo(({ const isSelected = selectedStock === stock.stock_code const isUp = profitLossRate >= 0 + const splitLocked = Number((stock as GroupedHolding).isSplit) > 0 || Number((stock as GroupedHolding).dtIncluded) > 0 + const sellBlocked = !!sellDisabled || splitLocked + const handleSellClick = async (e: React.MouseEvent) => { e.stopPropagation() - if (sellDisabled) return + if (sellBlocked) return try { await onSell(stock.stock_code, stock.stock_name, quantity) } catch (error: unknown) { @@ -126,9 +130,25 @@ const PortfolioItem = React.memo(({ {isUs ? 'US' : 'KR'} - {stock.strategy_type === 'daytrading' && ( + {(stock.strategy_type === 'daytrading' || stock.strategy_type === 'day_trade') && ( 데이 )} + {(stock.strategy_type === 'external' || stock.strategy_type === 'manual') && ( + + {stock.strategy_type === 'external' ? '외부' : '수동'} + + )} + {Number((stock as GroupedHolding).dtIncluded) > 0 && ( + + DT 포함? + + )} {profitLossRate > 0 ? '+' : ''}{profitLossRate.toFixed(2)}% @@ -154,7 +174,8 @@ const PortfolioItem = React.memo(({