Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/e2e/mocks/tournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const MOCK_TOURNAMENT_PENDING: GetTournamentPendingResponseT = {
nickname: '피키게스트',
itemCount: 0,
profileImage: MOCK_IMAGE_URLS.avatar,
isHost: true,
},
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type TournamentParticipantT = {
nickname: string;
itemCount: number;
profileImage: string;
isHost: boolean;
};

/** 서버가 브래킷에서 파생해 내려주는 대결 한 판 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function TournamentCreateClient({ tournamentId }: TournamentCreateClientProps) {
id: p.userId,
name: p.nickname,
imageUrl: p.profileImage,
isHost: p.isHost,
},
itemCount: p.itemCount,
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import UserProfile from '@/components/user-profile-group/UserProfile';
import type { UserT } from '@/components/user-profile-group/userProfile.types';
import { useGetMe } from '@/hooks/useGetMe';
import { cn } from '@/utils/cn';

type ParticipantChipProps = {
user: UserT;
Expand All @@ -14,7 +15,7 @@ function ParticipantChip({ user, itemCount }: ParticipantChipProps) {
return (
<span className="inline-flex items-center gap-1.5 rounded-full border border-border-neutral-muted bg-bg-layer-default py-1 pr-3 pl-1 body-2-medium text-text-neutral-primary">
<UserProfile user={user} className="border-0" />
<span>{isMe ? '나' : user.name}</span>
<span className={cn(user.isHost && 'ml-1.5')}>{isMe ? '나' : user.name}</span>
<span className="body-2-semibold text-text-neutral-secondary">{itemCount}개</span>
</span>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ type GroupResultParticipantT = {
userId: string;
nickname: string;
profileImage: string;
isHost: boolean;
};

export type GroupResultItemT = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import PikiLogo from '@/assets/images/piki-logo-cart.svg';
import ReceiptZigzag from '@/assets/images/tournament/result/receipt-zigzag.svg';
import TrophyBadge from '@/assets/images/tournament/result/trophy-badge.svg';
import HostBadge from '@/components/common/host-badge';
import Spinner from '@/components/spinner';
import { ROUTES } from '@/consts/route';
import { useBackWithFallback } from '@/hooks/useBackWithFallback';
Expand Down Expand Up @@ -283,15 +284,22 @@ function GroupProductCard({ item, highlight = false }: GroupProductCardProps) {
key={chooser.userId}
className="flex items-center gap-1.5 rounded-full bg-gray-50 py-1 pr-3 pl-1"
>
<Image
src={chooser.profileImage}
alt={chooser.nickname}
width={20}
height={20}
className="size-5 rounded-full bg-gray-50 object-cover"
unoptimized
/>
<span className="caption-1-semibold text-text-neutral-primary">
<span className="relative shrink-0">
<Image
src={chooser.profileImage}
alt={chooser.nickname}
width={20}
height={20}
className="size-5 rounded-full bg-gray-50 object-cover"
unoptimized
/>
{chooser.isHost && (
<span className="pointer-events-none absolute -bottom-px -right-1.5">
<HostBadge />
</span>
)}
</span>
<span className={cn('caption-1-semibold text-text-neutral-primary', chooser.isHost && 'ml-1.5')}>
{chooser.nickname}
</span>
</li>
Expand Down
4 changes: 4 additions & 0 deletions apps/web/src/assets/images/host-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/web/src/components/common/host-badge/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import HostBadgeSvg from '@/assets/images/host-badge.svg';

function HostBadge() {
Comment thread
coderabbitai[bot] marked this conversation as resolved.
return <HostBadgeSvg aria-label="주최자" role="img" />;
}

export default HostBadge;
14 changes: 13 additions & 1 deletion apps/web/src/components/user-profile-group/UserProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from 'next/image';

import HostBadge from '@/components/common/host-badge';
import { cn } from '@/utils/cn';

import type { UserT } from './userProfile.types';
Expand All @@ -10,7 +11,7 @@ type UserProfileProps = {
};

function UserProfile({ user, className }: UserProfileProps) {
return (
const profileImage = (
<span
className={cn(
'relative block size-6.75 shrink-0 overflow-hidden rounded-full border-[1.6px] border-white',
Expand All @@ -26,6 +27,17 @@ function UserProfile({ user, className }: UserProfileProps) {
/>
</span>
);

if (!user.isHost) return profileImage;

return (
<span className="relative inline-block shrink-0">
{profileImage}
<span className="pointer-events-none absolute -bottom-px -right-1.5">
<HostBadge />
</span>
</span>
);
}

export default UserProfile;
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export type UserT = {
id: string;
name: string;
imageUrl: string;
isHost?: boolean;
};
Loading