Skip to content

[refactor] 하드코딩된 드롭다운 메뉴 변경#716

Merged
lepitaaar merged 1 commit intodevelop-fefrom
refactor/#715-hardcoding-category-refactoring-MOA-209
Sep 2, 2025
Merged

[refactor] 하드코딩된 드롭다운 메뉴 변경#716
lepitaaar merged 1 commit intodevelop-fefrom
refactor/#715-hardcoding-category-refactoring-MOA-209

Conversation

@lepitaaar
Copy link
Contributor

@lepitaaar lepitaaar commented Sep 1, 2025

#️⃣연관된 이슈

#715

📝작업 내용

반복되는 태그 구조를 사용가능한 상태를 변수로 받아 반복을 하게 변경되었습니다.

<Styled.StatusSelect
  id='statusSelect'
  value={applicantStatus}
  onChange={handleStatusChange}
  $backgroundColor={getStatusColor(applicantStatus)}
>
  {AVAILABLE_STATUSES.map((status) => (
    <option key={status} value={status}>
      {mapStatusToGroup(status).label}
    </option>
  ))}
</Styled.StatusSelect>

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

  • Refactor

    • 관리자 페이지의 지원자 상태 선택 메뉴(목록/상세)가 단일한 상태 소스에 기반해 동일하게 동작하도록 통합했습니다.
    • 상태 옵션을 데이터 기반으로 생성하여 화면 전반의 일관성을 높이고, 향후 상태 추가 시 자동 반영되도록 개선했습니다.
  • Chores

    • 상태 옵션을 중앙집중화해 중복 정의를 제거하고 관리 용이성을 향상했습니다.

@lepitaaar lepitaaar self-assigned this Sep 1, 2025
@lepitaaar lepitaaar added 🔨 Refactor 코드 리팩토링 💻 FE Frontend labels Sep 1, 2025
@vercel
Copy link

vercel bot commented Sep 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
moadong Ready Ready Preview Comment Sep 1, 2025 9:32am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

상태 상수 AVAILABLE_STATUSES를 새로운 constants 모듈로 분리하고, ApplicantsTab 및 ApplicantDetailPage에서 하드코딩된 상태 목록을 해당 상수 import로 대체했습니다. 상태 라벨 표시는 기존 mapStatusToGroup을 사용하며, 나머지 로직 변경은 없습니다.

Changes

Cohort / File(s) Summary
상수 정의 추가
frontend/src/constants/status.ts
새로운 AVAILABLE_STATUSES 상수 추가. ApplicationStatus.SUBMITTED, INTERVIEW_SCHEDULED, ACCEPTED, DECLINEDas const로 고정.
ApplicantDetailPage 상수 사용 전환
frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantDetailPage/ApplicantDetailPage.tsx
로컬 AVAILABLE_STATUSES 제거 후 @/constants/status에서 import하여 사용. 렌더링/업데이트 로직은 동일.
ApplicantsTab 상수 사용 전환
frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx
하드코딩된 상태 메뉴를 AVAILABLE_STATUSES 기반 동적 생성으로 교체. 라벨은 mapStatusToGroup(status).label 사용.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
상태변경에 하드코딩된 태그 수정 MOA-209

Assessment against linked issues: Out-of-scope changes

(해당 없음)

Possibly related issues

Possibly related PRs

Suggested reviewers

  • seongwon030
  • suhyun113
  • oesnuj
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#715-hardcoding-category-refactoring-MOA-209

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/constants/status.ts (1)

1-8: 상태 상수 중앙화 잘 됨 — 유니온 타입도 함께 공개하면 타입 안정성↑

소비 측에서 허용 가능한 상태 집합을 정확히 표현할 수 있도록 유니온 타입을 추가로 export하는 것을 권장합니다.

 export const AVAILABLE_STATUSES = [
   ApplicationStatus.SUBMITTED, // 서류검토 (SUBMITTED 포함)
   ApplicationStatus.INTERVIEW_SCHEDULED, // 면접예정
   ApplicationStatus.ACCEPTED, // 합격
   ApplicationStatus.DECLINED, // 불합격
 ] as const;
+
+export type AvailableStatus = (typeof AVAILABLE_STATUSES)[number];
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bf5bbe7 and 4849c63.

📒 Files selected for processing (3)
  • frontend/src/constants/status.ts (1 hunks)
  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantDetailPage/ApplicantDetailPage.tsx (1 hunks)
  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (frontend/.cursorrules)

frontend/**/*.{ts,tsx}: Replace magic numbers with named constants for clarity.
Replace complex or nested ternary operators with if/else statements or IIFEs for readability.
Assign complex boolean conditions to named variables.
Use consistent return types for similar functions and hooks.
Avoid hidden side effects; functions should only perform actions implied by their signature (Single Responsibility Principle).
Use unique, descriptive names for custom wrappers and functions to avoid ambiguity.
Define constants near related logic or ensure names link them clearly.

Files:

  • frontend/src/constants/status.ts
  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx
  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantDetailPage/ApplicantDetailPage.tsx
frontend/**/*.tsx

📄 CodeRabbit inference engine (frontend/.cursorrules)

frontend/**/*.tsx: Abstract complex logic/interactions into dedicated components or higher-order components (HOCs).
Separate significantly different conditional UI/logic into distinct components.
Colocate simple, localized logic or use inline definitions to reduce context switching.
Choose field-level or form-level cohesion based on form requirements.
Break down broad state management into smaller, focused hooks or contexts.
Use component composition instead of props drilling.

Files:

  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx
  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantDetailPage/ApplicantDetailPage.tsx
🧠 Learnings (2)
📚 Learning: 2025-07-19T05:09:10.702Z
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.{ts,tsx} : Replace magic numbers with named constants for clarity.

Applied to files:

  • frontend/src/constants/status.ts
  • frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantDetailPage/ApplicantDetailPage.tsx
📚 Learning: 2025-07-19T05:09:10.702Z
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.{ts,tsx} : Define constants near related logic or ensure names link them clearly.

Applied to files:

  • frontend/src/constants/status.ts
🧬 Code graph analysis (2)
frontend/src/constants/status.ts (1)
frontend/src/types/applicants.ts (1)
  • ApplicationStatus (3-8)
frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx (1)
frontend/src/constants/status.ts (1)
  • AVAILABLE_STATUSES (3-8)
🔇 Additional comments (2)
frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantDetailPage/ApplicantDetailPage.tsx (1)

17-17: 중앙 상수로의 전환 좋습니다

로컬 상수 제거로 중복이 줄고 일관성이 좋아졌습니다.

frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx (1)

13-13: 중앙화된 상태 상수 사용 👍

하드코딩 제거 및 유지보수성 향상에 도움이 됩니다.

Comment on lines +241 to +249
{AVAILABLE_STATUSES.map((status) => (
<Styled.StatusSelectMenuItem
onClick={() => {
updateAllApplicants(status);
}}
>
{mapStatusToGroup(status).label}
</Styled.StatusSelectMenuItem>
))}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

React 리스트 key 누락 — 고유 key 추가 필요

.map으로 그리는 메뉴 아이템에 key가 없어 경고 및 재조정 비용이 발생할 수 있습니다. status를 key로 부여하세요.

적용 예시:

-                {AVAILABLE_STATUSES.map((status) => (
-                  <Styled.StatusSelectMenuItem
+                {AVAILABLE_STATUSES.map((status) => (
+                  <Styled.StatusSelectMenuItem
+                    key={status}
                     onClick={() => {
                       updateAllApplicants(status);
                     }}
                   >
                     {mapStatusToGroup(status).label}
                   </Styled.StatusSelectMenuItem>
                 ))}

추가로, 접근성 개선(선택 사항):

-                  <Styled.StatusSelectMenuItem
+                  <Styled.StatusSelectMenuItem
+                    role="menuitem"
+                    tabIndex={0}
                     onClick={() => {
                       updateAllApplicants(status);
                     }}
+                    onKeyDown={(e) => {
+                      if (e.key === 'Enter' || e.key === ' ') {
+                        e.preventDefault();
+                        updateAllApplicants(status);
+                      }
+                    }}
                   >
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{AVAILABLE_STATUSES.map((status) => (
<Styled.StatusSelectMenuItem
onClick={() => {
updateAllApplicants(status);
}}
>
{mapStatusToGroup(status).label}
</Styled.StatusSelectMenuItem>
))}
{AVAILABLE_STATUSES.map((status) => (
<Styled.StatusSelectMenuItem
key={status}
role="menuitem"
tabIndex={0}
onClick={() => {
updateAllApplicants(status);
}}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
updateAllApplicants(status);
}
}}
>
{mapStatusToGroup(status).label}
</Styled.StatusSelectMenuItem>
))}
🤖 Prompt for AI Agents
In frontend/src/pages/AdminPage/tabs/ApplicantsTab/ApplicantsTab.tsx around
lines 241 to 249, the mapped list of Styled.StatusSelectMenuItem elements is
missing a unique key which causes React warnings and render inefficiencies; add
a key prop using the status value (e.g., key={status}) on each mapped item to
ensure uniqueness, and optionally include an accessible role/aria attributes on
the menu items if needed for keyboard/screen-reader support.

Copy link
Member

@oesnuj oesnuj left a comment

Choose a reason for hiding this comment

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

빠른 리뷰 반영 💯점 드릴게요
지원자 상태 상수파일로 분리한거 좋네요
코드가 훨씬 깔끔해 진 것 같아요~~

@lepitaaar lepitaaar merged commit 0ed2fa7 into develop-fe Sep 2, 2025
5 checks passed
@lepitaaar lepitaaar deleted the refactor/#715-hardcoding-category-refactoring-MOA-209 branch September 20, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments