Skip to content

Comments

[feature] 검색 시 전체동아리 기준으로 검색된다#616

Merged
seongwon030 merged 1 commit intodevelop-fefrom
feature/#615-search-all-clubs-MOA-130
Aug 3, 2025
Merged

[feature] 검색 시 전체동아리 기준으로 검색된다#616
seongwon030 merged 1 commit intodevelop-fefrom
feature/#615-search-all-clubs-MOA-130

Conversation

@seongwon030
Copy link
Member

@seongwon030 seongwon030 commented Aug 2, 2025

#️⃣연관된 이슈

ex) #615

📝작업 내용

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

  • 카테고리 선택과 상관없이 모든 동아리 기준으로 검색되도록 변경했습니다.
2025-08-03.01.51.34.mov

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

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

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

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

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

🫡 참고사항

Summary by CodeRabbit

  • 신규 기능

    • 검색 상태를 나타내는 기능이 추가되어, 검색 중임을 명확하게 표시하고 관리할 수 있습니다.
  • 버그 수정

    • 카테고리 버튼 클릭 시 검색 상태가 정상적으로 초기화되어, 검색과 카테고리 선택 간의 동작이 더 일관성 있게 개선되었습니다.
  • 스타일

    • 일부 JSX 속성의 포맷이 일관성 있게 조정되었습니다.

- 검색 시 카테고리 필터 무시하고 전체 동아리에서 검색
- SearchContext에 isSearching 상태 추가
- 검색과 카테고리 필터링 로직 분리
@vercel
Copy link

vercel bot commented Aug 2, 2025

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

Name Status Preview Comments Updated (UTC)
moadong ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 2, 2025 4:51pm

@coderabbitai
Copy link
Contributor

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

검색 시 선택된 카테고리와 관계없이 전체 동아리를 기준으로 검색이 이루어지도록 상태 관리와 제어 흐름이 변경되었습니다. 검색 상태(isSearching) 및 관련 setter가 전역 컨텍스트에 추가되었으며, 검색 및 카테고리 선택 시 해당 상태가 적절히 갱신되도록 각 컴포넌트가 수정되었습니다.

Changes

Cohort / File(s) Change Summary
검색 상태 및 컨텍스트 확장
frontend/src/context/SearchContext.tsx
isSearchingsetIsSearching 상태를 컨텍스트에 추가하여 전역적으로 검색 여부를 관리하도록 수정
검색 박스 동작 개선
frontend/src/components/common/SearchBox/SearchBox.tsx
검색 시 카테고리를 'all'로 리셋하고, isSearching을 true로 설정하도록 로직 수정 및 관련 훅 사용
카테고리 버튼 동작 개선
frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx
카테고리 클릭 시 검색어와 입력값 초기화 후 isSearching을 false로 설정하는 로직 추가
메인 페이지 검색 제어 흐름 변경
frontend/src/pages/MainPage/MainPage.tsx
검색 중일 때 카테고리를 'all'로 강제 지정하여 카드 리스트를 전체 동아리 기준으로 불러오도록 로직 수정

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SearchBox
    participant SearchContext
    participant MainPage
    participant CardList

    User->>SearchBox: 검색어 입력 후 검색 실행
    SearchBox->>SearchContext: setKeyword(검색어), setIsSearching(true), setSelectedCategory('all')
    MainPage->>SearchContext: isSearching, keyword, selectedCategory 조회
    MainPage->>CardList: useGetCardList('all', keyword) 호출 (isSearching=true)
    CardList-->>MainPage: 전체 동아리 기준 검색 결과 반환
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Assessment against linked issues

Objective Addressed Explanation
검색 시 전체 동아리 기준으로 검색된다 (MOA-130)

Assessment against linked issues: Out-of-scope changes

(해당 사항 없음)

Possibly related PRs

Suggested labels

✨ Feature, 💻 FE

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#615-search-all-clubs-MOA-130

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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

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

@seongwon030 seongwon030 added ✨ Feature 기능 개발 💻 FE Frontend labels Aug 2, 2025
@seongwon030 seongwon030 linked an issue Aug 2, 2025 that may be closed by this pull request
2 tasks
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 (2)
frontend/src/pages/MainPage/MainPage.tsx (1)

27-27: 매직 문자열을 명명된 상수로 대체하는 것을 고려해보세요.

검색 로직은 올바르게 구현되었지만, 'all' 매직 문자열을 명명된 상수로 대체하면 가독성과 유지보수성이 향상됩니다.

