Skip to content

feat: 사용자 검색 화면 구현#53

Merged
heeeeyong merged 7 commits intodevelopfrom
feature/feed
Jul 23, 2025
Merged

feat: 사용자 검색 화면 구현#53
heeeeyong merged 7 commits intodevelopfrom
feature/feed

Conversation

@heeeeyong
Copy link
Collaborator

@heeeeyong heeeeyong commented Jul 21, 2025

#️⃣연관된 이슈

#23 [UI] 피드페이지 - 사용자 검색

📝작업 내용

  • 사용자 찾기 구현
image image image

💬리뷰 요구사항

해당 화면은 호준님이 이전에 구현하신 BookSearch 페이지를 공통컴포넌트화 하는건 무리라고 판단해서 필요한 컴포넌트와 로직만 가져와 작성해서 큰 어려움은 없었습니다. 이전에 조건부 처리를 잘 해놓으셔서 크게 문제사항 없이 구현했습니다.

추가로, 기존에 제가 구현한 UserProfileItem.tsx 의 경우에 pathname을 가져와 컴포넌트의 형태를 다르게 구현했었는데 props로 type을 넘겨서 컴포넌트를 원하는 형태로 재사용하게끔 수정했습니다. 필요할 경우 참고하시면 되겠습니다~

  • type = "followlist"
    image
  • type = "followerlist"
image

Summary by CodeRabbit

  • 신규 기능

    • 사용자 검색 페이지 및 검색 결과 리스트 컴포넌트가 추가되었습니다.
    • 최근 검색어 관리 및 검색 결과 표시 기능이 도입되었습니다.
    • 사용자 프로필 데이터의 모의(mock) 리스트가 제공됩니다.
  • 버그 수정

    • 팔로우/팔로워 리스트 및 프로필 관련 경로가 일부 변경되어 올바른 페이지로 이동됩니다.
  • UI/스타일

    • 검색바 내부 패딩이 줄어들고, 입력 커서 색상이 네온 그린으로 변경되었습니다.
    • 사용자 프로필 아이템의 렌더링 방식이 개선되었습니다.
  • 기타

    • 사용자 타입 및 프로필 속성에 대한 타입 정의가 추가되었습니다.

@vercel
Copy link

vercel bot commented Jul 21, 2025

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

Name Status Preview Comments Updated (UTC)
thip ❌ Failed (Inspect) Jul 23, 2025 2:16am

@coderabbitai
Copy link

coderabbitai bot commented Jul 21, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

이번 변경에서는 사용자 검색 기능이 새롭게 도입되고, 사용자 프로필 관련 타입과 목업 데이터가 분리 관리됩니다. 여러 컴포넌트에서 라우팅 경로가 일관되게 수정되었으며, 검색 바와 사용자 프로필 아이템의 UI 및 제어 흐름이 개선되었습니다. 또한, 검색 결과 및 최근 검색어 관리 기능이 추가되었습니다.

Changes

