20260312 #275 현재 포지션 컴포넌트 개선#303
Hidden character warning
Conversation
Walkthrough프로필 수정 모달의 비밀번호 변경 흐름을 간소화하고, 거래 대시보드의 손익(PNL) 표시를 위해 CSS 색상 유틸리티를 추가하며, PNL 포맷팅 로직을 재사용 가능한 헬퍼 함수로 리팩토링했습니다. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
frontend/src/pages/QuantTradingDashboard.jsx (1)
80-113:HoldingsList컴포넌트가 사용되지 않습니다.이 컴포넌트가 정의되어 있지만
QuantTradingDashboard컴포넌트에서 호출되지 않습니다. 메인 컴포넌트(Lines 557-579)에서 동일한 렌더링 로직을 직접 구현하고 있어 코드 중복이 발생합니다.두 가지 선택지가 있습니다:
HoldingsList컴포넌트를 메인 대시보드에서 실제로 사용- 사용하지 않는다면 제거하여 유지보수 부담 감소
♻️ HoldingsList 컴포넌트 활용 제안
Lines 556-580의 포지션 렌더링 부분을 다음과 같이 대체할 수 있습니다:
{/* 포지션 + 전략 수익 곡선 */} <div className="content-row"> - <div className="holdings-card"> - <div className="section-title">현재 포지션</div> - - {positions.length === 0 && ( - <div style={{ color: '#6b7280' }}>보유 포지션이 없습니다.</div> - )} - - {positions.map((p) => ( - <div className="holding-item" key={p.ticker}> - ... - </div> - ))} - </div> + <HoldingsList positions={positions} loading={false} error={null} /> <StrategyEquityChart단,
HoldingsList의 섹션 타이틀이 "보유 주식"인 반면 현재 메인에서는 "현재 포지션"을 사용하므로, 타이틀을 prop으로 받도록 수정하거나 통일이 필요합니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/src/pages/QuantTradingDashboard.jsx` around lines 80 - 113, HoldingsList is defined but unused inside QuantTradingDashboard, causing duplicated position-rendering logic; replace the inline rendering in QuantTradingDashboard (the block around where positions are mapped) with the HoldingsList component or remove HoldingsList; to use it, modify HoldingsList to accept a title prop (e.g., title) and pass positions, loading, error from QuantTradingDashboard into HoldingsList (call HoldingsList with title="현재 포지션" or unify titles), or if you opt to delete, remove the HoldingsList function and consolidate any helper calls it uses (formatHoldingAmount, getHoldingPnlClassName, formatSignedHoldingAmount, formatPnlRatePercent) to avoid orphaned code.frontend/src/components/mypage/EditProfileModal.jsx (1)
93-103:passwordData가 null일 경우에 대한 방어 코드 추가 권장버튼이 비활성화 상태에서
handleSubmit이 호출될 가능성은 낮지만,passwordData가null인 상태에서.currentPassword접근 시TypeError가 발생할 수 있습니다. 키보드 이벤트나 예기치 않은 호출에 대비한 방어 코드를 권장합니다.🛡️ null 체크 추가 제안
if (mode === 'password') { + if (!passwordData) return; await updateUserDetails({ currentPassword: passwordData.currentPassword, newPassword: passwordData.newPassword, });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@frontend/src/components/mypage/EditProfileModal.jsx` around lines 93 - 103, Add a null check for passwordData before accessing its properties inside the password branch: when mode === 'password' verify if passwordData is truthy (e.g., if (!passwordData) { toast.error('비밀번호 정보를 찾을 수 없습니다.'); onClose?.(); return; }) before calling updateUserDetails({ currentPassword: ..., newPassword: ... }); This prevents a TypeError when passwordData is null and keeps the existing flow that shows success toast, calls onSuccess and onClose after updateUserDetails completes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@frontend/src/components/mypage/EditProfileModal.jsx`:
- Around line 93-103: Add a null check for passwordData before accessing its
properties inside the password branch: when mode === 'password' verify if
passwordData is truthy (e.g., if (!passwordData) { toast.error('비밀번호 정보를 찾을 수
없습니다.'); onClose?.(); return; }) before calling updateUserDetails({
currentPassword: ..., newPassword: ... }); This prevents a TypeError when
passwordData is null and keeps the existing flow that shows success toast, calls
onSuccess and onClose after updateUserDetails completes.
In `@frontend/src/pages/QuantTradingDashboard.jsx`:
- Around line 80-113: HoldingsList is defined but unused inside
QuantTradingDashboard, causing duplicated position-rendering logic; replace the
inline rendering in QuantTradingDashboard (the block around where positions are
mapped) with the HoldingsList component or remove HoldingsList; to use it,
modify HoldingsList to accept a title prop (e.g., title) and pass positions,
loading, error from QuantTradingDashboard into HoldingsList (call HoldingsList
with title="현재 포지션" or unify titles), or if you opt to delete, remove the
HoldingsList function and consolidate any helper calls it uses
(formatHoldingAmount, getHoldingPnlClassName, formatSignedHoldingAmount,
formatPnlRatePercent) to avoid orphaned code.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1193c811-8e31-40ce-92ca-5d876dedfa51
📒 Files selected for processing (3)
frontend/src/components/mypage/EditProfileModal.jsxfrontend/src/pages/QuantTradingDashboard.cssfrontend/src/pages/QuantTradingDashboard.jsx
Summary by CodeRabbit
개선 사항