Skip to content

Comments

[feature] 검색 결과 개수를 표시한다#789

Merged
suhyun113 merged 7 commits intodevelop-fefrom
feature/#786-show-search-result-count-MOA-290
Nov 3, 2025
Merged

[feature] 검색 결과 개수를 표시한다#789
suhyun113 merged 7 commits intodevelop-fefrom
feature/#786-show-search-result-count-MOA-290

Conversation

@suhyun113
Copy link
Collaborator

@suhyun113 suhyun113 commented Oct 12, 2025

#️⃣연관된 이슈

ex) #786

📝작업 내용

검색 결과에 따라 동아리 개수를 반환합니다.
-> SectionBar 구조 변경 및 검색 결과 개수 추가

image image

모바일 화면

image

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

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

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

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

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

🫡 참고사항

Summary by CodeRabbit

릴리스 노트

  • 새 기능

    • 클럽 목록 응답이 총 개수를 포함하도록 변경(클럽 목록 + totalCount)
    • 메인 페이지에 총 개수 표시 추가
  • 스타일

    • 클럽 목록 섹션 레이아웃 개선(탭과 총개수 정렬)
    • 카테고리 버튼 패딩 및 텍스트 간격 조정
  • 타입/데이터

    • 클럽 목록 응답 타입 추가 및 사용 반영

@vercel
Copy link

vercel bot commented Oct 12, 2025

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

Project Deployment Preview Comments Updated (UTC)
moadong Ready Ready Preview Comment Nov 2, 2025 5:33am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 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

Walkthrough

getClubList의 반환 형태를 배열에서 { clubs, totalCount } 객체로 변경하고, 관련 타입·훅·페이지·스타일을 업데이트하여 총 검색 결과 수를 UI에 표시하도록 수정했습니다.

Changes

Cohort / File(s) 변경 내용
API & 타입
frontend/src/apis/getClubList.ts, frontend/src/types/club.responses.ts
API 응답 형태를 Club[]에서 ClubSearchResponse (clubs: Club[], totalCount: number)로 변경하고 타입 파일 추가.
쿼리 훅
frontend/src/hooks/queries/club/useGetCardList.ts
useQuery 제네릭을 ClubSearchResponse로 변경. select에서 로고 변환 후 { totalCount, clubs } 형태로 반환하도록 수정.
메인 페이지 로직
frontend/src/pages/MainPage/MainPage.tsx
data.clubsclubs, data.totalCounttotalCount로 사용; isEmpty/hasData 판정 로직을 totalCount 기반으로 변경하고 TotalCountResult 컴포넌트로 총 개수 표시 추가.
메인 페이지 스타일
frontend/src/pages/MainPage/MainPage.styles.ts
SectionBarTotalCountResult 스타일 컴포넌트 추가. SectionTabs 마진 조정 및 반응형 스타일 업데이트.
카테고리 버튼 스타일
frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.styles.ts
CategoryButton 패딩 8px→10px, span line-height 30px→17px 변경(레이아웃/간격 조정).

Sequence Diagram(s)

sequenceDiagram
  participant Page as MainPage
  participant Hook as useGetCardList
  participant API as getClubList API

  Page->>Hook: useQuery 요청 (검색 파라미터)
  Hook->>API: getClubList 호출
  API-->>Hook: { clubs: Club[], totalCount: number }
  Hook-->>Page: select 변환 → { totalCount, clubs: Club[] (logo 변환) }
  Page->>Page: totalCount로 isEmpty/hasData 판정 및 UI 렌더링 (TotalCountResult 포함)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • 주의할 파일/영역:
    • useGetCardList.ts의 select 변환에서 로고 변환과 totalCount 보존이 정확한지 검증
    • MainPage.tsx의 isEmpty/hasData 재정의가 모든 경계 조건(로딩, 에러, 빈 결과)에 대해 올바른지 확인
    • 스타일 변경(SectionBar/TotalCountResult)에서 모바일/데스크톱 반응형 동작 검증

Possibly related issues

  • [feature] MOA-290 검색 결과 개수를 표시한다 #786: 프론트에서 검색 결과 총개수 노출 관련 변경과 직접 연관됨 — 동일 목적(총 개수 표시).
  • MOA-290: 검색 결과 개수 표시 기능 요구사항과 일치 — 이 PR이 해당 이슈의 구현 목표를 포함함.

