From ca5adbf4a43209ddc55422e8e1488bcb38f45c14 Mon Sep 17 00:00:00 2001 From: gahusb Date: Fri, 10 Jul 2026 10:20:56 +0900 Subject: [PATCH] =?UTF-8?q?refactor(portfolio):=20=EC=98=88=EC=88=98?= =?UTF-8?q?=EA=B8=88=20=ED=8C=A8=EB=84=90=20CashPanel=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EC=B6=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) Claude-Session: https://claude.ai/code/session_01UHXzpsZQxKG9hQmNRfZjRS --- src/pages/stock/components/PortfolioTab.jsx | 127 +---------------- .../stock/components/portfolio/CashPanel.jsx | 132 ++++++++++++++++++ 2 files changed, 134 insertions(+), 125 deletions(-) create mode 100644 src/pages/stock/components/portfolio/CashPanel.jsx diff --git a/src/pages/stock/components/PortfolioTab.jsx b/src/pages/stock/components/PortfolioTab.jsx index 2412597..9acc7de 100644 --- a/src/pages/stock/components/PortfolioTab.jsx +++ b/src/pages/stock/components/PortfolioTab.jsx @@ -5,6 +5,7 @@ import PriceSessionBadge from './portfolio/PriceSessionBadge'; import AddHoldingForm from './portfolio/AddHoldingForm'; import PortfolioSummary from './portfolio/PortfolioSummary'; import AssetHistoryChart from './portfolio/AssetHistoryChart'; +import CashPanel from './portfolio/CashPanel'; const PortfolioTab = ({ pf, asset, handleSell, handleSaveSnapshot }) => ( <> @@ -53,131 +54,7 @@ const PortfolioTab = ({ pf, asset, handleSell, handleSaveSnapshot }) => ( {/* 예수금 패널 */} -
-
-
-

예수금 관리

-

증권사별 예수금

-

- 증권사별 예수금을 입력하면 총 자산에 자동 반영됩니다. -

-
-
- - {pf.cashList.length > 0 && ( -
- {pf.cashList.map((item) => { - const isEditing = pf.cashEditingBroker === item.broker; - return ( -
- {item.broker} - {isEditing ? ( - pf.setCashEditingValue(e.target.value)} - onKeyDown={(e) => { - if (e.key === 'Enter') pf.handleCashInlineSave(item.broker); - if (e.key === 'Escape') pf.handleCashInlineCancel(); - }} - autoFocus - /> - ) : ( - - {formatNumber(item.cash)}원 - - )} - - {item.updated_at - ? new Date(item.updated_at).toLocaleDateString('ko-KR') - : ''} - - {isEditing ? ( - <> - - - - ) : ( - <> - - - - )} -
- ); - })} -
- )} - {pf.cashList.length === 0 && ( -

- 등록된 예수금이 없습니다. -

- )} - -
- - - - {pf.cashError &&

{pf.cashError}

} -
-
+ {/* Broker cards stacked */} {pf.brokerGroups.map(([broker, items]) => { diff --git a/src/pages/stock/components/portfolio/CashPanel.jsx b/src/pages/stock/components/portfolio/CashPanel.jsx new file mode 100644 index 0000000..ee99375 --- /dev/null +++ b/src/pages/stock/components/portfolio/CashPanel.jsx @@ -0,0 +1,132 @@ +import React from 'react'; +import { formatNumber } from '../../stockUtils'; + +const CashPanel = ({ pf }) => ( +
+
+
+

예수금 관리

+

증권사별 예수금

+

+ 증권사별 예수금을 입력하면 총 자산에 자동 반영됩니다. +

+
+
+ + {pf.cashList.length > 0 && ( +
+ {pf.cashList.map((item) => { + const isEditing = pf.cashEditingBroker === item.broker; + return ( +
+ {item.broker} + {isEditing ? ( + pf.setCashEditingValue(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') pf.handleCashInlineSave(item.broker); + if (e.key === 'Escape') pf.handleCashInlineCancel(); + }} + autoFocus + /> + ) : ( + + {formatNumber(item.cash)}원 + + )} + + {item.updated_at + ? new Date(item.updated_at).toLocaleDateString('ko-KR') + : ''} + + {isEditing ? ( + <> + + + + ) : ( + <> + + + + )} +
+ ); + })} +
+ )} + {pf.cashList.length === 0 && ( +

+ 등록된 예수금이 없습니다. +

+ )} + +
+ + + + {pf.cashError &&

{pf.cashError}

} +
+
+); + +export default CashPanel;