+const ALL_CATEGORIES = 'all';
+
 const MainPage = () => {
   // ... other code
-  const searchCategory = isSearching ? 'all' : selectedCategory;
+  const searchCategory = isSearching ? ALL_CATEGORIES : selectedCategory;
frontend/src/components/common/SearchBox/SearchBox.tsx (1)

28-29: 검색 실행 시 상태 설정이 적절히 구현되었습니다.

검색 실행 시 카테고리를 'all'로 설정하고 검색 상태를 활성화하는 로직이 올바르게 구현되어 다른 컴포넌트들과 잘 협조합니다.

전체 애플리케이션에서 일관성을 위해 'all' 매직 문자열을 공통 상수로 추출하는 것을 고려해보세요:

// constants/categories.ts
export const ALL_CATEGORIES = 'all';
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5494b01 and 95a6005.

📒 Files selected for processing (4)
  • frontend/src/components/common/SearchBox/SearchBox.tsx (4 hunks)
  • frontend/src/context/SearchContext.tsx (3 hunks)
  • frontend/src/pages/MainPage/MainPage.tsx (1 hunks)
  • frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.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/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx
  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
  • frontend/src/context/SearchContext.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/CategoryButtonList/CategoryButtonList.tsx
  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
  • frontend/src/context/SearchContext.tsx
🧠 Learnings (7)
📓 Common learnings
Learnt from: Due-IT
PR: Moadong/moadong#329
File: backend/src/main/java/moadong/club/controller/ClubSearchController.java:0-0
Timestamp: 2025-05-01T08:32:09.398Z
Learning: ClubSearchController의 searchClubsByKeyword 메서드와 ClubSearchService의 searchClubsByKeyword 메서드 사이에 파라미터 순서 일치가 중요하다. 현재 컨트롤러의 매개변수 순서는 'keyword, recruitmentStatus, category, division'인 반면, 서비스 메서드의 순서는 'keyword, recruitmentStatus, division, category'이다. 컨트롤러에서 서비스 호출 시 'keyword, recruitmentStatus, division, category' 순서로 전달하면 category와 division 값이 바뀌어 검색 결과가 잘못될 수 있다.
📚 Learning: applies to frontend/**/*.{ts,tsx} : use consistent return types for similar functions and hooks....
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} : Use consistent return types for similar functions and hooks.

Applied to files:

  • frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx
  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
  • frontend/src/context/SearchContext.tsx
📚 Learning: applies to frontend/**/*.tsx : break down broad state management into smaller, focused hooks or cont...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Break down broad state management into smaller, focused hooks or contexts.

Applied to files:

  • frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx
  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
  • frontend/src/context/SearchContext.tsx
📚 Learning: applies to frontend/**/*.tsx : separate significantly different conditional ui/logic into distinct c...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Separate significantly different conditional UI/logic into distinct components.

Applied to files:

  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
📚 Learning: applies to frontend/**/*.tsx : colocate simple, localized logic or use inline definitions to reduce ...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Colocate simple, localized logic or use inline definitions to reduce context switching.

Applied to files:

  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
  • frontend/src/context/SearchContext.tsx
📚 Learning: applies to frontend/**/*.tsx : abstract complex logic/interactions into dedicated components or high...
Learnt from: CR
PR: Moadong/moadong#0
File: frontend/.cursorrules:0-0
Timestamp: 2025-07-19T05:09:10.702Z
Learning: Applies to frontend/**/*.tsx : Abstract complex logic/interactions into dedicated components or higher-order components (HOCs).

Applied to files:

  • frontend/src/pages/MainPage/MainPage.tsx
  • frontend/src/components/common/SearchBox/SearchBox.tsx
📚 Learning: clubsearchcontroller의 searchclubsbykeyword 메서드와 clubsearchservice의 searchclubsbykeyword 메서드 사이에 파라미터...
Learnt from: Due-IT
PR: Moadong/moadong#329
File: backend/src/main/java/moadong/club/controller/ClubSearchController.java:0-0
Timestamp: 2025-05-01T08:32:09.398Z
Learning: ClubSearchController의 searchClubsByKeyword 메서드와 ClubSearchService의 searchClubsByKeyword 메서드 사이에 파라미터 순서 일치가 중요하다. 현재 컨트롤러의 매개변수 순서는 'keyword, recruitmentStatus, category, division'인 반면, 서비스 메서드의 순서는 'keyword, recruitmentStatus, division, category'이다. 컨트롤러에서 서비스 호출 시 'keyword, recruitmentStatus, division, category' 순서로 전달하면 category와 division 값이 바뀌어 검색 결과가 잘못될 수 있다.

Applied to files:

  • frontend/src/pages/MainPage/MainPage.tsx
🔇 Additional comments (4)
frontend/src/context/SearchContext.tsx (1)

8-9: 검색 상태 관리가 적절히 구현되었습니다.

isSearching 상태와 setter가 일관된 타입과 네이밍 컨벤션으로 추가되었으며, 기존 컨텍스트 패턴을 잘 따르고 있습니다.

Also applies to: 21-21, 30-31

frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.tsx (1)

61-61: 카테고리 클릭 시 검색 상태 초기화가 올바르게 구현되었습니다.

카테고리 버튼 클릭 시 검색 키워드와 입력값을 지운 후 검색 상태를 false로 설정하는 순서가 적절하며, 검색 모드에서 카테고리 브라우징 모드로의 전환이 명확합니다.

Also applies to: 74-74

frontend/src/pages/MainPage/MainPage.tsx (1)

24-24: 검색 시 전체 동아리 기준 로직이 올바르게 구현되었습니다.

isSearching 상태에 따라 검색 카테고리를 동적으로 결정하는 로직이 PR 목표를 정확히 달성하고 있습니다. 검색 시에는 선택된 카테고리와 무관하게 전체 동아리를 대상으로 검색됩니다.

Also applies to: 33-33

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

3-3: 카테고리 컨텍스트 의존성이 적절히 추가되었습니다.

검색 실행 시 카테고리 상태를 조작하기 위해 useCategory 훅이 올바르게 추가되었으며, 검색과 카테고리 상태 간의 조율이 잘 구현되었습니다.

Also applies to: 12-12

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.

좋습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💻 FE Frontend ✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature] MOA-130 검색 시 전체 동아리 기준으로 검색된다

2 participants