Possibly related PRs

Suggested reviewers

  • seongje973
  • oesnuj
  • seongwon030

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed PR 제목 "[feature] 검색 결과 개수를 표시한다"는 변경 사항의 핵심 목표를 명확하고 정확하게 설명합니다. 모든 코드 변경사항이 검색 결과 개수를 API에서 반환하고 화면에 표시하는 기능을 구현하기 위한 것으로, 제목은 간결하고 의미 있는 정보를 전달합니다. 스캔 중인 팀원이 이 PR의 주요 변경사항을 쉽게 파악할 수 있습니다.
Linked Issues Check ✅ Passed 연결된 이슈 MOA-290의 모든 요구사항이 구현되었습니다. 검색 결과 개수 연동 측면에서는 getClubList에서 totalCount를 포함하는 응답 구조로 변경하고, useGetCardList에서 ClubSearchResponse 타입을 도입하여 데이터 흐름을 구성했습니다. 검색 결과 개수 표시 측면에서는 MainPage에서 TotalCountResult 컴포넌트를 통해 totalCount를 화면에 표시하고 있습니다. 결과 디자인 적용 측면에서는 SectionBar 컨테이너, TotalCountResult 스타일, 그리고 CategoryButton의 패딩/라인 높이 조정으로 디자인을 구현했습니다.
Out of Scope Changes Check ✅ Passed 모든 코드 변경사항이 "검색 결과 개수를 표시한다"는 PR의 주요 목표와 MOA-290 이슈의 요구사항 범위 내에 있습니다. getClubList의 반환 타입 변경, ClubSearchResponse 타입 도입, MainPage의 totalCount 표시, SectionBar와 TotalCountResult 스타일 추가, 그리고 CategoryButton의 스타일 조정은 모두 검색 결과 개수 연동 및 디자인 적용이라는 명확한 목표 달성을 위한 변경사항입니다. 범위를 벗어난 무관한 수정사항이 없습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#786-show-search-result-count-MOA-290

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.

@suhyun113 suhyun113 added ✨ Feature 기능 개발 🎨 Design 마크업 & 스타일링 💻 FE Frontend labels Oct 12, 2025
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/apis/getClubList.ts (1)

3-8: getClubList 파라미터 전달 순서 수정

getClubList 정의 순서 (keyword, recruitmentStatus, category, division)와 호출부(useGetCardList.ts:19) (keyword, recruitmentStatus, division, category)가 뒤바뀌어 잘못된 검색 결과를 초래합니다. 호출부 인자를 정의 순서에 맞게 교정하세요.

♻️ Duplicate comments (1)
frontend/src/hooks/queries/club/useGetCardList.ts (1)

6-9: 중복된 타입 정의를 제거하세요.

이 인터페이스는 frontend/src/types/club.ts에서 이미 정의되어 있습니다. 자세한 내용은 club.ts 파일의 리뷰 코멘트를 참조하세요.

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

68-70: 로딩 중 총 개수 표시 개선을 고려하세요.

로딩 중일 때 "총 0개"를 표시하는 것은 사용자에게 혼란을 줄 수 있습니다. 로딩 중임을 나타내는 별도의 텍스트나 표시를 고려해보세요.

다음과 같이 수정할 수 있습니다:

 <Styled.TotalCountResult role="status">
-  {`총 ${isLoading ? 0 : totalCount}개의 동아리가 검색되었습니다`}
+  {isLoading ? '검색 중...' : `총 ${totalCount}개의 동아리가 검색되었습니다`}
 </Styled.TotalCountResult>
frontend/src/pages/MainPage/MainPage.styles.ts (1)

71-80: 총 개수 표시 스타일이 적절합니다.

TotalCountResult 컴포넌트의 스타일링과 반응형 처리가 잘 되어 있습니다. 다만 75번 라인의 padding-top: 13px는 매직 넘버입니다. 코드 가독성을 위해 이 값의 의도를 주석으로 설명하거나 의미 있는 이름의 상수로 추출하는 것을 고려해보세요.

As per coding guidelines

frontend/src/hooks/queries/club/useGetCardList.ts (1)

17-27: 데이터 변환 로직이 올바릅니다.