파일/경로 요약 변경 요약
src/components/feed/FollowList.tsx, src/components/feed/MyFollower.tsx "더보기" 클릭 시 이동하는 라우트 경로를 /feed/*에서 /follow/*로 수정
src/components/feed/UserProfileItem.tsx useLocation 제거, type prop 도입, 프로필 클릭 시 라우트 변경, follow 버튼 렌더링 방식 변경
src/components/search/SearchBar.tsx 내부 패딩 축소, 커서 색상 네온그린으로 변경
src/data/userData.ts mockUserList 목업 데이터 배열 신규 추가
src/pages/feed/Feed.tsx MainHeader에 검색 버튼 클릭 핸들러 추가, 클릭 시 /feed/search로 이동
src/pages/feed/FollowerListPage.tsx 목업 데이터 외부 모듈로 분리, type prop 명시적으로 전달
src/pages/feed/UserSearch.tsx 사용자 검색 UI 신규 컴포넌트 추가, 최근 검색어 및 검색 결과 관리
src/pages/feed/UserSearchResult.tsx 검색 결과 리스트 컴포넌트 신규 추가, 사용자 리스트 및 빈 상태 렌더링
src/pages/index.tsx 라우터에 feed/search 경로 및 UserSearch 컴포넌트 신규 등록
src/types/user.ts UserProfileTypeUserProfileItemProps 타입/인터페이스 신규 추가

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FeedPage
    participant MainHeader
    participant Router
    participant UserSearch

    User->>FeedPage: 페이지 접속
    FeedPage->>MainHeader: 렌더링
    User->>MainHeader: 검색 버튼 클릭
    MainHeader->>FeedPage: leftButtonClick 호출
    FeedPage->>Router: /feed/search로 이동
    Router->>UserSearch: UserSearch 컴포넌트 렌더링
    User->>UserSearch: 검색어 입력 및 검색
    UserSearch->>UserSearch: 최근 검색어 관리 및 결과 표시
Loading

Estimated code review effort

3 (30–60분)

Possibly related PRs

Suggested reviewers

  • ho0010

Poem

🐇
새로운 길을 찾아 hop, hop, hop!
검색창 속에서 토끼는 멈추지 않아요.
프로필도, 팔로우도, 라우트도 척척!
초록빛 커서처럼 반짝이는 코드의 숲.
오늘도 토끼는 즐겁게 코드를 뛰놀아요!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ab64e56 and 917e4af.

📒 Files selected for processing (4)
  • src/components/feed/FollowList.tsx (1 hunks)
  • src/components/feed/UserProfileItem.tsx (3 hunks)
  • src/pages/feed/Feed.tsx (2 hunks)
  • src/pages/index.tsx (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • 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

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.

Copy link

@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: 4

🧹 Nitpick comments (6)
src/pages/feed/FollowerListPage.tsx (1)

24-30: 타입 캐스팅 개선을 제안합니다.

type을 as UserProfileType로 캐스팅하고 있는데, 이미 useParams에서 타입이 지정되어 있으므로 더 안전한 방법을 고려해보세요.

다음과 같이 개선할 수 있습니다:

-            type={type as UserProfileType}
+            type={type!}

또는 타입 가드를 사용하여 더 안전하게 처리할 수 있습니다:

+  if (!type) return null; // 또는 적절한 에러 처리
   
   return (
     <Wrapper>
       {/* ... */}
       {mockUserList.map((user, index) => (
         <UserProfileItem
           key={index}
           {...user}
-          type={type as UserProfileType}
+          type={type}
           isLast={index === mockUserList.length - 1}
         />
       ))}
src/data/userData.ts (1)

3-38: mock 데이터 중앙화가 잘 구현되었습니다.

사용자 데이터를 중앙화하여 여러 컴포넌트에서 재사용할 수 있도록 한 것이 좋은 접근입니다. 데이터 구조도 일관성 있게 구성되어 있습니다.

다음과 같은 개선사항을 고려해보세요:

  1. 환경별 이미지 URL 관리: placeholder 이미지 URL을 상수로 분리
  2. 데이터 일관성: 모든 사용자에게 followerCount가 있는지 확인
+const PLACEHOLDER_IMAGE = 'https://placehold.co/36x36';
+
 export const mockUserList: UserProfileItemProps[] = [
   {
-    profileImgUrl: 'https://placehold.co/36x36',
+    profileImgUrl: PLACEHOLDER_IMAGE,
     userName: 'ThipOther',
     // ...
   },
   // ...
 ];
src/pages/feed/UserSearchResult.tsx (2)

20-20: 빈 JSX Fragment를 개선하세요.

빈 JSX Fragment <></>는 불필요합니다.

-        {type === 'searching' ? <></> : <ResultHeader>전체 {searchedUserList.length}</ResultHeader>}
+        {type === 'searched' && <ResultHeader>전체 {searchedUserList.length}</ResultHeader>}

23-23: 빈 컨테이너에 의미있는 내용을 추가하세요.

EmptyWrapper가 완전히 비어있습니다. 사용자에게 검색 결과가 없음을 알리는 메시지나 아이콘을 추가하는 것이 좋겠습니다.

-          <EmptyWrapper></EmptyWrapper>
+          <EmptyWrapper>
+            <EmptyMessage>검색 결과가 없습니다.</EmptyMessage>
+          </EmptyWrapper>
src/pages/feed/UserSearch.tsx (2)

19-25: 하드코딩된 초기 검색어를 개선하세요.

초기 최근 검색어가 하드코딩되어 있습니다. localStorage나 다른 영속 저장소를 사용하는 것을 고려해보세요.

-  const [recentSearches, setRecentSearches] = useState<string[]>([
-    '닉네임',
-    '작가',
-    '하위',
-    'Thip',
-    '책벌레',
-  ]);
+  const [recentSearches, setRecentSearches] = useState<string[]>(() => {
+    const saved = localStorage.getItem('recentSearches');
+    return saved ? JSON.parse(saved) : [];
+  });

37-40: 최근 검색어 관리 로직을 localStorage와 연동하세요.

최근 검색어를 업데이트할 때 localStorage에도 저장하면 사용자 경험이 개선됩니다.

     setRecentSearches(prev => {
       const filtered = prev.filter(t => t !== term);
-      return [term, ...filtered].slice(0, 5);
+      const newSearches = [term, ...filtered].slice(0, 5);
+      localStorage.setItem('recentSearches', JSON.stringify(newSearches));
+      return newSearches;
     });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7ec2d34 and ab64e56.

📒 Files selected for processing (11)
  • src/components/feed/FollowList.tsx (1 hunks)
  • src/components/feed/MyFollower.tsx (1 hunks)
  • src/components/feed/UserProfileItem.tsx (3 hunks)
  • src/components/search/SearchBar.tsx (2 hunks)
  • src/data/userData.ts (1 hunks)
  • src/pages/feed/Feed.tsx (2 hunks)
  • src/pages/feed/FollowerListPage.tsx (2 hunks)
  • src/pages/feed/UserSearch.tsx (1 hunks)
  • src/pages/feed/UserSearchResult.tsx (1 hunks)
  • src/pages/index.tsx (2 hunks)
  • src/types/user.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (5)
src/pages/feed/UserSearch.tsx (4)
src/components/common/Wrapper.tsx (1)
  • Wrapper (3-14)
src/pages/feed/UserSearchResult.tsx (1)
  • UserSearchResult (11-37)
src/data/userData.ts (1)
  • mockUserList (3-38)
src/styles/global/global.ts (1)
  • colors (4-53)
src/pages/feed/FollowerListPage.tsx (2)
src/types/user.ts (1)
  • UserProfileType (1-1)
src/data/userData.ts (1)
  • mockUserList (3-38)
src/data/userData.ts (1)
src/types/user.ts (1)
  • UserProfileItemProps (3-13)
src/pages/feed/UserSearchResult.tsx (2)
src/types/user.ts (1)
  • UserProfileItemProps (3-13)
src/styles/global/global.ts (2)
  • typography (56-76)
  • colors (4-53)
src/components/feed/UserProfileItem.tsx (1)
src/types/user.ts (1)
  • UserProfileItemProps (3-13)
🔇 Additional comments (21)
src/types/user.ts (2)

1-1: 타입 정의가 명확하고 적절합니다.

UserProfileType이 'followlist'와 'followerlist'로 구분된 것은 PR 목표에서 언급된 컴포넌트 재사용성 개선과 일치합니다.


3-13: 인터페이스 설계가 잘 구성되어 있습니다.

사용자 프로필 아이템에 필요한 속성들이 논리적으로 구성되어 있고, 선택적 필드들의 구분도 적절합니다. type 필드를 통해 조건부 렌더링을 제어할 수 있어 컴포넌트 재사용성이 향상됩니다.

src/components/feed/MyFollower.tsx (1)

73-73: 라우팅 경로 업데이트가 적절합니다.

'/follow/followerlist'로 변경된 경로는 다른 컴포넌트들과 일관된 라우팅 구조를 유지하며, PR 목표의 전체적인 네비게이션 개선과 일치합니다.

