feat: refresh the home page and separate match event types

Add an inhouse hero, Hall of Fame, rankings, and event-specific schedules. Carry the event type through the API and admin tools, and improve results and player history displays.
This commit is contained in:
dahyeon committed 2026-11-10 22:13:55 +09:00
1 parent 7e0cd7cb19
commit 664af15255
58 files changed
+2316 -593

No files matched your search

+279 -122
View File
@@ -1,6 +1,6 @@
import { lazy, Suspense, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { ChevronDown, ChevronUp, RefreshCw, X } from "lucide-react";
import { ArrowDown, ChevronDown, ChevronUp, RefreshCw, X } from "lucide-react";
import { useLocation, useParams, useSearchParams } from "react-router";
import {
Chip,
@@ -51,6 +51,11 @@ import {
QUEUE_GROUP_TABS,
RANK_FILTER_TABS,
} from "../lib/riot-history";
import {
mockLargestMultiKill,
multiKillLabel,
rankPositionRates,
} from "../lib/multi-kill";
import { ResponsiveTierLabel } from "../components/RankBadge";
import {
InternalGameAnalysisPanel,
@@ -73,13 +78,6 @@ type HistoryLocationState = {
backTo?: unknown;
};
const SORT_LABELS: Record<ChampionSortKey, string> = {
games: "게임 수",
winRate: "승률",
kda: "KDA",
avgCsPerMin: "분당 CS",
};
function resolveBackTo(state: unknown) {
if (!state || typeof state !== "object") return "/";
const backTo = (state as HistoryLocationState).backTo;
@@ -168,7 +166,7 @@ function QueueTab({
onClick={onClick}
className={`h-10 flex-none whitespace-nowrap rounded-[10px] px-4 text-sm font-bold transition-colors ${
active
? "bg-secondary text-secondary-content dark:bg-white dark:text-[#14161b]"
? "bg-secondary text-secondary-content"
: "text-content-muted hover:bg-sunken hover:text-content"
}`}
>
@@ -220,7 +218,7 @@ function SummaryCard({
label,
value,
sub,
valueClassName = "text-content",
valueClassName = "text-content-strong",
}: {
label: string;
value: React.ReactNode;
@@ -240,42 +238,80 @@ function SummaryCard({
);
}
function SortableHeader({
sortKey,
activeKey,
onSort,
children,
}: {
sortKey: ChampionSortKey;
activeKey: ChampionSortKey;
onSort: (key: ChampionSortKey) => void;
children: React.ReactNode;
}) {
const active = sortKey === activeKey;
return (
<th scope="col" aria-sort={active ? "descending" : "none"} className="!text-center">
<button
type="button"
onClick={() => onSort(sortKey)}
className={`inline-flex items-center gap-0.5 rounded-field px-1 py-0.5 hover:text-content ${active ? "text-content" : ""}`}
>
{children}
<ArrowDown
className={`size-3 ${active ? "opacity-100" : "opacity-0"}`}
aria-hidden="true"
/>
</button>
</th>
);
}
function ChampionStatsTable({
rows,
manifest,
selectedChampionId,
onChampionSelect,
sortKey,
onSort,
}: {
rows: ApiChampionStatsRow[];
manifest: DdragonManifest | null | undefined;
selectedChampionId?: number;
onChampionSelect: (championId: number | null) => void;
sortKey: ChampionSortKey;
onSort: (key: ChampionSortKey) => void;
}) {
if (rows.length === 0) {
return (
<div className="border border-base-content/10 bg-base-100 px-4 py-10 text-center text-sm text-base-content/35">
<div className="lts-panel px-4 py-10 text-center text-sm text-content-subtle">
조건에 맞는 챔피언 통계가 아직 없습니다.
</div>
);
}
return (
<div className="border border-base-content/10 bg-base-100 overflow-hidden">
<div className="lts-panel overflow-hidden">
<div className="overflow-x-auto">
<table className="w-full text-left min-w-[860px]">
<table className="lts-table min-w-[820px]">
<thead>
<tr className="bg-base-200/50 border-b border-base-content/10 text-xs text-base-content/35 uppercase tracking-wider">
<th className="px-3 py-3">챔피언</th>
<th className="px-3 py-3 text-center">승률</th>
<th className="px-3 py-3 text-center">게임</th>
<th className="px-3 py-3 text-center">승/패</th>
<th className="px-3 py-3 text-center">KDA</th>
<th className="px-3 py-3 text-center">킬</th>
<th className="px-3 py-3 text-center">데스</th>
<th className="px-3 py-3 text-center">어시스트</th>
<th className="px-3 py-3 text-center">멀티킬</th>
<th className="px-3 py-3 text-center">CS</th>
<th className="px-3 py-3 text-center">필터</th>
<tr>
<th scope="col">챔피언</th>
<SortableHeader sortKey="winRate" activeKey={sortKey} onSort={onSort}>
승률
</SortableHeader>
<SortableHeader sortKey="games" activeKey={sortKey} onSort={onSort}>
게임
</SortableHeader>
<SortableHeader sortKey="kda" activeKey={sortKey} onSort={onSort}>
KDA
</SortableHeader>
<th scope="col" className="!text-center">평균 K / D / A</th>
<th scope="col" className="!text-center">멀티킬</th>
<SortableHeader sortKey="avgCsPerMin" activeKey={sortKey} onSort={onSort}>
CS
</SortableHeader>
<th scope="col" className="!text-right">매치</th>
</tr>
</thead>
<tbody>
@@ -284,69 +320,83 @@ function ChampionStatsTable({
championDisplayName(manifest, row.championId) ??
String(row.championId);
const selected = selectedChampionId === row.championId;
const multiKills = [
["더블", row.doubleKills],
["트리플", row.tripleKills],
["쿼드라", row.quadraKills],
["펜타", row.pentaKills],
].filter(([, count]) => Number(count) > 0);
return (
<tr
key={row.championId}
className="border-b border-base-content/5 last:border-b-0 hover:bg-base-content/[0.02]"
className={`transition-colors hover:bg-sunken ${selected ? "bg-primary-tint/40" : ""}`}
>
<td className="px-3 py-3">
<td>
<div className="flex items-center gap-2">
<ChampionIcon
championId={row.championId}
manifest={manifest}
className="rounded-full"
/>
<span className="text-sm font-bold text-base-content">
<span className="font-bold text-content">
{displayName}
</span>
</div>
</td>
<td
className={`px-3 py-3 text-center text-sm font-bold ${ratioClass(row.winRate)}`}
>
{row.winRate}%
<td className="tabular w-36">
<div className="flex items-baseline justify-between gap-2">
<strong className={ratioClass(row.winRate)}>
{row.winRate}%
</strong>
<span className="whitespace-nowrap text-xs text-content-muted">
{row.wins}승 {row.losses}패
</span>
</div>
<div
className="mt-1 h-1.5 overflow-hidden rounded-full bg-loss/25"
aria-hidden="true"
>
<div
className="h-full rounded-full bg-win"
style={{ width: `${row.winRate}%` }}
/>
</div>
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
<td className="tabular text-center text-[13px]">
{row.games}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums text-base-content/55">
<span className="text-win">{row.wins}</span> /{" "}
<span className="text-loss">{row.losses}</span>
</td>
<td
className={`px-3 py-3 text-center text-sm font-bold tabular-nums ${kdaClass(row.kda)}`}
className={`tabular text-center font-bold ${kdaClass(row.kda)}`}
>
{row.kda}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.totalKills}
<td className="tabular whitespace-nowrap text-center text-[13px] text-content-muted">
{row.avgKills} /{" "}
<span className="text-loss">{row.avgDeaths}</span> /{" "}
{row.avgAssists}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.totalDeaths}
<td className="tabular text-center text-xs text-content-muted">
{multiKills.length > 0
? multiKills
.map(([label, count]) => `${label} ${count}`)
.join(" · ")
: "—"}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.totalAssists}
<td className="tabular whitespace-nowrap text-center text-[13px]">
{row.avgCs}{" "}
<span className="text-content-muted">
({row.avgCsPerMin}/분)
</span>
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums text-base-content/55">
{row.doubleKills}/{row.tripleKills}/{row.quadraKills}/
{row.pentaKills}
</td>
<td className="px-3 py-3 text-center text-xs tabular-nums">
{row.avgCs} · {row.avgCsPerMin}/m
</td>
<td className="px-3 py-3 text-center">
<button
type="button"
className={`text-xs px-2 py-1 border ${
selected
? "border-primary/40 bg-primary/10 text-primary"
: "border-base-content/10 text-base-content/40 hover:text-base-content"
}`}
<td className="text-right">
<Chip
selected={selected}
onClick={() =>
onChampionSelect(selected ? null : row.championId)
}
>
{selected ? "해제" : "보기"}
</button>
</Chip>
</td>
</tr>
);
@@ -817,6 +867,43 @@ function MatchDetailTabs({
);
}
/** 접힌 행에서 양 팀 10명을 챔피언과 이름으로 훑어보게 한다. */
function MatchRoster({
teams,
manifest,
ownerParticipantId,
}: {
teams: ApiRecentMatchTeam[];
manifest: DdragonManifest | null | undefined;
ownerParticipantId: string;
}) {
if (teams.length === 0) return null;
return (
<div className="hidden w-44 shrink-0 grid-cols-2 gap-x-2 text-[11px] leading-4 lg:grid xl:w-52">
{teams.map((team) => (
<ul key={team.side} className="min-w-0 space-y-0.5">
{team.participants.map((participant) => (
<li key={participant.puuid} className="flex min-w-0 items-center gap-1">
<ChampionIcon championId={participant.championId} manifest={manifest} size="xs" className="rounded-sm" />
<span
className={`truncate ${
participant.puuid === ownerParticipantId
? "font-bold text-content"
: "text-content-muted"
}`}
title={participant.gameName}
>
{participant.gameName}
</span>
</li>
))}
</ul>
))}
</div>
);
}
function RecentMatchCard({
match,
manifest,
@@ -827,13 +914,21 @@ function RecentMatchCard({
ownerParticipantId: string;
}) {
const [expanded, setExpanded] = useState(false);
// 응답에 값이 없을 때 개발 화면에서만 목업으로 배지 모양을 확인한다.
const isMockMultiKill =
match.largestMultiKill === undefined && import.meta.env.DEV;
const multiKill = multiKillLabel(
isMockMultiKill
? mockLargestMultiKill(match.kills)
: match.largestMultiKill,
);
const championName =
championDisplayName(manifest, match.championId) ?? String(match.championId);
const outcome = match.remake ? "remake" : match.win ? "win" : "loss";
const surface = {
win: "border-win-line bg-win-tint",
loss: "border-loss-line bg-loss-tint",
remake: "border-line bg-card",
win: "bg-win-tint",
loss: "bg-loss-tint",
remake: "bg-card",
}[outcome];
const bar = { win: "bg-win", loss: "bg-loss", remake: "bg-content-disabled" }[outcome];
const resultClass = {
@@ -843,15 +938,17 @@ function RecentMatchCard({
}[outcome];
return (
<article className={`relative overflow-hidden rounded-box border ${surface}`}>
<article className={`relative overflow-hidden rounded-box border border-line ${surface}`}>
<span aria-hidden="true" className={`absolute inset-y-0 left-0 w-1 ${bar}`} />
<div className="grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 py-3 pl-4 pr-2 sm:grid-cols-[minmax(0,1fr)_auto_auto] sm:gap-x-5 sm:px-5">
<div className="col-span-2 flex flex-wrap items-baseline gap-x-2 text-xs text-content-muted sm:col-span-3">
<strong className={`text-sm ${resultClass}`}>{match.remake ? "다시하기" : match.win ? "승리" : "패배"}</strong>
<span>{formatDate(match.gameCreation)} · {match.queueLabel}</span>
<div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2.5 py-3 pl-4 pr-2 sm:pl-5 sm:pr-3 xl:gap-x-5">
<div className="w-full shrink-0 text-xs text-content-muted sm:w-[5.5rem]">
<strong className={`block text-sm ${resultClass}`}>{match.remake ? "다시하기" : match.win ? "승리" : "패배"}</strong>
<span className="tabular sm:block">{match.queueLabel} · {formatDuration(match.gameDuration)}</span>
<span className="ml-1.5 sm:ml-0 sm:block">{formatDate(match.gameCreation)}</span>
</div>
<div className="flex min-w-0 items-center gap-2">
<ChampionIcon championId={match.championId} manifest={manifest} />
<div className="flex min-w-0 flex-1 items-center gap-2 sm:w-40 sm:flex-none xl:w-44">
<ChampionIcon championId={match.championId} manifest={manifest} size="lg" className="rounded-xl" />
<LoadoutIcons summonerSpells={match.summonerSpells} perks={match.perks} manifest={manifest} />
<div className="min-w-0">
<div className="truncate font-bold text-content" title={championName}>{championName}</div>
<div className="text-xs text-content-muted">
@@ -859,29 +956,46 @@ function RecentMatchCard({
</div>
</div>
</div>
<div className="tabular whitespace-nowrap text-right">
<strong className="text-sm sm:text-base">{match.kills} / {match.deaths} / {match.assists}</strong>
<div className="text-xs text-content-muted">{match.deaths === 0 ? "Perfect" : `${match.kda} KDA`}</div>
<div className="tabular w-24 shrink-0 whitespace-nowrap text-right sm:text-center">
<strong className="text-sm text-content-strong sm:text-base">
{match.kills} / <span className="text-loss">{match.deaths}</span> / {match.assists}
</strong>
<div className={`text-xs font-semibold ${kdaClass(match.kda)}`}>{match.deaths === 0 ? "Perfect" : `${match.kda} KDA`}</div>
{multiKill && (
<span
className="mt-1 inline-flex h-5 items-center rounded-full border border-leaf px-2 text-[11px] font-semibold text-leaf"
title={isMockMultiKill ? "목업 데이터 (API 미지원)" : undefined}
>
{multiKill}
</span>
)}
</div>
<dl className="tabular hidden w-28 shrink-0 text-xs text-content-muted md:block">
<div>킬 관여 <span className="font-semibold text-content">{match.killParticipation}%</span></div>
<div>CS {match.totalCs} ({match.csPerMin}/분)</div>
<div>시야 {match.visionScore}</div>
</dl>
<div className="shrink-0">
<ItemGrid items={match.items} trinket={match.trinket} manifest={manifest} itemKey={match.matchId} />
</div>
<MatchRoster teams={match.teams} manifest={manifest} ownerParticipantId={ownerParticipantId} />
<button
type="button"
onClick={() => setExpanded((current) => !current)}
className="col-span-2 flex min-h-9 items-center justify-end gap-1 rounded-field px-2 text-xs font-semibold text-content-muted hover:text-content focus-visible:-outline-offset-2 sm:col-span-1"
className="ml-auto flex min-h-9 shrink-0 items-center gap-1 rounded-field px-2 text-xs font-semibold text-content-muted hover:text-content focus-visible:-outline-offset-2"
aria-expanded={expanded}
aria-label={expanded ? "상세 전적 접기" : "상세 전적 펼치기"}
>
{expanded ? "상세 접기" : "상세 보기"}
<span className="lg:sr-only">{expanded ? "상세 접기" : "상세 보기"}</span>
{expanded ? <ChevronUp className="size-4" aria-hidden="true" /> : <ChevronDown className="size-4" aria-hidden="true" />}
</button>
</div>
{expanded && (
<div className="border-t border-line bg-card">
<div className="flex flex-wrap items-center gap-x-4 gap-y-2 border-b border-line px-4 py-3 text-xs text-content-muted">
<LoadoutIcons summonerSpells={match.summonerSpells} perks={match.perks} manifest={manifest} />
<span>Lv.{match.championLevel} · {formatDuration(match.gameDuration)}</span>
<span>킬 관여 {match.killParticipation}%</span>
<span>CS {match.totalCs} ({match.csPerMin}/분)</span>
<span>시야 {match.visionScore} · 제어와드 {match.controlWardsBought}</span>
<span>Lv.{match.championLevel}</span>
<span>제어와드 {match.controlWardsBought}</span>
<span>와드 설치 {match.wardsPlaced} · 제거 {match.wardsKilled}</span>
<span>챔피언 피해량 {match.damageDealtToChampions.toLocaleString()}</span>
</div>
<MatchDetailTabs match={match} manifest={manifest} ownerParticipantId={ownerParticipantId} />
@@ -1044,6 +1158,8 @@ export default function UserHistoryPage() {
? (championDisplayName(ddragon, championId) ?? String(championId))
: null;
const positionRates = rankPositionRates(summary?.positionRates ?? {});
const visibleChampionRows = (() => {
const rows = isInternalQueue
? (internalFirstPage?.championStats.champions ?? [])
@@ -1175,7 +1291,7 @@ export default function UserHistoryPage() {
title="소환사를 찾을 수 없습니다"
description="계정 연결이 해제됐거나 잘못된 주소일 수 있습니다."
action={
<Btn to="/" variant="secondary">
<Btn to="/inhouse" variant="secondary">
내전 목록으로
</Btn>
}
@@ -1198,9 +1314,9 @@ export default function UserHistoryPage() {
<img
src={profileIconUrl(ddragon, profile.profileIconId)}
alt=""
className="size-[72px] rounded-2xl bg-ink-raised object-cover ring-2 ring-white/15 sm:size-[88px]"
className="size-[72px] rounded-2xl bg-ink-raised object-cover ring-2 ring-ink-line sm:size-[88px]"
/>
<span className="tabular absolute -bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-ink-raised px-2 py-0.5 text-[11px] font-bold text-on-ink ring-1 ring-white/20">
<span className="tabular absolute -bottom-2 left-1/2 -translate-x-1/2 rounded-full bg-ink-raised px-2 py-0.5 text-[11px] font-bold text-on-ink ring-1 ring-ink-line">
{profile.summonerLevel}
</span>
</div>
@@ -1252,7 +1368,7 @@ export default function UserHistoryPage() {
</div>
))}
<div className="lts-panel sticky top-(--app-header-height) z-30 p-1">
<div className="lts-panel sticky top-(--app-header-nav-height) z-30 p-1">
<div
className="no-scrollbar flex gap-1 overflow-x-auto"
role="tablist"
@@ -1338,7 +1454,7 @@ export default function UserHistoryPage() {
: undefined
}
/>
<div className="grid grid-cols-2 divide-line max-lg:[&>*:nth-child(n+3)]:border-t max-lg:[&>*:nth-child(even)]:border-l lg:grid-cols-[repeat(4,minmax(0,1fr))_minmax(0,1.5fr)] lg:divide-x">
<div className="grid grid-cols-2 divide-line max-lg:[&>*:nth-child(n+3)]:border-t max-lg:[&>*:nth-child(even)]:border-l lg:grid-cols-5 lg:divide-x">
<SummaryCard
label="승률"
value={summary ? `${summary.winRate}%` : "—"}
@@ -1353,7 +1469,13 @@ export default function UserHistoryPage() {
/>
<SummaryCard
label="최고 평점"
value={summary?.bestRating?.rating ?? "—"}
value={
summary?.bestRating
? summary.bestRating.rating === "Perfect"
? "노데스"
: summary.bestRating.rating
: "—"
}
sub={
summary?.bestRating
? `${summary.bestRating.kills}/${summary.bestRating.deaths}/${summary.bestRating.assists}`
@@ -1376,33 +1498,79 @@ export default function UserHistoryPage() {
}
sub="가장 최근 경기 기준"
/>
<div className="col-span-2 px-4 py-3.5 sm:px-5 lg:col-span-1">
<div className="px-4 py-3.5 max-lg:col-span-2 sm:px-5">
<div className="text-xs font-semibold text-content-subtle">
선호 포지션
</div>
{positionRates.length > 0 ? (
<ul className="mt-2 space-y-1.5">
{positionRates.map(({ lane, rate }) => (
<li key={lane} className="tabular text-xs">
<div className="flex justify-between gap-2">
<span className="font-semibold text-content">
{LANE_LABELS[lane] ?? lane}
</span>
<span className="text-content-muted">{rate}%</span>
</div>
<div
className="mt-0.5 h-1.5 overflow-hidden rounded-full bg-sunken-strong"
aria-hidden="true"
>
<div
className="h-full rounded-full bg-primary"
style={{ width: `${Math.min(100, rate)}%` }}
/>
</div>
</li>
))}
</ul>
) : (
<div className="mt-2 text-xs text-content-subtle">기록 없음</div>
)}
</div>
<div className="col-span-2 border-t border-line px-4 py-3.5 max-lg:!border-l-0 sm:px-5 lg:col-span-5 lg:!border-l-0">
<div className="text-xs font-semibold text-content-subtle">
자주 플레이한 챔피언
</div>
<div className="mt-2 flex items-center gap-4">
{(summary?.topChampions ?? []).map((champion) => (
<button
type="button"
key={champion.championId}
className="group flex items-center gap-2 text-left"
aria-label={`${championDisplayName(ddragon, champion.championId) ?? champion.championId} 경기만 보기`}
onClick={() =>
updateSearch({ championId: champion.championId })
}
>
<ChampionIcon
championId={champion.championId}
manifest={ddragon}
className="rounded-full ring-2 ring-transparent transition-shadow group-hover:ring-primary"
/>
<span
className={`tabular text-sm font-bold ${ratioClass(champion.winRate)}`}
<div className="mt-2 flex flex-wrap items-center gap-x-8 gap-y-3">
{(summary?.topChampions ?? []).map((champion) => {
const wins = Math.round(
(champion.games * champion.winRate) / 100,
);
return (
<button
type="button"
key={champion.championId}
className="group flex items-center gap-2.5 text-left"
aria-label={`${championDisplayName(ddragon, champion.championId) ?? champion.championId} 경기만 보기`}
onClick={() =>
updateSearch({ championId: champion.championId })
}
>
{champion.winRate}%
</span>
</button>
))}
<ChampionIcon
championId={champion.championId}
manifest={ddragon}
size="lg"
className="rounded-full ring-2 ring-transparent transition-shadow group-hover:ring-primary"
/>
<span className="tabular">
<span
className={`block text-sm font-bold ${ratioClass(champion.winRate)}`}
>
{champion.winRate}%
<span className="ml-1.5 text-xs font-medium text-content-muted">
{wins}승 {champion.games - wins}패
</span>
</span>
<span className="block text-xs text-content-muted">
{championDisplayName(ddragon, champion.championId) ??
champion.championId}{" "}
· 평점 {champion.avgRating}
</span>
</span>
</button>
);
})}
{(summary?.topChampions ?? []).length === 0 && (
<span className="text-xs text-content-subtle">기록 없음</span>
)}
@@ -1463,19 +1631,6 @@ export default function UserHistoryPage() {
placeholder="챔피언 검색"
className="lts-input"
/>
<select
value={sortKey}
onChange={(event) =>
setSortKey(event.target.value as ChampionSortKey)
}
className="lts-select"
>
{(Object.keys(SORT_LABELS) as ChampionSortKey[]).map((key) => (
<option key={key} value={key}>
{SORT_LABELS[key]}순
</option>
))}
</select>
</div>
</div>
<ChampionStatsTable
@@ -1485,6 +1640,8 @@ export default function UserHistoryPage() {
onChampionSelect={(nextChampionId) =>
updateSearch({ championId: nextChampionId })
}
sortKey={sortKey}
onSort={setSortKey}
/>
</section>