useQuery의 제네릭 타입이 새로운 ClubSearchResponse에 맞게 업데이트되었고, select 함수에서 로고 URL을 적절히 변환하면서 totalCount를 유지하고 있습니다.

23번 라인의 clubs 배열을 감싸는 불필요한 괄호를 제거하여 코드를 간결하게 만들 수 있습니다:

     select: (data) => ({
       totalCount: data.totalCount,
-      clubs: (data.clubs.map((club) => ({
+      clubs: data.clubs.map((club) => ({
         ...club,
         logo: convertToDriveUrl(club.logo),
-      }))),
+      })),
     }),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 393ab43 and cb6cbee.

📒 Files selected for processing (6)
  • frontend/src/apis/getClubList.ts (1 hunks)
  • frontend/src/hooks/queries/club/useGetCardList.ts (1 hunks)
  • frontend/src/pages/MainPage/MainPage.styles.ts (2 hunks)
  • frontend/src/pages/MainPage/MainPage.tsx (2 hunks)
  • frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.styles.ts (2 hunks)
  • frontend/src/types/club.ts (1 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/types/club.ts
  • frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.styles.ts
  • frontend/src/apis/getClubList.ts
  • frontend/src/hooks/queries/club/useGetCardList.ts
  • frontend/src/pages/MainPage/MainPage.styles.ts
  • frontend/src/pages/MainPage/MainPage.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/MainPage.tsx
🧬 Code graph analysis (3)
frontend/src/hooks/queries/club/useGetCardList.ts (2)
frontend/src/types/club.ts (1)
  • Club (3-12)
frontend/src/apis/getClubList.ts (1)
  • getClubList (3-30)
frontend/src/pages/MainPage/MainPage.styles.ts (1)
frontend/src/styles/mediaQuery.ts (1)
  • media (8-14)
frontend/src/pages/MainPage/MainPage.tsx (1)
frontend/src/hooks/queries/club/useGetCardList.ts (1)
  • useGetCardList (11-29)
🔇 Additional comments (4)
frontend/src/pages/MainPage/components/CategoryButtonList/CategoryButtonList.styles.ts (1)

25-25: 스타일 조정이 적절합니다.

버튼 패딩과 라인 높이 조정으로 시각적 정렬이 개선되었습니다.

Also applies to: 52-52

frontend/src/apis/getClubList.ts (1)

26-29: API 응답 구조 변경이 올바릅니다.

클럽 목록과 함께 총 개수를 반환하도록 구조를 변경한 것은 PR 목표에 부합합니다.

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

31-38: 데이터 처리 로직이 올바릅니다.

새로운 API 응답 구조에 맞춰 clubstotalCount를 적절히 추출하고 있으며, isEmptyhasData 조건도 totalCount를 기반으로 정확하게 업데이트되었습니다.

frontend/src/pages/MainPage/MainPage.styles.ts (1)

22-31: 새로운 레이아웃 컴포넌트가 적절합니다.

SectionBar 컴포넌트로 섹션 탭과 총 개수 표시를 감싸는 구조가 깔끔하며, 반응형 마진 조정도 적절합니다.

Comment on lines 35 to 38
export interface ClubSearchResponse {
clubs: Club[];
totalCount: number;
}
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 12, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

타입이 중복 정의되어 있습니다.

ClubSearchResponse 인터페이스가 이 파일과 frontend/src/hooks/queries/club/useGetCardList.ts (6-9번 라인)에 중복 정의되어 있습니다. 타입은 한 곳에서만 정의하고 필요한 곳에서 임포트해야 합니다.

useGetCardList.ts에서 중복 정의를 제거하고 이 파일에서 임포트하도록 수정하세요:

frontend/src/hooks/queries/club/useGetCardList.ts에 다음 diff를 적용하세요:

 import { useQuery, keepPreviousData } from '@tanstack/react-query';
 import { getClubList } from '@/apis/getClubList';
-import { Club } from '@/types/club';
+import { Club, ClubSearchResponse } from '@/types/club';
 import convertToDriveUrl from '@/utils/convertGoogleDriveUrl';

-export interface ClubSearchResponse {
-  clubs: Club[];
-  totalCount: number;
-}
-
 export const useGetCardList = (
📝 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
export interface ClubSearchResponse {
clubs: Club[];
totalCount: number;
}
// frontend/src/hooks/queries/club/useGetCardList.ts
import { useQuery, keepPreviousData } from '@tanstack/react-query';
import { getClubList } from '@/apis/getClubList';
import { Club, ClubSearchResponse } from '@/types/club';
import convertToDriveUrl from '@/utils/convertGoogleDriveUrl';
export const useGetCardList = (
/* your parameters here */
) => {
return useQuery<ClubSearchResponse>(
['clubList' /*, params */],
() => getClubList(/* params */),
{
keepPreviousData,
}
);
};
🤖 Prompt for AI Agents
In frontend/src/types/club.ts around lines 35 to 38, the ClubSearchResponse
interface is the canonical definition; remove the duplicate definition from
frontend/src/hooks/queries/club/useGetCardList.ts (lines 6-9) and replace it
with an import of ClubSearchResponse from frontend/src/types/club.ts. Update
useGetCardList.ts to remove the local interface, add an import statement for
ClubSearchResponse (and any dependent types like Club if needed) from
frontend/src/types/club.ts, and ensure all usages in the file reference the
imported type.

Copy link
Contributor

Choose a reason for hiding this comment

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

타입을 분리해도좋을꺼같습니다!

Copy link
Contributor

Choose a reason for hiding this comment

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

@lepitaaar 네, 맞습니다! 타입 정의를 frontend/src/types/club.ts에 통합하고, useGetCardList.ts에서는 임포트해서 사용하는 것이 좋습니다.

위에서 제안한 대로 useGetCardList.ts의 중복된 인터페이스 정의를 제거하고, 대신 ClubSearchResponse@/types/club에서 임포트하면 코드 중복을 제거하고 타입 일관성을 유지할 수 있습니다. 👍

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.

수고하셨습니다! 결과표시되니 보기좋네요

Comment on lines 35 to 38
export interface ClubSearchResponse {
clubs: Club[];
totalCount: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

타입을 분리해도좋을꺼같습니다!

Copy link
Member

@seongwon030 seongwon030 left a comment

Choose a reason for hiding this comment

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

타입 분리하면 좋을 것 같네요 고생하셨습니다 !

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/hooks/queries/club/useGetCardList.ts (1)

16-22: 선택적 리팩토링: 불필요한 괄호 제거

select 함수의 로직은 올바르게 구현되었습니다. 다만 18-21번 줄의 data.clubs.map 주위의 괄호는 불필요하므로 가독성을 위해 제거할 수 있습니다.

다음과 같이 괄호를 제거할 수 있습니다:

     select: (data) => ({
       totalCount: data.totalCount,
-      clubs: (data.clubs.map((club) => ({
+      clubs: data.clubs.map((club) => ({
         ...club,
         logo: convertToDriveUrl(club.logo),
-      }))),
+      })),
     }),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 cb6cbee and af66dc3.

📒 Files selected for processing (2)
  • frontend/src/hooks/queries/club/useGetCardList.ts (2 hunks)
  • frontend/src/types/club.responses.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
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/types/club.responses.ts
  • frontend/src/hooks/queries/club/useGetCardList.ts
🧠 Learnings (1)
📚 Learning: 2025-05-01T08:32:09.398Z
Learnt from: Due-IT
Repo: Moadong/moadong PR: 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/hooks/queries/club/useGetCardList.ts
🧬 Code graph analysis (2)
frontend/src/types/club.responses.ts (1)
frontend/src/types/club.ts (1)
  • Club (3-12)
frontend/src/hooks/queries/club/useGetCardList.ts (2)
frontend/src/types/club.responses.ts (1)
  • ClubSearchResponse (3-6)
frontend/src/apis/getClubList.ts (1)
  • getClubList (3-30)
🔇 Additional comments (2)
frontend/src/types/club.responses.ts (1)

1-6: 잘 구현되었습니다!

타입 정의가 명확하고 구조가 깔끔합니다. ClubSearchResponse 인터페이스가 검색 결과와 총 개수를 적절히 표현하고 있습니다.

frontend/src/hooks/queries/club/useGetCardList.ts (1)

3-3: 적절한 타입 임포트입니다.

새로운 ClubSearchResponse 타입을 올바르게 임포트했습니다.

Comment on lines +12 to 14
return useQuery<ClubSearchResponse, unknown, ClubSearchResponse>({
queryKey: ['clubs', keyword, recruitmentStatus, division, category],
queryFn: () => getClubList(keyword, recruitmentStatus, division, category),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

파라미터 순서 오류로 인한 검색 결과 오류가 발생합니다.

getClubList 함수 호출 시 divisioncategory 파라미터의 순서가 바뀌어 있습니다. API 함수의 시그니처는 getClubList(keyword, recruitmentStatus, category, division) 순서를 기대하지만, 현재 코드는 divisioncategory를 반대로 전달하고 있습니다. 이로 인해 검색 필터가 올바르게 작동하지 않습니다.

다음 diff를 적용하여 파라미터 순서를 수정하세요:

   return useQuery<ClubSearchResponse, unknown, ClubSearchResponse>({
-    queryKey: ['clubs', keyword, recruitmentStatus, division, category],
-    queryFn: () => getClubList(keyword, recruitmentStatus, division, category),
+    queryKey: ['clubs', keyword, recruitmentStatus, category, division],
+    queryFn: () => getClubList(keyword, recruitmentStatus, category, division),
     placeholderData: keepPreviousData,
📝 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
return useQuery<ClubSearchResponse, unknown, ClubSearchResponse>({
queryKey: ['clubs', keyword, recruitmentStatus, division, category],
queryFn: () => getClubList(keyword, recruitmentStatus, division, category),
return useQuery<ClubSearchResponse, unknown, ClubSearchResponse>({
queryKey: ['clubs', keyword, recruitmentStatus, category, division],
queryFn: () => getClubList(keyword, recruitmentStatus, category, division),
🤖 Prompt for AI Agents
In frontend/src/hooks/queries/club/useGetCardList.ts around lines 12 to 14, the
call to getClubList passes division and category in the wrong order causing
incorrect search filters; change the argument order so it matches the API
signature getClubList(keyword, recruitmentStatus, category, division) by
swapping the division and category arguments in the function call.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 af66dc3 and 0f1b738.

📒 Files selected for processing (1)
  • frontend/src/pages/MainPage/MainPage.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/MainPage.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/MainPage.tsx
🧠 Learnings (5)
📓 Common learnings
Learnt from: seongwon030
Repo: Moadong/moadong PR: 195
File: frontend/src/pages/AdminPage/AdminPage.tsx:7-7
Timestamp: 2025-03-19T05:18:07.818Z
Learning: AdminPage.tsx에서 현재 하드코딩된 클럽 ID('67d2e3b9b15c136c6acbf20b')는 로그인 기능 구현 후 동적으로 가져오는 방식으로 수정될 예정입니다.
Learnt from: seongwon030
Repo: Moadong/moadong PR: 548
File: frontend/src/pages/ClubDetailPage/ClubDetailPage.tsx:17-57
Timestamp: 2025-07-19T05:05:10.196Z
Learning: ClubDetailPage.tsx에서 notJoinedClubNames 배열의 하드코딩은 의도적인 설계 결정입니다. 개발자가 명시적으로 하드코딩을 선택했으므로 이에 대한 리팩토링 제안을 하지 않아야 합니다.
Learnt from: Due-IT
Repo: Moadong/moadong PR: 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: 2025-03-19T05:18:07.818Z
Learnt from: seongwon030
Repo: Moadong/moadong PR: 195
File: frontend/src/pages/AdminPage/AdminPage.tsx:7-7
Timestamp: 2025-03-19T05:18:07.818Z
Learning: AdminPage.tsx에서 현재 하드코딩된 클럽 ID('67d2e3b9b15c136c6acbf20b')는 로그인 기능 구현 후 동적으로 가져오는 방식으로 수정될 예정입니다.

Applied to files:

  • frontend/src/pages/MainPage/MainPage.tsx
📚 Learning: 2025-07-19T05:05:10.196Z
Learnt from: seongwon030
Repo: Moadong/moadong PR: 548
File: frontend/src/pages/ClubDetailPage/ClubDetailPage.tsx:17-57
Timestamp: 2025-07-19T05:05:10.196Z
Learning: ClubDetailPage.tsx에서 notJoinedClubNames 배열의 하드코딩은 의도적인 설계 결정입니다. 개발자가 명시적으로 하드코딩을 선택했으므로 이에 대한 리팩토링 제안을 하지 않아야 합니다.

Applied to files:

  • frontend/src/pages/MainPage/MainPage.tsx
📚 Learning: 2025-07-19T05:09:10.702Z
Learnt from: CR
Repo: Moadong/moadong PR: 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/pages/MainPage/MainPage.tsx
📚 Learning: 2025-05-01T08:32:09.398Z
Learnt from: Due-IT
Repo: Moadong/moadong PR: 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
🧬 Code graph analysis (1)
frontend/src/pages/MainPage/MainPage.tsx (1)
frontend/src/hooks/queries/club/useGetCardList.ts (1)
  • useGetCardList (6-24)
🔇 Additional comments (1)
frontend/src/pages/MainPage/MainPage.tsx (1)

34-38: LGTM!

데이터 구조 변경에 따른 기본값 설정과 상태 플래그 로직이 올바르게 구현되었습니다.

Comment on lines +31 to +32
const { data, error, isLoading } =
useGetCardList(keyword, recruitmentStatus, division, searchCategory);
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

파라미터 순서 오류로 인해 검색 결과가 잘못될 수 있습니다.

useGetCardList 훅의 시그니처는 (keyword, recruitmentStatus, category, division) 순서이지만, 호출 시 (keyword, recruitmentStatus, division, searchCategory) 순서로 전달하고 있습니다. 이로 인해 divisioncategory 값이 서로 바뀌어 검색 결과가 의도와 다르게 나올 수 있습니다.

다음과 같이 파라미터 순서를 수정하세요:

  const { data, error, isLoading } = 
-   useGetCardList(keyword, recruitmentStatus, division, searchCategory);
+   useGetCardList(keyword, recruitmentStatus, searchCategory, division);
🤖 Prompt for AI Agents
In frontend/src/pages/MainPage/MainPage.tsx around lines 31 to 32, the call to
useGetCardList passes parameters in the wrong order (keyword, recruitmentStatus,
division, searchCategory) while the hook expects (keyword, recruitmentStatus,
category, division); swap the third and fourth arguments so the category
(searchCategory) is passed as the third parameter and division as the fourth to
restore correct search behavior.

Comment on lines +68 to +70
<Styled.TotalCountResult role="status">
{`전체 ${isLoading ? 0 : totalCount}개의 동아리`}
</Styled.TotalCountResult>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

로딩 중 "0개"를 표시하면 사용자에게 혼란을 줄 수 있습니다.

로딩 중일 때 "전체 0개의 동아리"를 표시하는 것은 실제로 결과가 없는 것처럼 보일 수 있습니다. 로딩 중에는 개수를 표시하지 않거나 로딩 인디케이터를 표시하는 것이 더 나은 UX를 제공할 수 있습니다.

다음과 같이 수정하는 것을 고려해보세요:

  <Styled.TotalCountResult role="status">
-   {`전체 ${isLoading ? 0 : totalCount}개의 동아리`}
+   {isLoading ? '검색 중...' : `전체 ${totalCount}개의 동아리`}
  </Styled.TotalCountResult>
📝 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
<Styled.TotalCountResult role="status">
{`전체 ${isLoading ? 0 : totalCount}개의 동아리`}
</Styled.TotalCountResult>
<Styled.TotalCountResult role="status">
{isLoading ? '검색 중...' : `전체 ${totalCount}개의 동아리`}
</Styled.TotalCountResult>
🤖 Prompt for AI Agents
In frontend/src/pages/MainPage/MainPage.tsx around lines 68 to 70, the component
currently renders "전체 0개의 동아리" while isLoading is true which can mislead users;
change the rendering so that when isLoading is true you either render a loading
indicator/placeholder (e.g., "로딩 중..." or a spinner) or render nothing for the
count, and only show the totalCount once loading completes (isLoading ===
false). Ensure the accessible status element still exists (role="status") and
updates appropriately when the final count is available.

@suhyun113 suhyun113 merged commit 6771d67 into develop-fe Nov 3, 2025
5 checks passed
@lepitaaar lepitaaar deleted the feature/#786-show-search-result-count-MOA-290 branch November 11, 2025 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎨 Design 마크업 & 스타일링 💻 FE Frontend ✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants