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

+196 -54
View File
@@ -21,6 +21,15 @@ import {
championIconUrl,
profileIconUrl,
} from '../lib/ddragon';
import {
getInternalMatchOutcome,
getMainLane,
LEADERBOARD_MIN_GAMES,
LEADERBOARD_SORTS,
parseLeaderboardSort,
sortLeaderboardRows,
} from '../lib/internal-stats-presentation';
import { LANE_LABELS } from '../lib/riot-history';
import {
internalMatchDetailPath,
internalMatchGamePath,
@@ -41,6 +50,7 @@ import {
LoadingNote,
Panel,
PanelHeader,
Pill,
PlainPage,
Skeleton,
} from '../ui';
@@ -115,12 +125,89 @@ function OfficialMatchResult({
}
}
/** 팀원 프로필을 겹쳐 보여주는 작은 묶음. */
function MemberStack({
members,
manifest,
}: {
members: ApiInternalMatchCard['teams'][number]['members'];
manifest: Manifest;
}) {
if (members.length === 0) return null;
return (
<span className="flex shrink-0 -space-x-1.5" aria-hidden="true">
{members.slice(0, 5).map((member) => (
<img
key={member.userId}
src={profileIconUrl(manifest, member.profileIconId)}
alt=""
title={member.summonerName}
className="size-6 rounded-full bg-sunken-strong object-cover ring-2 ring-card"
loading="lazy"
/>
))}
</span>
);
}
/** 펼치지 않아도 보이는 결과 요약. 목록 응답에 담긴 값만 쓴다. */
function MatchOutcomeSummary({
match,
recordedGameCount,
manifest,
}: {
match: ApiInternalMatchCard;
recordedGameCount: number;
manifest: Manifest;
}) {
const outcome = getInternalMatchOutcome(match);
if (!outcome) {
return (
<span className="flex items-center gap-2">
{match.status === 'in-progress' && (
<Pill tone="live" dot>
진행 중
</Pill>
)}
<span className="tabular">{recordedGameCount}세트 수집</span>
</span>
);
}
if (outcome.type === 'score') {
const { left, right, leftWins, rightWins, winner } = outcome;
const nameClass = (team: typeof left) =>
`min-w-0 truncate ${winner?.teamIndex === team.teamIndex ? 'font-bold text-content' : ''}`;
return (
<span className="flex min-w-0 items-center gap-2">
<span className={nameClass(left)}>{left.name}</span>
<strong className="tabular shrink-0 rounded-full bg-sunken-strong px-2.5 py-0.5 text-content-strong">
{leftWins} : {rightWins}
</strong>
<span className={nameClass(right)}>{right.name}</span>
</span>
);
}
return (
<span className="flex min-w-0 items-center gap-2">
<Pill tone="gold">우승</Pill>
<strong className="min-w-0 truncate font-bold text-content">
{outcome.winner.name}
</strong>
<MemberStack members={outcome.winner.members} manifest={manifest} />
</span>
);
}
function MatchCard({
match,
communityId,
manifest,
}: {
match: ApiInternalMatchCard;
communityId: string;
manifest: Manifest;
}) {
const [open, setOpen] = useState(false);
const competition = useCompetition(match.matchId, communityId, open);
@@ -130,6 +217,10 @@ function MatchCard({
({ winnerTeamIndex }) => winnerTeamIndex !== null,
);
const schedule = getHomeMatchSchedule(match.scheduledAt);
const playerCount = match.teams.reduce(
(count, team) => count + team.members.length,
0,
);
return (
<li>
@@ -137,25 +228,31 @@ function MatchCard({
className="group"
onToggle={(event) => setOpen(event.currentTarget.open)}
>
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,18rem)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
<span className="min-w-0">
<span className="tabular block text-xs text-content-muted">
<time dateTime={match.scheduledAt}>
{schedule?.compact ?? '일정 미정'}
</time>{' '}
· {match.teams.length}팀
{playerCount > 0 && ` · ${playerCount}명`}
{recordedGames.length > 0 && ` · ${recordedGames.length}세트`}
</span>
<strong className="mt-1 block break-words text-base font-semibold leading-snug">
{getHistoryMatchTitle(match.title, schedule)}
</strong>
</span>
<span className="col-start-1 row-start-2 text-sm text-content-muted sm:col-start-2 sm:row-start-1">
<span className="col-start-1 row-start-2 flex min-w-0 text-sm text-content-muted sm:col-start-2 sm:row-start-1 sm:justify-end">
{competition.data ? (
<strong className="font-semibold text-content">
<OfficialMatchResult competition={competition.data} />
</strong>
) : (
`${recordedGames.length}세트 수집`
<MatchOutcomeSummary
match={match}
recordedGameCount={recordedGames.length}
manifest={manifest}
/>
)}
</span>
<ChevronDown
@@ -235,7 +332,7 @@ function HighlightCell({
return (
<div className="min-w-0 px-4 py-3.5 sm:px-5">
<div className="text-xs font-semibold text-content-subtle">{title}</div>
<div className="tabular mt-1 text-[22px] font-extrabold leading-tight text-content">
<div className="tabular mt-1 text-[22px] font-extrabold leading-tight text-content-strong">
{highlight ? `${highlight.metric}${suffix}` : '—'}
</div>
{highlight ? (
@@ -281,7 +378,7 @@ function LeaderboardTable({
</div>
<div className="overflow-x-auto">
<table
className={showMetrics ? 'lts-table min-w-[760px]' : 'lts-table'}
className={showMetrics ? 'lts-table min-w-[820px]' : 'lts-table'}
>
<thead>
<tr>
@@ -289,13 +386,11 @@ function LeaderboardTable({
순위
</th>
<th scope="col">소환사</th>
<th scope="col" className="!text-right">
승률
<th scope="col" className="hidden sm:table-cell">
주 챔피언
</th>
<th scope="col">승률</th>
<th scope="col" className="!text-right">
전적
</th>
<th scope="col" className={`${metricClass} !text-right`}>
KDA
</th>
<th scope="col" className={`${metricClass} !text-right`}>
@@ -307,14 +402,12 @@ function LeaderboardTable({
<th scope="col" className={`${metricClass} !text-right`}>
분당 CS
</th>
<th scope="col" className={metricClass}>
주 챔피언
</th>
</tr>
</thead>
<tbody>
{rows.map((row) => {
const rank = ranks.get(row.userId) ?? 0;
const mainLane = getMainLane(row.byLane);
return (
<tr
key={row.userId}
@@ -326,7 +419,9 @@ function LeaderboardTable({
className={`inline-grid size-6 place-items-center rounded-full text-xs font-extrabold ${
rank === 1
? 'bg-gold text-accent-content'
: 'bg-sunken-strong text-content-muted'
: rank === 2
? 'bg-sunken-strong text-content'
: 'bg-gold-tint text-gold'
}`}
>
{rank}
@@ -338,39 +433,71 @@ function LeaderboardTable({
)}
</td>
<td>
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="group flex items-center gap-2.5"
>
<div className="flex items-center gap-2.5">
<img
src={profileIconUrl(manifest, row.profileIconId)}
alt=""
className="hidden size-8 shrink-0 rounded-full sm:block bg-sunken-strong object-cover"
className="hidden size-9 shrink-0 rounded-full bg-sunken-strong object-cover sm:block"
loading="lazy"
/>
<span className="break-words font-semibold text-content group-hover:text-primary">
{row.summonerName}
<div className="min-w-0">
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="break-words font-semibold text-content hover:text-primary"
>
{row.summonerName}
</Link>
<div className="flex flex-wrap items-center gap-x-1.5 text-xs text-content-muted">
{mainLane && (
<>
<span>{LANE_LABELS[mainLane] ?? mainLane}</span>
<span aria-hidden="true">·</span>
</>
)}
<button
type="button"
className="hover:text-content hover:underline"
onClick={() => onSelectPlayer(row.userId)}
>
참가 내전 보기
</button>
</div>
</div>
</div>
</td>
<td className="hidden sm:table-cell">
<div className="flex gap-1">
{row.topChampions.slice(0, 3).map((champion) => (
<ChampionChip
key={champion.championId}
championId={champion.championId}
manifest={manifest}
/>
))}
</div>
</td>
<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>
</Link>
<button
type="button"
className="mt-1 text-xs text-content-muted hover:underline"
onClick={() => onSelectPlayer(row.userId)}
</div>
<div
className="mt-1 h-1.5 overflow-hidden rounded-full bg-loss/25"
aria-hidden="true"
>
참가 내전
</button>
<div
className="h-full rounded-full bg-win"
style={{ width: `${row.winRate}%` }}
/>
</div>
</td>
<td
className={`tabular text-right font-bold ${ratioClass(row.winRate)}`}
>
{row.winRate}%
</td>
<td className="tabular whitespace-nowrap text-right text-[13px] text-content-muted">
{row.games}전 {row.wins}승 {row.losses}패
</td>
<td
className={`tabular text-right font-semibold ${metricClass} ${kdaClass(row.kda)}`}
className={`tabular text-right font-semibold ${kdaClass(row.kda)}`}
>
{row.kda}
</td>
@@ -389,17 +516,6 @@ function LeaderboardTable({
>
{row.avgCsPerMin}
</td>
<td className={metricClass}>
<div className="flex gap-1">
{row.topChampions.map((champion) => (
<ChampionChip
key={champion.championId}
championId={champion.championId}
manifest={manifest}
/>
))}
</div>
</td>
</tr>
);
})}
@@ -454,6 +570,7 @@ export default function CommunityInternalStatsPage() {
const keyword = query.trim().toLocaleLowerCase('ko-KR');
const format = searchParams.get('format');
const playerId = searchParams.get('player');
const sort = parseLeaderboardSort(searchParams.get('sort'));
const championId = Number(searchParams.get('championId'));
const filters = {
seasonId,
@@ -477,7 +594,10 @@ export default function CommunityInternalStatsPage() {
leaderboardQuery.data?.season ??
matchesQuery.data?.pages[0]?.season;
const insights = insightsQuery.data;
const leaderboardRows = leaderboardQuery.data?.rows ?? [];
const leaderboardRows = sortLeaderboardRows(
leaderboardQuery.data?.rows ?? [],
sort,
);
const player = leaderboardRows.find((row) => row.userId === playerId);
const visibleMatches = matches.filter((match) => {
const matchType = match.teams.length === 2 ? 'pair' : 'tournament';
@@ -537,7 +657,7 @@ export default function CommunityInternalStatsPage() {
</div>
<div className="flex flex-wrap items-center gap-3">
<Link
to="/?history=all"
to="/inhouse"
className="text-sm font-semibold text-content-muted hover:underline"
>
전체 일정 기록
@@ -586,7 +706,7 @@ export default function CommunityInternalStatsPage() {
placeholder={isRanking ? '선수 이름 검색' : '내전명 검색'}
value={query}
onChange={(event) => updateParam('q', event.target.value)}
className="min-w-0 flex-1 text-sm text-content focus-visible:outline-none"
className="min-w-0 flex-1 text-sm text-content placeholder:text-content-subtle focus-visible:outline-none"
/>
</label>
</div>
@@ -600,7 +720,23 @@ export default function CommunityInternalStatsPage() {
</span>
</h2>
{isRanking ? (
<span className="text-xs text-content-muted">승률 순</span>
<div
className="flex flex-wrap items-center gap-1.5"
role="group"
aria-label="순위 정렬"
>
{LEADERBOARD_SORTS.map(({ value, label }) => (
<Chip
key={value}
selected={sort === value}
onClick={() =>
updateParam('sort', value === 'games' ? '' : value)
}
>
{label}
</Chip>
))}
</div>
) : (
<div
className="flex flex-wrap gap-1.5"
@@ -641,6 +777,11 @@ export default function CommunityInternalStatsPage() {
</div>
)}
{isRanking && sort !== 'games' && (
<p className="border-b border-line px-4 py-2 text-xs text-content-muted sm:px-5">
{LEADERBOARD_MIN_GAMES}판 미만인 선수는 뒤에 표시합니다.
</p>
)}
{isRanking ? (
leaderboardQuery.isLoading ? (
<LoadingNote label="순위를 불러오는 중" />
@@ -716,6 +857,7 @@ export default function CommunityInternalStatsPage() {
key={match.matchId}
match={match}
communityId={communityId}
manifest={ddragon}
/>
))}
</ul>
@@ -781,7 +923,7 @@ export default function CommunityInternalStatsPage() {
</div>
</Panel>
{insights && (
<details className="lts-panel">
<details className="lts-panel" open>
<summary className="cursor-pointer px-4 py-3 text-sm font-semibold">
시즌 기록
</summary>