src/components/feed/FollowList.tsx (1)

35-35: 일관된 라우팅 구조 적용이 적절합니다.

'/follow/followlist'로 변경된 경로는 MyFollower 컴포넌트의 변경사항과 일치하며, 전체적인 라우팅 일관성을 유지합니다.

src/components/search/SearchBar.tsx (2)

56-56: 패딩 축소로 더 컴팩트한 디자인 적용.

패딩을 16px 20px에서 8px 12px로 줄여 검색바가 더 효율적인 공간 활용을 할 수 있게 되었습니다.


78-78: 텍스트 커서 색상 개선으로 UX 향상.

caret-color를 네온그린으로 설정하여 입력 시 커서의 가시성이 향상되고 브랜드 컬러와 일치합니다.

src/pages/index.tsx (2)

23-23: UserSearch 컴포넌트 import가 적절합니다.

새로운 사용자 검색 기능을 위한 컴포넌트 import가 올바르게 추가되었습니다.


39-39: 사용자 검색 라우트 추가가 적절합니다.

"feed/search" 경로는 기존 feed 관련 라우트들과 논리적으로 일치하며, PR 목표인 사용자 검색 화면 구현을 지원합니다.

src/pages/feed/FollowerListPage.tsx (2)

6-7: 데이터 중앙화와 타입 안전성 개선이 좋습니다.

mock 데이터를 외부 모듈로 분리하고 적절한 타입을 import한 것은 코드 재사용성과 유지보수성을 높이는 좋은 접근입니다.


11-11: 타입 안전성을 위한 명시적 타입 지정이 적절합니다.

useParams에 UserProfileType을 명시적으로 지정하여 타입 안전성을 확보한 것이 좋습니다.

src/pages/feed/Feed.tsx (3)

10-10: 적절한 네비게이션 훅 import입니다.

사용자 검색 기능을 위한 useNavigate 훅 추가가 적절합니다.


24-26: 간결하고 명확한 네비게이션 핸들러입니다.

검색 버튼 클릭 시 /feed/search 라우트로 이동하는 핸들러가 간결하고 명확하게 구현되었습니다.


34-34: MainHeader 컴포넌트 통합이 깔끔합니다.

leftButtonClick prop을 통해 검색 기능을 연결한 것이 컴포넌트 재사용성 측면에서 좋은 접근입니다.

src/data/userData.ts (1)

1-2: 적절한 타입 import입니다.

UserProfileItemProps 타입을 import하여 타입 안전성을 확보한 것이 좋습니다.

src/pages/feed/UserSearchResult.tsx (1)

6-9: 타입 정의가 명확합니다.

UserSearchResultProps 인터페이스가 명확하게 정의되어 있어 컴포넌트의 사용법을 이해하기 쉽습니다.

src/pages/feed/UserSearch.tsx (2)

57-62: useEffect 로직이 적절합니다.

searchTerm이 비어있을 때 상태를 초기화하는 로직이 잘 구현되어 있습니다.


125-133: 고정 검색바 스타일링이 적절합니다.

SearchBarContainer의 fixed positioning과 스타일링이 적절하게 구현되어 있습니다.

src/components/feed/UserProfileItem.tsx (4)

1-1: import 변경사항이 리팩토링 목표와 잘 일치합니다.

useLocation 제거와 중앙화된 타입 정의 사용이 적절합니다. 경로 기반 조건부 렌더링에서 prop 기반 로직으로의 전환을 잘 지원합니다.

Also applies to: 5-5


16-16: type prop 추가가 컴포넌트 재사용성을 향상시킵니다.

경로 기반 조건부 로직을 prop 기반으로 전환하여 컴포넌트의 유연성과 테스트 가능성이 개선되었습니다. 기본값 설정으로 하위 호환성도 유지됩니다.


48-58: 팔로워 리스트 버튼의 클릭 기능이 제거되었습니다.

