Skip to content

feat: show roleName in group list page#142

Open
chpheid314 wants to merge 1 commit into
gsainfoteam:103-feature-show-rolename-in-group-list-pagefrom
chpheid314:103-feature-show-rolename-in-group-list-page
Open

feat: show roleName in group list page#142
chpheid314 wants to merge 1 commit into
gsainfoteam:103-feature-show-rolename-in-group-list-pagefrom
chpheid314:103-feature-show-rolename-in-group-list-page

Conversation

@chpheid314

@chpheid314 chpheid314 commented Jan 9, 2026

Copy link
Copy Markdown
  1. 그룹 리스트
    각 그룹 내 본인의 역할(roleName)에 따라 왕관 아이콘의 색상을 구분하여 표시하도록 변경했습니다.
  • 그룹장: 금색
  • 관리자: 은색
  • 매니저: 동색
스크린샷 2026-01-09 122250
  1. 그룹 관리창 - 멤버 탭
    기존에 회색으로 표시되던 그룹장의 왕관 아이콘을 그룹 리스트 디자인과 통일하기 위해 금색으로 변경했습니다.

구현 의도: 멤버 리스트에는 이미 역할(roleName)을 텍스트로 보여주는 열이 존재하므로, 시각적 중복을 피하기 위해 그룹장 외의 역할(관리자, 매니저)에는 별도의 왕관 아이콘을 추가하지 않았습니다.

스크린샷 2026-01-09 122456

Summary by CodeRabbit

릴리스 노트

그룹 항목과 회원 목록의 사용자 역할 표시 기능을 개선했습니다.

  • Style
    • 사용자 역할 및 권한에 따른 크라운 아이콘 색상 동적 적용
    • 그룹 항목과 회원 테이블의 레이아웃 및 스타일 조정

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Pull Request는 두 컴포넌트에서 Crown 아이콘의 렌더링 로직을 개선합니다. GroupItem 컴포넌트는 로컬 SVG에서 iconoir-react의 Crown으로 변경하고, 인증 컨텍스트를 추가하여 사용자의 회장 및 매니저 상태를 기반으로 조건부 렌더링을 구현합니다. MemberTableRow 컴포넌트는 Crown 아이콘을 노란색으로 스타일링된 div로 감싸는 마크업 변경을 수행합니다.

Changes

Cohort / File(s) Summary
Crown Icon 렌더링 로직 개선
src/pages/main/GroupItem.tsx
Crown 아이콘 소스를 iconoir-react로 변경; useAuth 컨텍스트 추가로 회장 상태 판별; isManager 파생 및 getCrownColor 함수로 역할별 색상 매핑; Crown을 crownColor 기반으로 조건부 렌더링; 그룹명 라인을 flex 컨테이너로 확장
Crown Icon 스타일링
src/pages/manage/pages/members/sections/memberManagement/MemberTableRow.tsx
Crown 아이콘을 text-yellow-500 div로 감싸 스타일링 적용

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #463: 그룹 목록 및 멤버 테이블의 동일한 컴포넌트에서 역할 기반 Crown 아이콘 렌더링 및 색상 지정을 구현하므로 관련있음

Possibly related PRs

Suggested reviewers

  • crown-3
  • SHIM-JINSEO

Poem

👑 이제 Crown이 반짝반짝, 아이콘 변경했어 ✨
회장님 표시 참 멋진데, 색상도 더해졌네요
역할에 따라 달라지는 모습, 아름답기까지 해
로그인한 사용자만 알 수 있는 비밀, 🐰 추천합니다!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR title accurately reflects the main change: adding role-based crown icon colors to the group list page, which is the primary feature implemented in GroupItem.tsx.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

@rhseung

rhseung commented Jan 9, 2026

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jan 9, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 (3)
src/pages/main/GroupItem.tsx (2)

35-42: getCrownColor 함수를 컴포넌트 외부로 이동하는 것을 고려하세요.

현재 getCrownColor 함수는 컴포넌트 내부에 정의되어 있어 매 렌더링마다 새로 생성됩니다. 성능 최적화를 위해 함수를 컴포넌트 외부로 추출하거나 useMemo를 사용하는 것을 고려할 수 있습니다.

♻️ 제안하는 리팩토링
+const getCrownColor = (
+  isPresident: boolean,
+  isAdmin: boolean,
+  isManager: boolean
+): string | null => {
+  if (isPresident) return "text-yellow-500";
+  if (isAdmin) return "text-slate-400";
+  if (isManager) return "text-amber-700";
+  return null;
+};
+
 const GroupItem = ({
   groupParams,
 }: {
   groupParams: {
     group: GroupInfoWithPresidentUuid;
   };
 }) => {
   const group = groupParams.group;
   const { userInfo } = useAuth();

   const { data: userRole } = useSWR(
     ["userRole", group.uuid || ""],
     ([_, uuid]) => getUserRole(uuid),
   );

   if (!userRole) return <></>;

   const isAdmin = userRole.name === "admin";
   const isManager = userRole.name === "manager";
   const isPresident = userInfo?.uuid === group.presidentUuid;

-  const getCrownColor = () => {
-    if (isPresident) return "text-yellow-500";
-    if (isAdmin) return "text-slate-400";
-    if (isManager) return "text-amber-700";
-    return null;
-  };
-
-  const crownColor = getCrownColor();
+  const crownColor = getCrownColor(isPresident, isAdmin, isManager);

55-57: Crown 아이콘에 접근성 속성을 추가하는 것을 고려하세요.

Crown 아이콘이 역할을 나타내는 중요한 UI 요소이므로, 스크린 리더 사용자를 위해 aria-label이나 title 속성을 추가하는 것이 좋습니다.

♻️ 제안하는 개선
-          {crownColor && <Crown className={cn(crownColor)} />}
+          {crownColor && (
+            <Crown 
+              className={cn(crownColor)} 
+              aria-label={
+                isPresident ? "그룹장" : 
+                isAdmin ? "관리자" : 
+                isManager ? "매니저" : ""
+              }
+            />
+          )}

또는 더 간단하게:

const getRoleLabel = () => {
  if (isPresident) return "그룹장";
  if (isAdmin) return "관리자";
  if (isManager) return "매니저";
  return "";
};

그리고 JSX에서:

-          {crownColor && <Crown className={cn(crownColor)} />}
+          {crownColor && (
+            <Crown 
+              className={cn(crownColor)} 
+              aria-label={getRoleLabel()}
+            />
+          )}
src/pages/manage/pages/members/sections/memberManagement/MemberTableRow.tsx (1)

66-69: Crown 아이콘 마크업을 간소화하고 접근성을 개선하세요.

현재 Crown 아이콘이 추가 div로 감싸져 있는데, 이를 간소화할 수 있습니다. 또한 스크린 리더 사용자를 위해 접근성 속성을 추가하는 것이 좋습니다.

♻️ 제안하는 개선

Option 1: div 제거하고 Crown에 직접 className 적용

         <div className="flex items-center gap-2">
           {member.name}
-          <div className="text-yellow-500">
-            {isThisMemberPresident && <Crown />}
-          </div>
+          {isThisMemberPresident && (
+            <Crown 
+              className="text-yellow-500" 
+              aria-label="그룹장"
+            />
+          )}
         </div>

Option 2: div를 유지하되 더 의미있는 구조로 개선

         <div className="flex items-center gap-2">
           {member.name}
-          <div className="text-yellow-500">
-            {isThisMemberPresident && <Crown />}
-          </div>
+          {isThisMemberPresident && (
+            <span className="text-yellow-500" role="img" aria-label="그룹장">
+              <Crown />
+            </span>
+          )}
         </div>
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between abf96e5 and 4844681.

📒 Files selected for processing (2)
  • src/pages/main/GroupItem.tsx
  • src/pages/manage/pages/members/sections/memberManagement/MemberTableRow.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/pages/main/GroupItem.tsx (1)
src/utils/clsx/index.ts (1)
  • cn (5-5)
🔇 Additional comments (4)
src/pages/main/GroupItem.tsx (3)

22-22: userInfo가 undefined인 경우 처리를 확인하세요.

useAuth()에서 반환된 userInfo가 undefined일 수 있는 경우(예: 인증 로딩 중), Line 33의 isPresident 체크는 항상 false가 됩니다. 현재 로직이 의도한 동작인지 확인하고, 필요시 로딩 상태를 명시적으로 처리하는 것을 고려하세요.

Also applies to: 33-33


47-53: 변경 사항이 적절합니다.

프로필 이미지의 마크업 구조 변경이 깔끔하게 적용되었습니다. 기능상 문제없습니다.


4-4: Crown 컴포넌트는 iconoir-react@7.10.1에 정상적으로 포함되어 있으며, 현재 코드의 import 및 사용이 모두 올바릅니다.

src/pages/manage/pages/members/sections/memberManagement/MemberTableRow.tsx (1)

67-67: 색상 일관성이 잘 유지되었습니다.

text-yellow-500 색상이 GroupItem.tsx의 그룹장 크라운 색상과 일치하여 일관된 UI를 제공합니다.

Comment on lines +35 to +40
const getCrownColor = () => {
if (isPresident) return "text-yellow-500";
if (isAdmin) return "text-slate-400";
if (isManager) return "text-amber-700";
return null;
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

useMemo를 사용하거나 컴포넌트 외부로 빼주세요

Comment on lines +36 to +38
if (isPresident) return "text-yellow-500";
if (isAdmin) return "text-slate-400";
if (isManager) return "text-amber-700";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (isPresident) return "text-yellow-500";
if (isAdmin) return "text-slate-400";
if (isManager) return "text-amber-700";
if (isPresident) return cn("text-yellow-500");
if (isAdmin) return cn("text-slate-400");
if (isManager) return cn("text-amber-700");

IDE 자동 완성을 위해 cn을 클래스 이름에 항상 넣어주는 게 좋습니다


<p className="flex items-center gap-2 ml-[15px] mr-[5px] text-lg font-semibold text-dark dark:text-d_white">
{group.name}
{crownColor && <Crown className={cn(crownColor)} />}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
{crownColor && <Crown className={cn(crownColor)} />}
{crownColor && <Crown className={crownColor} />}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants