This commit is contained in:
dahyeon committed 2026-05-02 11:16:09 -07:00
1 parent 3fa8fffcec
commit fedca82c81
6 files changed
+2236 -916

No files matched your search

+599 -129
View File
@@ -1,18 +1,189 @@
import { Link, useParams } from 'react-router';
import { useDdragonManifest, useMatch } from '../api/hooks';
import type { ApiMatchParticipant, Position } from '../api/types';
import { DEFAULT_COMMUNITY_ID } from '../config';
import { profileIconUrl } from '../lib/ddragon';
import { positionLabel, sideShortLabel, teamIndexLabel } from '../lib/league';
import { useState } from "react";
import { ChevronDown, ChevronUp } from "lucide-react";
import { Link, useParams } from "react-router";
import {
useDdragonManifest,
useMatch,
useUserHistoryProfile,
} from "../api/hooks";
import { formatKoreanDate, formatTierLabel } from "../api/mappers";
import type {
ApiMatch,
ApiMatchGameResult,
ApiMatchParticipant,
ApiTierInfo,
MatchGameMode,
Position,
TeamSide,
TournamentCodeSlotView,
} from "../api/types";
import { DEFAULT_COMMUNITY_ID } from "../config";
import { profileIconUrl } from "../lib/ddragon";
import { positionLabel, sideShortLabel, teamIndexLabel } from "../lib/league";
function formatExpiry(value: string | null) {
if (!value) return '-';
return new Intl.DateTimeFormat('ko-KR', {
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(value));
const GAME_MODE_LABEL: Record<MatchGameMode, string> = {
pair: "페어 매치",
bracket: "토너먼트",
"round-robin": "리그전",
};
function resultBadgeClass(won: boolean) {
return won
? "border-blue-500/20 bg-blue-500/10 text-blue-400"
: "border-red-500/20 bg-red-500/10 text-red-400";
}
function captainName(
team: ApiMatch["teams"][number] | undefined,
participantByUserId: Map<string, ApiMatchParticipant>,
) {
if (!team?.captainUserId) return undefined;
return participantByUserId.get(team.captainUserId)?.gameName;
}
function tierByQueue(tiers: ApiTierInfo[], queueType: string) {
return tiers.find((tier) => tier.queueType === queueType);
}
function normalizeRank(rank: string | undefined) {
switch (rank) {
case "I":
return "1";
case "II":
return "2";
case "III":
return "3";
case "IV":
return "4";
default:
return rank;
}
}
function formatRankTooltip(tier: ApiTierInfo | undefined) {
if (!tier) return "언랭크";
const highTier = ["MASTER", "GRANDMASTER", "CHALLENGER"].includes(tier.tier);
const normalizedTier = {
...tier,
rank: normalizeRank(tier.rank) ?? tier.rank,
};
const label = highTier
? formatTierLabel({ ...normalizedTier, leaguePoints: 0 })
: formatTierLabel(normalizedTier);
return `${label} - ${tier.leaguePoints}LP`;
}
function formatRankBadge(tier: ApiTierInfo | undefined) {
if (!tier) return "U";
const tierInitial =
tier.tier === "GRANDMASTER" ? "GM" : tier.tier.slice(0, 1);
const rank = normalizeRank(tier.rank);
return rank ? `${tierInitial}${rank}` : tierInitial;
}
function rankBadgeClass(tier: ApiTierInfo | undefined) {
switch (tier?.tier) {
case "CHALLENGER":
return "border-amber-500/60 bg-amber-100 text-amber-900 dark:border-amber-400/40 dark:bg-amber-400/20 dark:text-amber-200";
case "GRANDMASTER":
return "border-red-500/60 bg-red-100 text-red-800 dark:border-red-400/40 dark:bg-red-400/20 dark:text-red-200";
case "MASTER":
return "border-fuchsia-500/60 bg-fuchsia-100 text-fuchsia-800 dark:border-fuchsia-400/40 dark:bg-fuchsia-400/20 dark:text-fuchsia-200";
case "DIAMOND":
return "border-cyan-500/60 bg-cyan-100 text-cyan-800 dark:border-cyan-400/40 dark:bg-cyan-400/20 dark:text-cyan-200";
case "EMERALD":
return "border-emerald-500/60 bg-emerald-100 text-emerald-800 dark:border-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-200";
case "PLATINUM":
return "border-teal-500/60 bg-teal-100 text-teal-800 dark:border-teal-400/40 dark:bg-teal-400/20 dark:text-teal-200";
case "GOLD":
return "border-amber-500/70 bg-amber-100 text-amber-900 dark:border-yellow-400/40 dark:bg-yellow-400/20 dark:text-yellow-200";
case "SILVER":
return "border-slate-400/60 bg-slate-100 text-slate-700 dark:border-slate-300/40 dark:bg-slate-300/15 dark:text-slate-200";
case "BRONZE":
return "border-orange-600/60 bg-orange-100 text-orange-800 dark:border-orange-500/40 dark:bg-orange-500/20 dark:text-orange-200";
case "IRON":
return "border-stone-500/60 bg-stone-100 text-stone-700 dark:border-stone-400/40 dark:bg-stone-400/15 dark:text-stone-300";
default:
return "border-base-content/30 bg-transparent text-base-content/50";
}
}
function RankBadge({ tier }: { tier?: ApiTierInfo }) {
const tooltip = formatRankTooltip(tier);
return (
<span className="tooltip tooltip-left" data-tip={tooltip}>
<span
className={`inline-flex h-[17px] min-w-[18px] shrink-0 items-center justify-center whitespace-nowrap rounded-[3px] border px-1 text-[10px] font-black leading-none ${rankBadgeClass(tier)}`}
aria-label={tooltip}
>
{formatRankBadge(tier)}
</span>
</span>
);
}
function SummonerStatsSummary({
assignedPosition,
fallbackTier,
userId,
}: {
assignedPosition?: Position;
fallbackTier?: ApiTierInfo;
userId?: string;
}) {
const profileQuery = useUserHistoryProfile(userId, DEFAULT_COMMUNITY_ID);
const tiers = profileQuery.data?.tiers ?? [];
const soloTier =
tierByQueue(tiers, "RANKED_SOLO_5x5") ??
(fallbackTier?.queueType === "RANKED_SOLO_5x5" ? fallbackTier : undefined);
const flexTier = tierByQueue(tiers, "RANKED_FLEX_SR");
return (
<div className="ml-auto flex min-w-[148px] shrink-0 flex-col items-end text-right leading-tight">
<div className="text-[11px] font-black text-primary">
{assignedPosition ? positionLabel[assignedPosition] : "-"}
</div>
<div className="mt-1 flex items-center justify-end gap-2 text-[10px] font-black text-base-content/35">
<span className="inline-flex items-center gap-1">
<span>SOLO</span>
<RankBadge tier={soloTier} />
</span>
<span className="inline-flex items-center gap-1">
<span>FLEX</span>
<RankBadge tier={flexTier} />
</span>
</div>
</div>
);
}
function TeamMemberScoutLine({
isCaptain,
member,
participant,
}: {
isCaptain?: boolean;
member: ApiMatch["teams"][number]["members"][number];
participant?: ApiMatchParticipant;
}) {
return (
<ParticipantLine
assignedPosition={member.assignedPosition}
isCaptain={isCaptain}
participant={participant}
/>
);
}
function ParticipantLine({
@@ -25,11 +196,10 @@ function ParticipantLine({
isCaptain?: boolean;
}) {
const { data: ddragon } = useDdragonManifest();
const name = participant?.gameName ?? '알 수 없는 참가자';
const tag = participant?.tagLine ?? '----';
return (
<div className="flex items-center gap-3 border-b border-base-content/5 last:border-b-0 px-3 py-2">
const name = participant?.gameName ?? "알 수 없는 참가자";
const tag = participant?.tagLine ?? "----";
const content = (
<>
<div className="h-8 w-8 shrink-0 overflow-hidden bg-base-content/10">
<img
src={profileIconUrl(ddragon, participant?.profileIconId ?? 0)}
@@ -39,23 +209,339 @@ function ParticipantLine({
/>
</div>
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2">
<div className="flex min-w-0 items-center gap-2">
<span className="truncate text-sm font-bold text-base-content">
{name}
</span>
{isCaptain && (
<span className="border border-amber-500/20 bg-amber-500/10 px-1.5 py-0.5 text-[10px] font-bold text-amber-500">
<span className="shrink-0 border border-amber-500/20 bg-amber-500/10 px-1.5 py-0.5 text-[10px] font-bold text-amber-500">
팀장
</span>
)}
</div>
<div className="text-[11px] text-base-content/30">#{tag}</div>
</div>
<div className="text-xs font-semibold text-primary">
{assignedPosition ? positionLabel[assignedPosition] : '-'}
</div>
</div>
<SummonerStatsSummary
assignedPosition={assignedPosition}
fallbackTier={participant?.tier}
userId={participant?.userId}
/>
</>
);
const className =
"flex items-center gap-3 border-b border-base-content/5 px-3 py-2 last:border-b-0";
if (participant?.userId) {
return (
<Link
to={`/users/${participant.userId}/history`}
className={`${className} hover:bg-base-content/[0.025]`}
>
{content}
</Link>
);
}
return <div className={className}>{content}</div>;
}
function UpcomingGameCard({
expanded,
game,
isNext,
onToggle,
participantByUserId,
parsedTeamIndex,
slot,
teamByIndex,
}: {
expanded: boolean;
game?: ApiMatchGameResult;
isNext?: boolean;
onToggle: () => void;
participantByUserId: Map<string, ApiMatchParticipant>;
parsedTeamIndex: number;
slot: TournamentCodeSlotView;
teamByIndex: Map<number, ApiMatch["teams"][number]>;
}) {
const [copied, setCopied] = useState(false);
const opponentIndex =
slot.teamAIndex === parsedTeamIndex ? slot.teamBIndex : slot.teamAIndex;
const ourTeam = teamByIndex.get(parsedTeamIndex);
const opponentTeam = teamByIndex.get(opponentIndex);
const ourTeamName = teamIndexLabel(parsedTeamIndex, ourTeam?.name);
const opponentTeamName = teamIndexLabel(opponentIndex, opponentTeam?.name);
const ourCaptainName = captainName(ourTeam, participantByUserId);
const opponentCaptainName = captainName(opponentTeam, participantByUserId);
const opponentMembers = opponentTeam?.members ?? [];
const finished = Boolean(game?.winnerTeamIndex);
const won = finished && game?.winnerTeamIndex === parsedTeamIndex;
const ourSide: TeamSide =
slot.teamAIndex === parsedTeamIndex ? "blue" : "red";
async function handleCopy() {
if (!slot.code) return;
try {
await navigator.clipboard.writeText(slot.code);
setCopied(true);
window.setTimeout(() => setCopied(false), 1500);
} catch {
setCopied(false);
}
}
return (
<li
className={`w-full border bg-base-100 p-4 ${
isNext
? "border-primary/30 bg-primary/[0.03]"
: "border-base-content/10"
} ${finished ? "bg-base-content/[0.015]" : ""}`}
>
<div className="flex items-center justify-between gap-2">
<div className="flex items-center gap-2">
<span
className={`border px-2 py-1 text-[11px] font-black ${
isNext
? "border-primary/25 bg-primary/10 text-primary"
: "border-base-content/10 bg-base-content/5 text-base-content/55"
}`}
>
{isNext ? "다음 경기" : `${slot.gameNumber}경기`}
</span>
<span className="text-[11px] font-semibold text-base-content/35">
{sideShortLabel(ourSide)}
</span>
</div>
{finished ? (
<div className="flex items-center gap-2">
<span
className={`border px-2 py-1 text-[11px] font-black ${resultBadgeClass(won)}`}
>
{won ? "승리" : "패배"}
</span>
<button
type="button"
className="inline-flex h-7 w-7 items-center justify-center text-base-content/45 hover:text-primary"
onClick={onToggle}
aria-expanded={expanded}
aria-label={expanded ? "상대팀 정보 접기" : "상대팀 정보 펼치기"}
>
{expanded ? (
<ChevronUp className="h-4 w-4" aria-hidden="true" />
) : (
<ChevronDown className="h-4 w-4" aria-hidden="true" />
)}
</button>
</div>
) : (
<button
type="button"
className="inline-flex h-7 w-7 items-center justify-center text-base-content/45 hover:text-primary"
onClick={onToggle}
aria-expanded={expanded}
aria-label={expanded ? "상대팀 정보 접기" : "상대팀 정보 펼치기"}
>
{expanded ? (
<ChevronUp className="h-4 w-4" aria-hidden="true" />
) : (
<ChevronDown className="h-4 w-4" aria-hidden="true" />
)}
</button>
)}
</div>
<div className="mt-4 grid grid-cols-[1fr_auto_1fr] items-start gap-2">
<div className="min-w-0">
<div className="truncate text-sm font-black text-primary">
{ourTeamName}
</div>
{ourCaptainName && (
<div className="mt-1 truncate text-[11px] text-base-content/35">
팀장 {ourCaptainName}
</div>
)}
</div>
<div className="pt-0.5 text-[10px] font-black uppercase tracking-wider text-base-content/25">
vs
</div>
<div className="min-w-0 text-right">
<div className="truncate text-sm font-bold text-base-content/70">
{opponentTeamName}
</div>
{opponentCaptainName && (
<div className="mt-1 truncate text-[11px] text-base-content/35">
팀장 {opponentCaptainName}
</div>
)}
</div>
</div>
<div className="mt-4 border border-base-content/8 bg-base-content/[0.02] px-3 py-2">
<div className="text-[10px] font-black uppercase tracking-wider text-base-content/35">
토너먼트 코드
</div>
<div className="mt-1 flex items-center gap-2">
{slot.code ? (
<>
<code className="min-w-0 flex-1 truncate font-mono text-[12px] font-black text-primary">
{slot.code}
</code>
<button
type="button"
className="border border-base-content/10 px-2 py-1 text-[10px] font-bold text-base-content/45 hover:text-primary"
onClick={handleCopy}
>
{copied ? "복사됨" : "복사"}
</button>
</>
) : (
<span className="text-[12px] font-semibold text-base-content/30">
발급 대기
</span>
)}
</div>
</div>
{expanded && (
<div className="mt-3 border border-base-content/8 bg-base-content/[0.015]">
<div className="flex items-center justify-between gap-2 border-b border-base-content/8 px-3 py-2">
<div>
<div className="text-[11px] font-black text-base-content/55">
상대팀 멤버
</div>
<div className="mt-0.5 text-[10px] text-base-content/30">
라인 · 티어
</div>
</div>
<div className="truncate text-right text-[11px] font-bold text-base-content/45">
{opponentTeamName}
</div>
</div>
{opponentMembers.length > 0 ? (
<div>
{opponentMembers.map((member) => (
<TeamMemberScoutLine
key={member.userId}
isCaptain={opponentTeam?.captainUserId === member.userId}
member={member}
participant={participantByUserId.get(member.userId)}
/>
))}
</div>
) : (
<div className="px-3 py-5 text-center text-xs text-base-content/30">
상대팀 멤버 정보가 아직 없습니다.
</div>
)}
</div>
)}
{finished && game?.riotMatchId && (
<div className="mt-2 truncate font-mono text-[10px] text-base-content/25">
{game.riotMatchId}
</div>
)}
</li>
);
}
function TeamGameCardsSection({
defaultExpandedGameNumber,
emptyMessage,
gameByNumber,
isPreTeamBuilt,
match,
participantByUserId,
parsedTeamIndex,
teamByIndex,
slots,
title,
}: {
defaultExpandedGameNumber?: number | null;
emptyMessage: string;
gameByNumber: Map<number, ApiMatchGameResult>;
isPreTeamBuilt?: boolean;
match: ApiMatch;
participantByUserId: Map<string, ApiMatchParticipant>;
parsedTeamIndex: number;
teamByIndex: Map<number, ApiMatch["teams"][number]>;
slots: TournamentCodeSlotView[];
title: string;
}) {
const formatted = formatKoreanDate(match.scheduledAt);
const [expandedGameNumber, setExpandedGameNumber] = useState<number | null>(
defaultExpandedGameNumber ?? null,
);
const nextGameNumber = defaultExpandedGameNumber ?? null;
return (
<section className="mb-4 border border-base-content/10 bg-base-100">
<div className="flex flex-col gap-1 border-b border-base-content/10 bg-base-200/40 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
<h2 className="text-[11px] font-bold uppercase tracking-wider text-base-content/40">
{title}
</h2>
<div className="sm:text-right">
<div className="text-sm font-black text-base-content/70">
{formatted.date} {formatted.time}
</div>
<div className="mt-0.5 text-[11px] font-semibold text-base-content/35">
{GAME_MODE_LABEL[match.gameMode]}
</div>
</div>
</div>
<div className="p-4">
{isPreTeamBuilt ? (
<div className="border border-dashed border-base-content/10 px-4 py-8 text-center text-xs text-base-content/35">
팀 빌딩이 끝나면 일정이 표시됩니다.
</div>
) : slots.length === 0 ? (
<div className="border border-dashed border-base-content/10 px-4 py-8 text-center text-xs text-base-content/35">
{emptyMessage}
</div>
) : (
<ul className="space-y-3">
{slots.map((slot) => (
<UpcomingGameCard
key={slot.gameNumber}
expanded={expandedGameNumber === slot.gameNumber}
game={gameByNumber.get(slot.gameNumber)}
isNext={slot.gameNumber === nextGameNumber}
onToggle={() =>
setExpandedGameNumber((current) =>
current === slot.gameNumber ? null : slot.gameNumber,
)
}
participantByUserId={participantByUserId}
parsedTeamIndex={parsedTeamIndex}
slot={slot}
teamByIndex={teamByIndex}
/>
))}
</ul>
)}
</div>
</section>
);
}
function buildFinishedSlot(
game: ApiMatchGameResult,
slotByGameNumber: Map<number, TournamentCodeSlotView>,
): TournamentCodeSlotView {
const slot = slotByGameNumber.get(game.gameNumber);
return {
gameNumber: game.gameNumber,
teamAIndex: game.blueTeamIndex,
teamBIndex: game.redTeamIndex,
code: slot?.code ?? null,
expiresAt: slot?.expiresAt ?? null,
state: slot?.state ?? "used",
riotMatchId: slot?.riotMatchId ?? game.riotMatchId,
};
}
export default function MatchTeamProgressPage() {
@@ -79,11 +565,18 @@ export default function MatchTeamProgressPage() {
);
}
if (!Number.isInteger(parsedTeamIndex) || parsedTeamIndex < 1 || !matchQuery.data) {
if (
!Number.isInteger(parsedTeamIndex) ||
parsedTeamIndex < 1 ||
!matchQuery.data
) {
return (
<main className="mx-auto max-w-5xl px-4 py-20 text-center">
<h1 className="text-lg font-bold">팀 정보를 찾을 수 없습니다</h1>
<Link to={`/match/${id}`} className="btn btn-primary btn-sm mt-4 px-5 text-xs">
<Link
to={`/match/${id}`}
className="btn btn-primary btn-sm mt-4 px-5 text-xs"
>
내전 상세로
</Link>
</main>
@@ -95,11 +588,36 @@ export default function MatchTeamProgressPage() {
const participantByUserId = new Map(
match.participants.map((participant) => [participant.userId, participant]),
);
const codes = (match.tournamentCodes ?? []).filter((slot) =>
slot.teamAIndex === parsedTeamIndex || slot.teamBIndex === parsedTeamIndex,
const slotByGameNumber = new Map(
(match.tournamentCodes ?? []).map((slot) => [slot.gameNumber, slot]),
);
const games = (match.result?.games ?? []).filter((game) =>
game.blueTeamIndex === parsedTeamIndex || game.redTeamIndex === parsedTeamIndex,
const codes = (match.tournamentCodes ?? []).filter(
(slot) =>
slot.teamAIndex === parsedTeamIndex ||
slot.teamBIndex === parsedTeamIndex,
);
const upcomingSlots = [...codes].sort(
(left, right) => left.gameNumber - right.gameNumber,
);
const teamByIndex = new Map(
match.teams.map((team) => [team.teamIndex, team]),
);
const gameByNumber = new Map(
(match.result?.games ?? []).map((game) => [game.gameNumber, game]),
);
const isPreTeamBuilt =
match.status === "recruiting" || (match.teams ?? []).length === 0;
const teamGames = (match.result?.games ?? []).filter(
(game) =>
game.blueTeamIndex === parsedTeamIndex ||
game.redTeamIndex === parsedTeamIndex,
);
const finishedSlots = teamGames
.filter((game) => Boolean(game.winnerTeamIndex))
.map((game) => buildFinishedSlot(game, slotByGameNumber))
.sort((left, right) => left.gameNumber - right.gameNumber);
const activeSlots = upcomingSlots.filter(
(slot) => !gameByNumber.get(slot.gameNumber)?.winnerTeamIndex,
);
if (!team) {
@@ -109,7 +627,10 @@ export default function MatchTeamProgressPage() {
<p className="mt-2 text-sm text-base-content/40">
경매가 완료되면 팀별 진행 페이지를 사용할 수 있습니다.
</p>
<Link to={`/match/${id}`} className="btn btn-primary btn-sm mt-4 px-5 text-xs">
<Link
to={`/match/${id}`}
className="btn btn-primary btn-sm mt-4 px-5 text-xs"
>
내전 상세로
</Link>
</main>
@@ -130,108 +651,57 @@ export default function MatchTeamProgressPage() {
{teamIndexLabel(team.teamIndex, team.name)}
</h1>
<p className="mt-1 text-sm text-base-content/45">
이 팀에 연결된 토너먼트 코드와 수집된 결과만 보여줍니다.
이 팀의 다가오는 경기 일정과 결과를 한곳에서 확인합니다.
</p>
</div>
<div className="grid gap-4 lg:grid-cols-[minmax(0,1fr)_320px]">
<section className="border border-base-content/10 bg-base-100">
<div className="border-b border-base-content/10 bg-base-200/40 px-4 py-2">
<h2 className="text-[11px] font-bold uppercase tracking-wider text-base-content/40">
팀 구성
</h2>
</div>
<TeamGameCardsSection
defaultExpandedGameNumber={activeSlots[0]?.gameNumber ?? null}
emptyMessage="남은 경기가 없습니다."
gameByNumber={gameByNumber}
isPreTeamBuilt={isPreTeamBuilt}
match={match}
participantByUserId={participantByUserId}
parsedTeamIndex={parsedTeamIndex}
teamByIndex={teamByIndex}
slots={activeSlots}
title="다가오는 경기"
/>
<TeamGameCardsSection
defaultExpandedGameNumber={null}
emptyMessage="아직 종료된 경기가 없습니다."
gameByNumber={gameByNumber}
match={match}
participantByUserId={participantByUserId}
parsedTeamIndex={parsedTeamIndex}
teamByIndex={teamByIndex}
slots={finishedSlots}
title="종료된 경기"
/>
<section className="border border-base-content/10 bg-base-100">
<div className="border-b border-base-content/10 bg-base-200/40 px-4 py-2">
<h2 className="text-[11px] font-bold uppercase tracking-wider text-base-content/40">
팀 구성
</h2>
</div>
<ParticipantLine
participant={
team.captainUserId
? participantByUserId.get(team.captainUserId)
: undefined
}
isCaptain
/>
{team.members.map((member) => (
<ParticipantLine
participant={
team.captainUserId
? participantByUserId.get(team.captainUserId)
: undefined
}
isCaptain
key={member.userId}
participant={participantByUserId.get(member.userId)}
assignedPosition={member.assignedPosition}
/>
{team.members.map((member) => (
<ParticipantLine
key={member.userId}
participant={participantByUserId.get(member.userId)}
assignedPosition={member.assignedPosition}
/>
))}
</section>
<section className="space-y-4">
<div className="border border-base-content/10 bg-base-100">
<div className="border-b border-base-content/10 bg-base-200/40 px-4 py-2">
<h2 className="text-[11px] font-bold uppercase tracking-wider text-base-content/40">
토너먼트 코드
</h2>
</div>
<div className="divide-y divide-base-content/5">
{codes.length > 0 ? (
codes.map((slot) => (
<div key={slot.gameNumber} className="px-4 py-3 text-xs">
<div className="flex items-center justify-between gap-2">
<span className="font-bold text-base-content/50">
{slot.gameNumber}경기
</span>
<code className="font-mono font-black text-primary">
{slot.code ?? '발급 대기'}
</code>
</div>
<div className="mt-1 text-[11px] text-base-content/30">
만료 {formatExpiry(slot.expiresAt)}
</div>
</div>
))
) : (
<div className="px-4 py-6 text-center text-xs text-base-content/30">
아직 연결된 코드가 없습니다.
</div>
)}
</div>
</div>
<div className="border border-base-content/10 bg-base-100">
<div className="border-b border-base-content/10 bg-base-200/40 px-4 py-2">
<h2 className="text-[11px] font-bold uppercase tracking-wider text-base-content/40">
결과
</h2>
</div>
<div className="divide-y divide-base-content/5">
{games.length > 0 ? (
games.map((game) => {
const won = game.winnerTeamIndex === parsedTeamIndex;
const side =
game.blueTeamIndex === parsedTeamIndex ? 'blue' : 'red';
return (
<div key={game.gameNumber} className="px-4 py-3 text-xs">
<div className="flex items-center justify-between gap-2">
<span className="font-bold text-base-content/50">
{game.gameNumber}경기
</span>
<span
className={won ? 'font-black text-blue-400' : 'font-black text-red-400'}
>
{won ? '승리' : '패배'}
</span>
</div>
<div className="mt-1 text-[11px] text-base-content/35">
{sideShortLabel(side)} 진영
</div>
<div className="mt-1 truncate font-mono text-[11px] text-base-content/30">
{game.riotMatchId}
</div>
</div>
);
})
) : (
<div className="px-4 py-6 text-center text-xs text-base-content/30">
아직 수집된 결과가 없습니다.
</div>
)}
</div>
</div>
</section>
</div>
))}
</section>
</main>
);
}