This commit is contained in:
dahyeon committed 2026-05-02 04:05:35 -07:00
1 parent 4baea89f89
commit fd386ed202
32 files changed
+1128 -601

No files matched your search

+15 -23
View File
@@ -1,14 +1,9 @@
import { Link, useParams } from 'react-router';
import { useDdragonManifest, useMatch } from '../api/hooks';
import type { ApiMatchParticipant, Position, TeamSide } from '../api/types';
import type { ApiMatchParticipant, Position } from '../api/types';
import { DEFAULT_COMMUNITY_ID } from '../config';
import { profileIconUrl } from '../lib/ddragon';
import { positionLabel } from '../lib/league';
function teamLabel(side: TeamSide, groupIndex = 1) {
const sideText = side === 'blue' ? '블루팀' : '레드팀';
return groupIndex === 1 ? sideText : `${groupIndex}조 ${sideText}`;
}
import { positionLabel, sideShortLabel, teamIndexLabel } from '../lib/league';
function formatExpiry(value: string | null) {
if (!value) return '-';
@@ -64,9 +59,8 @@ function ParticipantLine({
}
export default function MatchTeamProgressPage() {
const { id, side, groupIndex } = useParams();
const parsedGroupIndex = Number(groupIndex ?? 1);
const teamSide = side === 'blue' || side === 'red' ? side : null;
const { id, teamIndex } = useParams();
const parsedTeamIndex = Number(teamIndex);
const matchQuery = useMatch(id, DEFAULT_COMMUNITY_ID);
if (!DEFAULT_COMMUNITY_ID) {
@@ -85,7 +79,7 @@ export default function MatchTeamProgressPage() {
);
}
if (!teamSide || !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>
@@ -97,22 +91,15 @@ export default function MatchTeamProgressPage() {
}
const match = matchQuery.data;
const team = match.teams.find(
(item) =>
item.side === teamSide && (item.groupIndex ?? 1) === parsedGroupIndex,
);
const team = match.teams.find((item) => item.teamIndex === parsedTeamIndex);
const participantByUserId = new Map(
match.participants.map((participant) => [participant.userId, participant]),
);
const codes = (match.tournamentCodes ?? []).filter((slot) =>
teamSide === 'blue'
? slot.blueGroupIndex === parsedGroupIndex
: slot.redGroupIndex === parsedGroupIndex,
slot.teamAIndex === parsedTeamIndex || slot.teamBIndex === parsedTeamIndex,
);
const games = (match.result?.games ?? []).filter((game) =>
teamSide === 'blue'
? game.blueGroupIndex === parsedGroupIndex
: game.redGroupIndex === parsedGroupIndex,
game.blueTeamIndex === parsedTeamIndex || game.redTeamIndex === parsedTeamIndex,
);
if (!team) {
@@ -140,7 +127,7 @@ export default function MatchTeamProgressPage() {
<div className="mb-6 border-b border-base-content/8 pb-5">
<h1 className="text-2xl font-black text-base-content">
{team.name || teamLabel(team.side, team.groupIndex)}
{teamIndexLabel(team.teamIndex, team.name)}
</h1>
<p className="mt-1 text-sm text-base-content/45">
이 팀에 연결된 토너먼트 코드와 수집된 결과만 보여줍니다.
@@ -212,7 +199,9 @@ export default function MatchTeamProgressPage() {
<div className="divide-y divide-base-content/5">
{games.length > 0 ? (
games.map((game) => {
const won = game.winnerSide === teamSide;
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">
@@ -225,6 +214,9 @@ export default function MatchTeamProgressPage() {
{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>