Skip to content

20260312 #275 현재 포지션 컴포넌트 개선#303

Merged
discipline24 merged 2 commits intomainfrom
20260312-#275-현재-포지션-컴포넌트-개선
Mar 12, 2026

Hidden character warning

The head ref may contain hidden characters: "20260312-#275-\ud604\uc7ac-\ud3ec\uc9c0\uc158-\ucef4\ud3ec\ub10c\ud2b8-\uac1c\uc120"
Merged

20260312 #275 현재 포지션 컴포넌트 개선#303
discipline24 merged 2 commits intomainfrom
20260312-#275-현재-포지션-컴포넌트-개선

Conversation

@discipline24
Copy link
Copy Markdown
Contributor

@discipline24 discipline24 commented Mar 12, 2026

Summary by CodeRabbit

개선 사항

  • 프로필 편집 시 비밀번호 변경 절차 간소화
  • 자산의 수익/손실 상태를 색상으로 구분하여 표시 개선 (수익: 빨강, 손실: 파랑, 중립: 회색)

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 12, 2026

Walkthrough

프로필 수정 모달의 비밀번호 변경 흐름을 간소화하고, 거래 대시보드의 손익(PNL) 표시를 위해 CSS 색상 유틸리티를 추가하며, PNL 포맷팅 로직을 재사용 가능한 헬퍼 함수로 리팩토링했습니다.

Changes

Cohort / File(s) Summary
프로필 수정 모달 플로우 간소화
frontend/src/components/mypage/EditProfileModal.jsx
비밀번호 변경 흐름에서 중간 검증 단계를 제거하고, 단일 폼 상태('form')를 사용하도록 통합. 폼 유효성을 Boolean 값으로 처리하고 버튼 활성화 로직을 간소화.
PNL 스타일링 확장
frontend/src/pages/QuantTradingDashboard.css
기존 .holding-pnl 색상 선언을 제거하고, 수익/손실/중립 상태를 구분하는 세 가지 색상 유틸리티 클래스 추가 (profit: #ff6348, loss: #4baaff, neutral: #6b7280).
PNL 표시 로직 리팩토링
frontend/src/pages/QuantTradingDashboard.jsx
포맷팅 로직을 헬퍼 함수(formatHoldingAmount, formatSignedHoldingAmount, formatPnlRatePercent, getHoldingPnlClassName)로 추출하고, 인라인 스타일 대신 클래스 기반 스타일링 적용.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • gxuoo
  • DongEun02

Poem

🐰 폼의 단계를 정리하고,
손익 색상을 예쁘게 칠하며,
헬퍼 함수로 코드를 정갈히 모으니,
대시보드가 반짝반짝 빛나는군요!
이번 변화도 깔끔하고 좋습니다. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 주요 변경 사항인 '현재 포지션 컴포넌트 개선'을 명확하게 설명하고 있으며, 변경된 파일들(EditProfileModal, QuantTradingDashboard CSS/JSX)의 개선 사항과 부합합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 20260312-#275-현재-포지션-컴포넌트-개선

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
frontend/src/pages/QuantTradingDashboard.jsx (1)

80-113: HoldingsList 컴포넌트가 사용되지 않습니다.

이 컴포넌트가 정의되어 있지만 QuantTradingDashboard 컴포넌트에서 호출되지 않습니다. 메인 컴포넌트(Lines 557-579)에서 동일한 렌더링 로직을 직접 구현하고 있어 코드 중복이 발생합니다.

두 가지 선택지가 있습니다:

  1. HoldingsList 컴포넌트를 메인 대시보드에서 실제로 사용
  2. 사용하지 않는다면 제거하여 유지보수 부담 감소
♻️ 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이 호출될 가능성은 낮지만, passwordDatanull인 상태에서 .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

📥 Commits

Reviewing files that changed from the base of the PR and between 69008bc and a744ad8.

📒 Files selected for processing (3)
  • frontend/src/components/mypage/EditProfileModal.jsx
  • frontend/src/pages/QuantTradingDashboard.css
  • frontend/src/pages/QuantTradingDashboard.jsx

@discipline24 discipline24 merged commit 1e6a205 into main Mar 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚀 [기능개선][퀀트봇] 현재 포지션 컴포넌트 개선

1 participant