release/86 #2
@@ -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 <RoundRobinStandingsTable match={match} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{primarySeries && (
|
||||
<div className="flex items-center justify-center gap-8">
|
||||
<div
|
||||
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : "text-base-content/30"}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{primarySeries.teamAWins}
|
||||
</div>
|
||||
<div className="text-xs uppercase tracking-wider mt-0.5 font-semibold">
|
||||
{resolveMatchTeamName(match, primarySeries.teamAIndex)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/20 text-xs font-bold uppercase tracking-widest">
|
||||
VS
|
||||
</div>
|
||||
<div
|
||||
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : "text-base-content/30"}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{primarySeries.teamBWins}
|
||||
</div>
|
||||
<div className="text-xs uppercase tracking-wider mt-0.5 font-semibold">
|
||||
{resolveMatchTeamName(match, primarySeries.teamBIndex)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="text-center mt-3 text-xs font-bold text-amber-400 uppercase tracking-wide">
|
||||
{match.result.winner
|
||||
? `${match.result.winner} 승리`
|
||||
: `결과 수집 중 · ${match.result.games.length}/${maxGameNumber}경기`}
|
||||
</div>
|
||||
{seriesResults.length > 1 && (
|
||||
<div className="mt-4 grid sm:grid-cols-2 gap-2">
|
||||
{seriesResults.map((series) => (
|
||||
<div
|
||||
key={`${series.teamAIndex}-${series.teamBIndex}`}
|
||||
className="border border-base-content/8 bg-base-100 px-3 py-2 text-xs"
|
||||
>
|
||||
<div className="font-bold text-base-content/55">
|
||||
{resolveMatchTeamName(match, series.teamAIndex)} vs{" "}
|
||||
{resolveMatchTeamName(match, series.teamBIndex)}
|
||||
</div>
|
||||
<div className="mt-1 flex items-center justify-between">
|
||||
<span className={teamIndexColorClasses(series.teamAIndex).text}>
|
||||
{series.teamAWins}
|
||||
</span>
|
||||
<span className="text-base-content/20">:</span>
|
||||
<span className={teamIndexColorClasses(series.teamBIndex).text}>
|
||||
{series.teamBWins}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
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 (
|
||||
<div className="border border-base-content/8 divide-y divide-base-content/8">
|
||||
{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 = (
|
||||
<>
|
||||
<span className="text-base-content/35 font-bold">
|
||||
{gameNumber}경기
|
||||
</span>
|
||||
{game ? (
|
||||
<div className="min-w-0">
|
||||
<span
|
||||
className={`font-black ${resultSideClass(game.winnerSide)}`}
|
||||
>
|
||||
{resolveMatchTeamName(match, game.winnerTeamIndex)} 승
|
||||
</span>
|
||||
<span className="ml-1 text-base-content/35">
|
||||
({resultSideLabel(game.winnerSide)} 진영)
|
||||
</span>
|
||||
<span className="ml-2 text-base-content/35 font-mono">
|
||||
{game.riotMatchId}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-base-content/25">대기 중</span>
|
||||
)}
|
||||
<span className="text-right text-base-content/35 font-mono">
|
||||
{game ? (
|
||||
<>
|
||||
{formatGameDuration(game.gameDuration)}
|
||||
<span className="ml-2 font-sans font-bold text-primary opacity-0 transition-opacity group-hover:opacity-100">
|
||||
상세
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
|
||||
if (game) {
|
||||
return (
|
||||
<Link
|
||||
key={gameNumber}
|
||||
to={`/match/${match.id}/game/${gameNumber}`}
|
||||
className={`${rowClass} group transition-colors hover:bg-primary/5`}
|
||||
aria-label={`${gameNumber}경기 상세 보기`}
|
||||
>
|
||||
{content}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div key={gameNumber} className={rowClass}>
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function MatchResultPanel({ match }: { match: MatchDetailView }) {
|
||||
if (!match.result) return null;
|
||||
|
||||
return (
|
||||
<div className="mb-6 border border-base-content/10 bg-base-content/[0.02] p-5">
|
||||
{showRoundRobinStandings ? (
|
||||
<RoundRobinStandingsTable match={match} />
|
||||
) : (
|
||||
<>
|
||||
{primarySeries && (
|
||||
<div className="flex items-center justify-center gap-8">
|
||||
<div
|
||||
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : "text-base-content/30"}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{primarySeries.teamAWins}
|
||||
</div>
|
||||
<div className="text-xs uppercase tracking-wider mt-0.5 font-semibold">
|
||||
{resolveMatchTeamName(match, primarySeries.teamAIndex)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/20 text-xs font-bold uppercase tracking-widest">
|
||||
VS
|
||||
</div>
|
||||
<div
|
||||
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : "text-base-content/30"}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{primarySeries.teamBWins}
|
||||
</div>
|
||||
<div className="text-xs uppercase tracking-wider mt-0.5 font-semibold">
|
||||
{resolveMatchTeamName(match, primarySeries.teamBIndex)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="text-center mt-3 text-xs font-bold text-amber-400 uppercase tracking-wide">
|
||||
{match.result.winner
|
||||
? `${match.result.winner} 승리`
|
||||
: `결과 수집 중 · ${match.result.games.length}/${maxGameNumber}경기`}
|
||||
</div>
|
||||
{seriesResults.length > 1 && (
|
||||
<div className="mt-4 grid sm:grid-cols-2 gap-2">
|
||||
{seriesResults.map((series) => (
|
||||
<div
|
||||
key={`${series.teamAIndex}-${series.teamBIndex}`}
|
||||
className="border border-base-content/8 bg-base-100 px-3 py-2 text-xs"
|
||||
>
|
||||
<div className="font-bold text-base-content/55">
|
||||
{resolveMatchTeamName(match, series.teamAIndex)} vs{" "}
|
||||
{resolveMatchTeamName(match, series.teamBIndex)}
|
||||
</div>
|
||||
<div className="mt-1 flex items-center justify-between">
|
||||
<span
|
||||
className={teamIndexColorClasses(series.teamAIndex).text}
|
||||
>
|
||||
{series.teamAWins}
|
||||
</span>
|
||||
<span className="text-base-content/20">:</span>
|
||||
<span
|
||||
className={teamIndexColorClasses(series.teamBIndex).text}
|
||||
>
|
||||
{series.teamBWins}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<div className="mt-5 border border-base-content/8 divide-y divide-base-content/8">
|
||||
{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 = (
|
||||
<>
|
||||
<span className="text-base-content/35 font-bold">
|
||||
{gameNumber}경기
|
||||
</span>
|
||||
{game ? (
|
||||
<div className="min-w-0">
|
||||
<span
|
||||
className={`font-black ${resultSideClass(game.winnerSide)}`}
|
||||
>
|
||||
{resolveMatchTeamName(match, game.winnerTeamIndex)} 승
|
||||
</span>
|
||||
<span className="ml-1 text-base-content/35">
|
||||
({resultSideLabel(game.winnerSide)} 진영)
|
||||
</span>
|
||||
<span className="ml-2 text-base-content/35 font-mono">
|
||||
{game.riotMatchId}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-base-content/25">대기 중</span>
|
||||
)}
|
||||
<span className="text-right text-base-content/35 font-mono">
|
||||
{game ? (
|
||||
<>
|
||||
{formatGameDuration(game.gameDuration)}
|
||||
<span className="ml-2 font-sans font-bold text-primary opacity-0 transition-opacity group-hover:opacity-100">
|
||||
상세
|
||||
</span>
|
||||
</>
|
||||
) : (
|
||||
"-"
|
||||
)}
|
||||
</span>
|
||||
</>
|
||||
);
|
||||
|
||||
if (game) {
|
||||
return (
|
||||
<Link
|
||||
key={gameNumber}
|
||||
to={`/match/${match.id}/game/${gameNumber}`}
|
||||
className={`${rowClass} group transition-colors hover:bg-primary/5`}
|
||||
aria-label={`${gameNumber}경기 상세 보기`}
|
||||
>
|
||||
{content}
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
key={gameNumber}
|
||||
className={rowClass}
|
||||
>
|
||||
{content}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<MatchStandingsSection match={match} />
|
||||
<div className="mt-5">
|
||||
<MatchGameListSection match={match} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
type FinishedResultTab = "standings" | "games" | "teams" | "info";
|
||||
|
||||
function FinishedMatchTabs({ match }: { match: MatchDetailView }) {
|
||||
const [resultTab, setResultTab] = useState<FinishedResultTab>("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 (
|
||||
<div className="mb-6 space-y-4">
|
||||
<div className="flex overflow-x-auto border border-base-content/10 bg-base-100">
|
||||
{tabs.map((item) => (
|
||||
<button
|
||||
key={item.id}
|
||||
type="button"
|
||||
onClick={() => setResultTab(item.id)}
|
||||
className={`min-w-[7.5rem] border-r border-base-content/8 px-4 py-3 text-xs font-black transition-colors last:border-r-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary ${
|
||||
activeTab === item.id
|
||||
? "bg-primary text-primary-content"
|
||||
: "text-base-content/45 hover:bg-base-content/[0.03] hover:text-base-content"
|
||||
}`}
|
||||
>
|
||||
{item.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{activeTab === "standings" && (
|
||||
<div className="border border-base-content/10 bg-base-content/[0.02] p-5">
|
||||
<MatchStandingsSection match={match} />
|
||||
</div>
|
||||
)}
|
||||
{activeTab === "games" && <MatchGameListSection match={match} />}
|
||||
{activeTab === "teams" && (
|
||||
<div className="space-y-4">
|
||||
{match.teams.map((team) => (
|
||||
<TeamCard
|
||||
key={team.teamIndex}
|
||||
team={team}
|
||||
matchId={match.id}
|
||||
isWinner={match.result?.winnerTeamIndex === team.teamIndex}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{activeTab === "info" && (
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
{match.prizes.length > 0 && (
|
||||
<SideCard title="상품">
|
||||
<ul className="space-y-1.5">
|
||||
{match.prizes.map((prize, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className="flex items-start gap-2 text-sm text-base-content/60"
|
||||
>
|
||||
<span className="text-accent shrink-0 text-xs">▸</span>
|
||||
<span>{prize}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</SideCard>
|
||||
)}
|
||||
{match.notices.length > 0 && (
|
||||
<SideCard title="안내사항">
|
||||
<ul className="space-y-1.5">
|
||||
{match.notices.map((notice, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className="flex items-start gap-2 text-sm text-base-content/60"
|
||||
>
|
||||
<span className="text-info shrink-0 font-bold">•</span>
|
||||
<span>{notice}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</SideCard>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function MatchDetailPage() {
|
||||
const { id } = useParams();
|
||||
const navigate = useNavigate();
|
||||
@@ -2537,10 +2644,14 @@ export default function MatchDetailPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<MatchResultPanel match={match} />
|
||||
{match.status === "finished" ? (
|
||||
<FinishedMatchTabs match={match} />
|
||||
) : (
|
||||
<>
|
||||
<MatchResultPanel match={match} />
|
||||
|
||||
<div className="flex flex-col lg:flex-row gap-5">
|
||||
<div className="flex-1 min-w-0 space-y-4">
|
||||
<div className="flex flex-col lg:flex-row gap-5">
|
||||
<div className="flex-1 min-w-0 space-y-4">
|
||||
{match.status === "recruiting" ? (
|
||||
<>
|
||||
<ParticipantTable
|
||||
@@ -3114,8 +3225,10 @@ export default function MatchDetailPage() {
|
||||
</ul>
|
||||
</SideCard>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{replaceCodeSlot && (
|
||||
<div
|
||||
|
||||
Reference in new issue
Block a user