조건부 렌더링 로직은 개선되었지만, 팔로워 리스트 버튼에서 handleFollowerListClick 함수와 onClick 핸들러가 제거되어 클릭 기능이 없어졌습니다. 이것이 의도된 변경인지 확인해주세요.

만약 클릭 기능이 필요하다면 다음과 같이 복원할 수 있습니다:

+  const handleFollowerListClick = (e: React.MouseEvent) => {
+    e.stopPropagation();
+    navigate(`/follow/${userId}/follower`);
+  };

        {type === 'followerlist' && (
-          <div className="followlistbutton">
+          <div className="followlistbutton" onClick={handleFollowerListClick}>
            <div>{followerCount}명이 띱하는 중</div>
            <img src={rightArrow} />
          </div>
        )}

22-22: 라우트 설정이 올바르게 구성되었습니다

  • src/pages/index.tsx 43번째 줄에서 <Route path="otherfeed/:userId" element={<OtherFeedPage />} />otherfeed 경로가 정의되어 있습니다.
  • UserProfileItem, FollowList, PostHeader 등 해당 경로로의 navigate 호출도 모두 일치합니다.

위 내용을 확인했으므로 변경을 승인합니다.

Comment on lines +33 to +41
const handleSearch = (term: string) => {
if (!term.trim()) return;
setIsSearching(true);
setIsSearched(true);
setRecentSearches(prev => {
const filtered = prev.filter(t => t !== term);
return [term, ...filtered].slice(0, 5);
});
};
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

검색 로직에 실제 필터링을 구현하세요.

현재 검색 기능이 mock 데이터를 그대로 표시하고 있습니다. 실제 검색어에 따른 필터링 로직이 필요합니다.

검색 결과를 필터링하는 로직을 추가하세요:

+  const getFilteredUsers = (term: string) => {
+    if (!term.trim()) return [];
+    return mockUserList.filter(user => 
+      user.userName.toLowerCase().includes(term.toLowerCase()) ||
+      user.userTitle.toLowerCase().includes(term.toLowerCase())
+    );
+  };

   const handleSearch = (term: string) => {
     if (!term.trim()) return;
+    const filteredUsers = getFilteredUsers(term);
     setIsSearching(true);
     setIsSearched(true);
     setRecentSearches(prev => {
       const filtered = prev.filter(t => t !== term);
       return [term, ...filtered].slice(0, 5);
     });
   };

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/pages/feed/UserSearch.tsx around lines 33 to 41, the handleSearch
function currently updates recent searches but does not filter the displayed
data based on the search term. Implement filtering logic that uses the search
term to filter the actual data source or mock data before updating the displayed
search results. Ensure the filtered results are set in the component state to
reflect the search query accurately.

Comment on lines +82 to +96
<>
(
{isSearched ? (
<UserSearchResult
type={'searched'}
searchedUserList={mockUserList}
></UserSearchResult>
) : (
<UserSearchResult
type={'searching'}
searchedUserList={mockUserList}
></UserSearchResult>
)}
)
</>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

JSX 문법 오류를 수정하세요.

조건부 렌더링에서 불필요한 괄호가 있어 문법 오류를 일으킬 수 있습니다.

         {isSearching ? (
-          <>
-            (
+          <>
             {isSearched ? (
               <UserSearchResult
                 type={'searched'}
-                searchedUserList={mockUserList}
-              ></UserSearchResult>
+                searchedUserList={getFilteredUsers(searchTerm)}
+              />
             ) : (
               <UserSearchResult
                 type={'searching'}
-                searchedUserList={mockUserList}
-              ></UserSearchResult>
+                searchedUserList={[]}
+              />
             )}
-            )
-          </>
+          </>
         ) : (

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/pages/feed/UserSearch.tsx between lines 82 and 96, remove the unnecessary
parentheses surrounding the JSX conditional rendering block, as these extra
parentheses cause a JSX syntax error. Ensure the conditional rendering is
directly enclosed within a fragment or a single parent element without
extraneous characters.

Comment on lines +12 to +15
const isEmptySearchedUserList = () => {
if (searchedUserList.length === 0) return true;
else return false;
};
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

불필요하게 복잡한 함수를 단순화하세요.

isEmptySearchedUserList 함수가 과도하게 복잡합니다.

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

-  const isEmptySearchedUserList = () => {
-    if (searchedUserList.length === 0) return true;
-    else return false;
-  };
+  const isEmptySearchedUserList = searchedUserList.length === 0;

또는 인라인으로 직접 사용하는 것이 더 간단합니다:

-        {isEmptySearchedUserList() ? (
+        {searchedUserList.length === 0 ? (
📝 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
const isEmptySearchedUserList = () => {
if (searchedUserList.length === 0) return true;
else return false;
};
const isEmptySearchedUserList = searchedUserList.length === 0;
🤖 Prompt for AI Agents
In src/pages/feed/UserSearchResult.tsx around lines 12 to 15, the function
isEmptySearchedUserList is unnecessarily complex by using an if-else statement
to return a boolean. Simplify it by directly returning the boolean expression
searchedUserList.length === 0 without the if-else, or consider inlining this
expression where the function is used for cleaner and more concise code.

Comment on lines +22 to +34
{isEmptySearchedUserList() ? (
<EmptyWrapper></EmptyWrapper>
) : (
searchedUserList.map((user, index) => (
<UserProfileItem
key={user.userId}
{...user}
type="followerlist"
isLast={index === searchedUserList.length - 1}
/>
))
)}
</List>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

하드코딩된 type prop을 동적으로 변경하세요.

type prop이 "followerlist"로 하드코딩되어 있습니다. 이는 컴포넌트의 재사용성을 제한합니다.

UserSearchResult 컴포넌트가 받는 type을 UserProfileItem에 전달하거나, 별도의 prop으로 받도록 개선하세요:

 interface UserSearchResultProps {
   type: 'searching' | 'searched';
   searchedUserList: UserProfileItemProps[];
+  profileType?: UserProfileType;
 }

-export function UserSearchResult({ type, searchedUserList }: UserSearchResultProps) {
+export function UserSearchResult({ type, searchedUserList, profileType = 'followerlist' }: UserSearchResultProps) {
   // ...
             <UserProfileItem
               key={user.userId}
               {...user}
-              type="followerlist"
+              type={profileType}
               isLast={index === searchedUserList.length - 1}
             />
📝 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
{isEmptySearchedUserList() ? (
<EmptyWrapper></EmptyWrapper>
) : (
searchedUserList.map((user, index) => (
<UserProfileItem
key={user.userId}
{...user}
type="followerlist"
isLast={index === searchedUserList.length - 1}
/>
))
)}
</List>
interface UserSearchResultProps {
type: 'searching' | 'searched';
searchedUserList: UserProfileItemProps[];
profileType?: UserProfileType;
}
export function UserSearchResult({
type,
searchedUserList,
profileType = 'followerlist',
}: UserSearchResultProps) {
// ...
return (
<List>
{isEmptySearchedUserList() ? (
<EmptyWrapper></EmptyWrapper>
) : (
searchedUserList.map((user, index) => (
<UserProfileItem
key={user.userId}
{...user}
type={profileType}
isLast={index === searchedUserList.length - 1}
/>
))
)}
</List>
);
}
🤖 Prompt for AI Agents
In src/pages/feed/UserSearchResult.tsx around lines 22 to 34, the type prop
passed to UserProfileItem is hardcoded as "followerlist", limiting component
reusability. Modify UserSearchResult to accept a type prop and pass it down to
UserProfileItem instead of the hardcoded string. Update the component's props
definition to include type and use that prop when rendering UserProfileItem.

@heeeeyong heeeeyong self-assigned this Jul 21, 2025
@heeeeyong heeeeyong added ✨ Feature 기능 개발 🎨 Html&css 마크업 & 스타일링 labels Jul 21, 2025
@heeeeyong heeeeyong merged commit 18e3e60 into develop Jul 23, 2025
1 of 3 checks passed
This was referenced Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 개발 🎨 Html&css 마크업 & 스타일링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant