Skip to content

Comments

[refactor] 지원자 탭 확장을 위한 공통 검색창 통일#647

Merged
seongwon030 merged 2 commits intodevelop-fefrom
refactor/#646-common-search-filed-MOA-153
Aug 13, 2025
Merged

[refactor] 지원자 탭 확장을 위한 공통 검색창 통일#647
seongwon030 merged 2 commits intodevelop-fefrom
refactor/#646-common-search-filed-MOA-153

Conversation

@seongwon030
Copy link
Member

@seongwon030 seongwon030 commented Aug 12, 2025

#️⃣연관된 이슈

ex) #646

📝작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지/동영상 첨부 가능)

변경전 SearchBox

전역 컨텍스트, 이벤트 추적로직, 내부 state 등 너무 많은 기능이 들어가 있어 공통 컴포넌트 역할을 하지 못했습니다.

SearchField 로 분리

  • props: value, onChange, onSubmit, placeholder?, ariaLabel?, autoBlur?
  • 기존 메인 페이지 전용 스타일 의존 제거, 공통 스타일을 직접 참조
  • 메인 검색창을 SearchField로 교체하고, 기존 컨텍스트, 이벤트, 홈 다이렉트 기능은 그대로 유지

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

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

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

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

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

🫡 참고사항

Summary by CodeRabbit

  • 신기능
    • 통합된 검색 입력 컴포넌트 도입으로 모바일/데스크톱에서 일관된 검색 경험 제공.
  • 리팩터
    • 검색 상자 구조를 재구성하여 홈으로 이동, 키워드 반영, 카테고리 초기화, 검색 상태 전환 흐름을 정돈.
    • 제출 시 자동 포커스 해제로 연속 검색/탐색 동선 개선.
    • 접근성 라벨과 플레이스홀더를 정비해 사용성 향상.
    • 헤더의 검색 상자는 기존과 동일하게 표시되며, 전반적인 동작은 변함없이 더 안정적으로 작동.

- SearchField.styles.ts 도입으로 페이지 전용 스타일 의존 제거
- SearchField가 공통 스타일을 직접 참조하도록 변경
- 검색 입력 UI의 재사용성/일관성 향상
@seongwon030 seongwon030 self-assigned this Aug 12, 2025
@seongwon030 seongwon030 added 🔨 Refactor 코드 리팩토링 💻 FE Frontend labels Aug 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 12, 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

Warning

Rate limit exceeded

@seongwon030 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 5 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a4187df and 8302e9c.

📒 Files selected for processing (1)
  • frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (1 hunks)

Walkthrough

공통 SearchBox를 제거하고, 재사용 가능한 공통 SearchField 컴포넌트를 추가했으며, 메인 페이지 전용 SearchBox를 새로 도입했습니다. Header는 SearchBox의 import 경로를 메인 페이지 위치로 변경했습니다.

Changes

Cohort / File(s) Summary
Header import 경로 업데이트
frontend/src/components/common/Header/Header.tsx
SearchBox import 경로를 @/pages/MainPage/components/SearchBox/SearchBox로 변경.
공통 SearchBox 제거
frontend/src/components/common/SearchBox/SearchBox.tsx
기존 공통 SearchBox 컴포넌트 파일 삭제.
공통 SearchField 추가
frontend/src/components/common/SearchField/SearchField.tsx
재사용 가능한 제어형 검색 입력 컴포넌트 추가(값/변경/제출/placeholder/aria/autoBlur 지원).
메인 페이지용 SearchBox 추가
frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx
컨텍스트(Search/Category) 및 트래킹 연동, 홈 리다이렉트 포함한 검색 제출 로직 구현. UI는 공통 SearchField 사용.

Sequence Diagram(s)

sequenceDiagram
  actor User
  User->>Header: 입력 및 제출
  Header->>MainPage SearchBox: onSubmit 호출
  MainPage SearchBox->>Router: 홈('/')로 이동(필요 시)
  MainPage SearchBox->>SearchContext: setKeyword(inputValue), setIsSearching(true)
  MainPage SearchBox->>CategoryContext: setSelectedCategory('all')
  MainPage SearchBox->>Tracker: "Search Executed" 이벤트 기록
  MainPage SearchBox->>SearchField: value/onChange 전달
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
공통 검색창 도입 및 사용처 정리 (MOA-153)

Assessment against linked issues: Out-of-scope changes

(해당 없음)

Possibly related issues

Possibly related PRs

Suggested reviewers

  • Zepelown
  • oesnuj
  • lepitaaar
✨ 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/#646-common-search-filed-MOA-153

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

@vercel
Copy link

vercel bot commented Aug 12, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
moadong Ready Preview Comment Aug 13, 2025 8:06am

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: 0

🧹 Nitpick comments (1)
frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (1)

14-18: 홈 리다이렉션 로직을 단순화할 수 있습니다.

현재 구현은 올바르지만, React Router의 navigate 함수는 이미 현재 경로와 동일한 경로로 이동할 때 자동으로 처리하므로 조건문이 불필요할 수 있습니다.

다음과 같이 단순화할 수 있습니다:

-  const redirectToHome = () => {
-    if (location.pathname !== '/') {
-      navigate('/');
-    }
-  };
+  const redirectToHome = () => {
+    navigate('/');
+  };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25fbe15 and a4187df.

📒 Files selected for processing (4)
  • frontend/src/components/common/Header/Header.tsx (1 hunks)
  • frontend/src/components/common/SearchBox/SearchBox.tsx (0 hunks)
  • frontend/src/components/common/SearchField/SearchField.tsx (1 hunks)
  • frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • frontend/src/components/common/SearchBox/SearchBox.tsx
🧰 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/pages/MainPage/components/SearchBox/SearchBox.tsx
  • frontend/src/components/common/Header/Header.tsx
  • frontend/src/components/common/SearchField/SearchField.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/MainPage/components/SearchBox/SearchBox.tsx
  • frontend/src/components/common/Header/Header.tsx
  • frontend/src/components/common/SearchField/SearchField.tsx
🔇 Additional comments (9)
frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (3)

1-12: 의존성 가져오기가 잘 구성되어 있습니다.

필요한 모든 훅과 컴포넌트를 적절히 가져왔고, 코드 구조가 명확합니다.


20-30: 검색 핸들러 로직이 올바르게 구현되었습니다.

검색 실행 시 홈으로 이동, 카테고리 초기화, 검색 상태 설정, 그리고 Mixpanel 이벤트 추적이 모두 적절히 처리되었습니다.


32-41: SearchField 컴포넌트 사용이 적절합니다.

재사용 가능한 SearchField 컴포넌트를 사용하여 관심사를 잘 분리했고, 한국어 플레이스홀더와 접근성 라벨이 적절히 설정되었습니다.

frontend/src/components/common/Header/Header.tsx (1)

3-3: SearchBox 가져오기 경로가 올바르게 업데이트되었습니다.

공통 컴포넌트에서 페이지별 컴포넌트로 이동한 것이 적절하며, 가져오기 경로가 정확히 변경되었습니다.

frontend/src/components/common/SearchField/SearchField.tsx (5)

5-12: 인터페이스 정의가 명확하고 타입 안전성이 보장됩니다.

모든 필수 및 선택적 프로퍼티가 적절히 정의되었고, 기본값 설정도 합리적입니다.


14-21: 기본 매개변수 설정이 적절합니다.

한국어 기본 플레이스홀더와 접근성 라벨이 적절하며, autoBlur 기본값도 합리적입니다.


22-24: 상태 관리가 올바르게 구현되었습니다.

포커스 상태 추적과 입력 참조 설정이 적절합니다.


25-29: 폼 제출 핸들러가 올바르게 구현되었습니다.

기본 이벤트 방지, 콜백 호출, 그리고 조건부 블러 처리가 모두 적절히 구현되었습니다.


31-52: 렌더링 로직과 접근성이 잘 구현되었습니다.

스타일드 컴포넌트를 사용한 조건부 스타일링, 적절한 이벤트 핸들러, 그리고 접근성 속성들이 모두 올바르게 설정되었습니다.

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 (2)
frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (2)

14-18: 홈으로 리다이렉트 로직을 개선하세요.

현재 로직은 단순 경로 비교만 하고 있어 query parameter나 hash가 있는 경우 불필요한 리다이렉트가 발생할 수 있습니다.

  const redirectToHome = () => {
-    if (location.pathname !== '/') {
+    if (location.pathname !== '/' || location.search || location.hash) {
-      navigate('/');
+      navigate('/', { replace: true });
    }
  };

26-29: 객체 축약형을 사용하여 코드를 개선하세요.

코딩 가이드라인에 따라 간결한 객체 표기법을 사용하는 것이 좋습니다.

    trackEvent('Search Executed', {
-      inputValue: inputValue,
+      inputValue,
      page: currentPage,
    });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25fbe15 and a4187df.

📒 Files selected for processing (4)
  • frontend/src/components/common/Header/Header.tsx (1 hunks)
  • frontend/src/components/common/SearchBox/SearchBox.tsx (0 hunks)
  • frontend/src/components/common/SearchField/SearchField.tsx (1 hunks)
  • frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • frontend/src/components/common/SearchBox/SearchBox.tsx
🧰 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/components/common/Header/Header.tsx
  • frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx
  • frontend/src/components/common/SearchField/SearchField.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/components/common/Header/Header.tsx
  • frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx
  • frontend/src/components/common/SearchField/SearchField.tsx
🧬 Code Graph Analysis (1)
frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (2)
frontend/src/context/SearchContext.tsx (1)
  • useSearch (39-45)
frontend/src/context/CategoryContext.tsx (1)
  • useCategory (11-18)
🔇 Additional comments (8)
frontend/src/components/common/Header/Header.tsx (1)

3-3: import 경로 변경이 적절합니다.

SearchBox를 메인 페이지 전용 컴포넌트로 이동시킨 것은 공통 검색창 통일이라는 PR 목표에 부합합니다. 재사용 가능한 SearchField 컴포넌트를 도입하고 페이지별 특화된 SearchBox를 분리한 아키텍처 개선입니다.

frontend/src/pages/MainPage/components/SearchBox/SearchBox.tsx (2)

1-6: 의존성 import가 적절합니다.

필요한 context, hook, 컴포넌트들을 명확하게 import하고 있으며, 새로운 SearchField 컴포넌트를 활용하는 구조가 좋습니다.


32-40: SearchField 사용이 적절합니다.

새로운 SearchField 컴포넌트를 활용하여 UI와 비즈니스 로직을 적절히 분리했습니다. props 전달도 명확하고 한국어 placeholder와 aria-label 설정이 사용자 경험을 고려한 좋은 구현입니다.

frontend/src/components/common/SearchField/SearchField.tsx (5)

5-12: interface 정의가 명확합니다.

props 타입 정의가 명확하고 선택적 props에 대한 기본값 설정도 적절합니다.


14-23: 기본값 설정과 ref 사용이 적절합니다.

한국어 기본 placeholder와 aria-label 설정이 좋고, input blur 처리를 위한 ref 사용도 적절합니다.


25-29: form submit 핸들링이 올바릅니다.

preventDefault() 호출과 조건부 blur 처리가 적절하게 구현되어 있습니다.


31-52: 접근성을 고려한 UI 구현이 훌륭합니다.

form 요소 사용, aria-label 설정, 적절한 button type 지정 등 웹 접근성을 잘 고려한 구현입니다. focus 상태 관리도 사용자 경험을 향상시키는 좋은 기능입니다.


32-32: Transient Prop $isFocused 검증 완료

  • frontend/src/components/common/SearchField/SearchField.styles.ts: styled.form과 styled.button에서 제네릭 { $isFocused: boolean }으로 선언·사용하여, DOM에 전달되지 않으면서 스타일링에 정상 작동함이 확인되었습니다.
    추가 조치 불필요합니다.

@seongwon030 seongwon030 linked an issue Aug 13, 2025 that may be closed by this pull request
2 tasks
Copy link
Contributor

@lepitaaar lepitaaar left a comment

Choose a reason for hiding this comment

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

수고하셧습니다

@seongwon030 seongwon030 merged commit 8b2ee19 into develop-fe Aug 13, 2025
5 checks passed
@seongwon030 seongwon030 deleted the refactor/#646-common-search-filed-MOA-153 branch August 13, 2025 08:15
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.

[refactor] MOA-153 지원자 탭 확장을 위한 공통 검색창 도입

2 participants