diff --git a/apps/web/src/pages/MatchDetailPage.tsx b/apps/web/src/pages/MatchDetailPage.tsx index 9084ba8e..6384241c 100644 --- a/apps/web/src/pages/MatchDetailPage.tsx +++ b/apps/web/src/pages/MatchDetailPage.tsx @@ -1872,7 +1872,86 @@ function RoundRobinStandingsTable({ match }: { match: MatchDetailView }) { ); } -function MatchResultPanel({ match }: { match: MatchDetailView }) { +function MatchStandingsSection({ match }: { match: MatchDetailView }) { + if (!match.result) return null; + + const maxGameNumber = Math.max( + match.gameCount, + match.tournamentCodes.length, + ...match.result.games.map((game) => game.gameNumber), + ); + const seriesResults = match.result.seriesResults ?? []; + const primarySeries = seriesResults[0]; + const showRoundRobinStandings = + match.gameMode === "round-robin" && match.teams.length > 2; + + if (showRoundRobinStandings) { + return ; + } + + return ( + <> + {primarySeries && ( +
+
+
+ {primarySeries.teamAWins} +
+
+ {resolveMatchTeamName(match, primarySeries.teamAIndex)} +
+
+
+ VS +
+
+
+ {primarySeries.teamBWins} +
+
+ {resolveMatchTeamName(match, primarySeries.teamBIndex)} +
+
+
+ )} +
+ {match.result.winner + ? `${match.result.winner} 승리` + : `결과 수집 중 · ${match.result.games.length}/${maxGameNumber}경기`} +
+ {seriesResults.length > 1 && ( +
+ {seriesResults.map((series) => ( +
+
+ {resolveMatchTeamName(match, series.teamAIndex)} vs{" "} + {resolveMatchTeamName(match, series.teamBIndex)} +
+
+ + {series.teamAWins} + + : + + {series.teamBWins} + +
+
+ ))} +
+ )} + + ); +} + +function MatchGameListSection({ match }: { match: MatchDetailView }) { if (!match.result) return null; const gamesByNumber = new Map( @@ -1887,148 +1966,176 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) { { length: maxGameNumber }, (_, index) => index + 1, ); - const seriesResults = match.result.seriesResults ?? []; - const primarySeries = seriesResults[0]; - const showRoundRobinStandings = - match.gameMode === "round-robin" && match.teams.length > 2; + + return ( +
+ {gameNumbers.map((gameNumber) => { + const game = gamesByNumber.get(gameNumber); + const rowClass = + "grid grid-cols-[56px_1fr_auto] gap-3 items-center px-3 py-2.5 text-xs"; + const content = ( + <> + + {gameNumber}경기 + + {game ? ( +
+ + {resolveMatchTeamName(match, game.winnerTeamIndex)} 승 + + + ({resultSideLabel(game.winnerSide)} 진영) + + + {game.riotMatchId} + +
+ ) : ( + 대기 중 + )} + + {game ? ( + <> + {formatGameDuration(game.gameDuration)} + + 상세 + + + ) : ( + "-" + )} + + + ); + + if (game) { + return ( + + {content} + + ); + } + + return ( +
+ {content} +
+ ); + })} +
+ ); +} + +function MatchResultPanel({ match }: { match: MatchDetailView }) { + if (!match.result) return null; return (
- {showRoundRobinStandings ? ( - - ) : ( - <> - {primarySeries && ( -
-
-
- {primarySeries.teamAWins} -
-
- {resolveMatchTeamName(match, primarySeries.teamAIndex)} -
-
-
- VS -
-
-
- {primarySeries.teamBWins} -
-
- {resolveMatchTeamName(match, primarySeries.teamBIndex)} -
-
-
- )} -
- {match.result.winner - ? `${match.result.winner} 승리` - : `결과 수집 중 · ${match.result.games.length}/${maxGameNumber}경기`} -
- {seriesResults.length > 1 && ( -
- {seriesResults.map((series) => ( -
-
- {resolveMatchTeamName(match, series.teamAIndex)} vs{" "} - {resolveMatchTeamName(match, series.teamBIndex)} -
-
- - {series.teamAWins} - - : - - {series.teamBWins} - -
-
- ))} -
- )} - - )} -
- {gameNumbers.map((gameNumber) => { - const game = gamesByNumber.get(gameNumber); - const rowClass = - "grid grid-cols-[56px_1fr_auto] gap-3 items-center px-3 py-2.5 text-xs"; - const content = ( - <> - - {gameNumber}경기 - - {game ? ( -
- - {resolveMatchTeamName(match, game.winnerTeamIndex)} 승 - - - ({resultSideLabel(game.winnerSide)} 진영) - - - {game.riotMatchId} - -
- ) : ( - 대기 중 - )} - - {game ? ( - <> - {formatGameDuration(game.gameDuration)} - - 상세 - - - ) : ( - "-" - )} - - - ); - - if (game) { - return ( - - {content} - - ); - } - - return ( -
- {content} -
- ); - })} + +
+
); } +type FinishedResultTab = "standings" | "games" | "teams" | "info"; + +function FinishedMatchTabs({ match }: { match: MatchDetailView }) { + const [resultTab, setResultTab] = useState("standings"); + const hasInfo = match.prizes.length > 0 || match.notices.length > 0; + const tabs: Array<{ id: FinishedResultTab; label: string }> = [ + { id: "standings", label: "순위표" }, + { id: "games", label: "경기결과" }, + { id: "teams", label: "팀 빌딩" }, + ...(hasInfo + ? [{ id: "info" as FinishedResultTab, label: "대회 정보" }] + : []), + ]; + const activeTab = + resultTab === "info" && !hasInfo ? "standings" : resultTab; + + return ( +
+
+ {tabs.map((item) => ( + + ))} +
+ {activeTab === "standings" && ( +
+ +
+ )} + {activeTab === "games" && } + {activeTab === "teams" && ( +
+ {match.teams.map((team) => ( + + ))} +
+ )} + {activeTab === "info" && ( +
+ {match.prizes.length > 0 && ( + +
    + {match.prizes.map((prize, index) => ( +
  • + ▸ + {prize} +
  • + ))} +
+
+ )} + {match.notices.length > 0 && ( + +
    + {match.notices.map((notice, index) => ( +
  • + • + {notice} +
  • + ))} +
+
+ )} +
+ )} +
+ ); +} + export default function MatchDetailPage() { const { id } = useParams(); const navigate = useNavigate(); @@ -2537,10 +2644,14 @@ export default function MatchDetailPage() {
)} - + {match.status === "finished" ? ( + + ) : ( + <> + -
-
+
+
{match.status === "recruiting" ? ( <> )} -
-
+
+
+ + )} {replaceCodeSlot && (