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:
1 parent
7e0cd7cb19
commit
664af15255
58 files changed
+2316
-593
No files matched your search
@@ -456,7 +456,7 @@ function AuctionTimerText({
|
||||
|
||||
return (
|
||||
<span
|
||||
className={`text-xl font-extrabold tabular-nums ${timer <= 5 ? "text-[#ff99a5]" : "text-on-ink"}`}
|
||||
className={`text-xl font-extrabold tabular-nums ${timer <= 5 ? "text-loss" : "text-on-ink"}`}
|
||||
>
|
||||
{timer.toFixed(1)}s
|
||||
</span>
|
||||
@@ -2547,8 +2547,8 @@ export default function AuctionPage() {
|
||||
</header>
|
||||
{teamGrid}
|
||||
</section>
|
||||
{poolPanel}
|
||||
{chatPanel}
|
||||
{poolPanel}
|
||||
</div>
|
||||
) : chatPanel}
|
||||
</div>
|
||||
|
||||
@@ -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>
|
||||
|
||||
+492
-146
@@ -1,11 +1,23 @@
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState, type CSSProperties } from 'react';
|
||||
import type {
|
||||
MatchDetailResponse,
|
||||
MatchEventType,
|
||||
MatchSummaryResponse,
|
||||
} from '@lolympus/contracts';
|
||||
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
||||
import { Link, useSearchParams } from 'react-router';
|
||||
import { useMatches, useMatchesPage } from '../api/hooks';
|
||||
import {
|
||||
useCommunityLeaderboard,
|
||||
useDdragonManifest,
|
||||
useMatches,
|
||||
useMatchesPage,
|
||||
} from '../api/hooks';
|
||||
import nextMatchArtwork from '../assets/next-match-hero.webp';
|
||||
import HomeHallOfFame from '../components/HomeHallOfFame';
|
||||
import { championIconUrl, profileIconUrl } from '../lib/ddragon';
|
||||
import { rankLeaderboardByLane } from '../lib/internal-stats-presentation';
|
||||
import { MATCH_EVENT_LABEL } from '../lib/match-event-type';
|
||||
import { LANE_LABELS } from '../lib/riot-history';
|
||||
import { mapIdToLabel } from '../api/mappers';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import {
|
||||
@@ -17,18 +29,34 @@ import {
|
||||
Pill,
|
||||
PlainPage,
|
||||
Skeleton,
|
||||
pageWidthClass,
|
||||
} from '../ui';
|
||||
import {
|
||||
getHistoryMatchTitle,
|
||||
getHomeMatchEnrollment,
|
||||
getHomeMatchSchedule,
|
||||
getNextMatchBanner,
|
||||
HOME_MATCH_STATUS,
|
||||
} from './home-match-presentation';
|
||||
|
||||
const UPCOMING_MATCH_LIST_LIMIT = 4;
|
||||
const HISTORY_MATCH_PAGE_SIZE = 10;
|
||||
const HOME_HISTORY_LIMIT = 5;
|
||||
const HOME_HISTORY_LIMIT = 4;
|
||||
const HOME_RANKING_LIMIT = 5;
|
||||
const DEFAULT_MAP_ID = 11;
|
||||
const RANKING_COLUMNS_CLASS =
|
||||
'grid grid-cols-[1.5rem_minmax(0,1fr)_3rem] items-center gap-3 px-3';
|
||||
/** 순위 카드의 슬라이드 순서. undefined는 종합 순위. */
|
||||
const RANKING_SLIDES = [
|
||||
undefined,
|
||||
'TOP',
|
||||
'JUNGLE',
|
||||
'MIDDLE',
|
||||
'BOTTOM',
|
||||
'UTILITY',
|
||||
] as const;
|
||||
const RANKING_SLIDE_INTERVAL_MS = 5000;
|
||||
const GENERIC_MATCH_NAME = /^(?:정기\s*)?내전$/u;
|
||||
|
||||
const DECISION_LABELS = {
|
||||
walkover: '부전승',
|
||||
@@ -37,70 +65,75 @@ const DECISION_LABELS = {
|
||||
draw: '무승부',
|
||||
} as const;
|
||||
|
||||
function NextMatch({ match }: { match?: MatchDetailResponse }) {
|
||||
if (!match) {
|
||||
return (
|
||||
<h1 className="text-sm font-medium text-content-muted">
|
||||
예정된 내전이 없습니다
|
||||
</h1>
|
||||
);
|
||||
}
|
||||
|
||||
function NextMatch({ match }: { match: MatchDetailResponse }) {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
const enrollment = getHomeMatchEnrollment(match);
|
||||
const href = `/match/${match._id}`;
|
||||
const { title, status, capacity, canApply } = getNextMatchBanner(match);
|
||||
|
||||
return (
|
||||
<header className="flex flex-col gap-3 rounded-xl border border-line bg-card p-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6 sm:p-5">
|
||||
<div className="min-w-0">
|
||||
<p className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-sm text-content-muted">
|
||||
<span className="font-semibold">다음 내전</span>
|
||||
{schedule && (
|
||||
<time
|
||||
dateTime={match.scheduledAt}
|
||||
className="tabular font-semibold text-content"
|
||||
>
|
||||
{schedule.date} · {schedule.time}
|
||||
</time>
|
||||
)}
|
||||
</p>
|
||||
<h1 className="mt-1 break-words text-xl font-bold leading-snug sm:text-2xl">
|
||||
{match.title}
|
||||
</h1>
|
||||
<p className="tabular mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-0.5 text-sm text-content-muted">
|
||||
{match.status !== 'recruiting' && (
|
||||
<span>{HOME_MATCH_STATUS[match.status]} ·</span>
|
||||
)}
|
||||
<span>{enrollment.capacity} ·</span>
|
||||
<strong className="font-semibold text-content">
|
||||
{enrollment.label}
|
||||
</strong>
|
||||
{match.mapId !== DEFAULT_MAP_ID && (
|
||||
<span>· {mapIdToLabel(match.mapId)}</span>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
{enrollment.canApply ? (
|
||||
<div className="shrink-0">
|
||||
<Button label="참가 신청" variant="primary" size="md" href={href} />
|
||||
<Link
|
||||
to={`/match/${match._id}`}
|
||||
aria-labelledby="next-match-label next-match-title"
|
||||
aria-describedby="next-match-schedule next-match-status"
|
||||
className="lts-home-hero group relative isolate block overflow-hidden focus-visible:-outline-offset-4 focus-visible:outline-primary"
|
||||
>
|
||||
<img
|
||||
src={nextMatchArtwork}
|
||||
alt=""
|
||||
fetchPriority="high"
|
||||
className="absolute inset-y-0 left-1/2 -z-20 h-full w-full max-w-[112rem] -translate-x-1/2 object-cover object-[75%_center] md:object-center"
|
||||
/>
|
||||
<div
|
||||
className={`${pageWidthClass()} flex min-h-[16rem] items-center py-8 md:min-h-[clamp(22rem,29vw,30rem)] md:py-12`}
|
||||
>
|
||||
<div className="w-full max-w-xl">
|
||||
<p
|
||||
id="next-match-label"
|
||||
className="text-sm font-semibold text-white/80 md:text-base"
|
||||
>
|
||||
다음 내전
|
||||
</p>
|
||||
<h1
|
||||
id="next-match-title"
|
||||
className="mt-3 text-[clamp(2rem,5vw,3.5rem)] font-extrabold leading-[1.15] tracking-tight text-white [overflow-wrap:anywhere] group-hover:underline group-hover:decoration-2 group-hover:underline-offset-8"
|
||||
>
|
||||
{title}
|
||||
</h1>
|
||||
<p
|
||||
id="next-match-schedule"
|
||||
className="tabular mt-4 text-base font-semibold text-white/90 md:mt-6 md:text-xl"
|
||||
>
|
||||
{schedule ? (
|
||||
<time dateTime={match.scheduledAt}>
|
||||
{schedule.date} {schedule.time}
|
||||
</time>
|
||||
) : '일정 미정'}
|
||||
</p>
|
||||
<p id="next-match-status" className="tabular mt-3 text-sm text-white/85 md:text-base">
|
||||
<strong className={canApply ? 'font-semibold text-brand-coral' : 'font-semibold'}>
|
||||
{status}
|
||||
</strong>
|
||||
{' · '}
|
||||
{capacity}
|
||||
{match.mapId !== DEFAULT_MAP_ID && (
|
||||
<> · {mapIdToLabel(match.mapId)}</>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
to={href}
|
||||
className="inline-flex min-h-10 w-fit shrink-0 items-center gap-1 text-sm font-semibold text-content hover:underline"
|
||||
>
|
||||
내전 보기
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
)}
|
||||
</header>
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
|
||||
function UpcomingMatches({
|
||||
matches,
|
||||
title = '이어지는 내전',
|
||||
}: {
|
||||
matches: MatchDetailResponse[];
|
||||
title?: string;
|
||||
}) {
|
||||
return (
|
||||
<Panel>
|
||||
<PanelHeader title="이어지는 내전" />
|
||||
<PanelHeader title={title} />
|
||||
<ul className="divide-y divide-line">
|
||||
{matches.map((match) => {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
@@ -117,7 +150,7 @@ function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
|
||||
>
|
||||
{schedule?.compact ?? '일정 미정'}
|
||||
</time>
|
||||
<h3 className="col-start-1 mt-0.5 truncate text-[15px] font-semibold text-content group-hover:underline sm:col-start-2 sm:row-start-1 sm:mt-0">
|
||||
<h3 className="col-start-1 mt-0.5 truncate text-[15px] font-semibold group-hover:underline sm:col-start-2 sm:row-start-1 sm:mt-0">
|
||||
{match.title}
|
||||
</h3>
|
||||
<p className="tabular col-start-1 mt-1 text-[13px] text-content-muted sm:col-start-3 sm:row-start-1 sm:mt-0">
|
||||
@@ -139,11 +172,29 @@ function UpcomingMatches({ matches }: { matches: MatchDetailResponse[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
function HistoryResult({ match }: { match: MatchSummaryResponse }) {
|
||||
function HistoryResult({
|
||||
match,
|
||||
showTeamNames = false,
|
||||
}: {
|
||||
match: MatchSummaryResponse;
|
||||
showTeamNames?: boolean;
|
||||
}) {
|
||||
const result = match.historyResult;
|
||||
const teamLabelClass = `min-w-0 break-words text-content-muted${showTeamNames ? '' : ' md:truncate'}`;
|
||||
if (match.status === 'finished' && result) {
|
||||
switch (result.type) {
|
||||
case 'score': {
|
||||
if (showTeamNames && result.teamAName && result.teamBName) {
|
||||
return (
|
||||
<span className="break-words text-content">
|
||||
{result.teamAName}{' '}
|
||||
<strong className="tabular whitespace-nowrap font-bold">
|
||||
{result.teamAWins}–{result.teamBWins}
|
||||
</strong>{' '}
|
||||
{result.teamBName}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
const label = result.winnerTeamName
|
||||
? `${result.winnerTeamName} 승`
|
||||
: undefined;
|
||||
@@ -154,7 +205,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
|
||||
</strong>
|
||||
{label && (
|
||||
<span
|
||||
className="min-w-0 break-words text-content-muted md:truncate"
|
||||
className={teamLabelClass}
|
||||
title={label}
|
||||
>
|
||||
{label}
|
||||
@@ -171,7 +222,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
|
||||
{result.teamNames.length > 1 ? '공동 1위' : '우승'}
|
||||
</strong>
|
||||
<span
|
||||
className="min-w-0 break-words text-content-muted md:truncate"
|
||||
className={teamLabelClass}
|
||||
title={label}
|
||||
>
|
||||
{label}
|
||||
@@ -187,7 +238,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
|
||||
</strong>
|
||||
{result.winnerTeamName && (
|
||||
<span
|
||||
className="min-w-0 break-words text-content-muted md:truncate"
|
||||
className={teamLabelClass}
|
||||
title={result.winnerTeamName}
|
||||
>
|
||||
{result.winnerTeamName}
|
||||
@@ -227,8 +278,8 @@ function HistoryTableColumns() {
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">일정</th>
|
||||
<th scope="col">내전</th>
|
||||
<th scope="col">결과</th>
|
||||
<th scope="col">대회</th>
|
||||
<th scope="col">상태·결과</th>
|
||||
<th scope="col" className="!text-right">
|
||||
참가
|
||||
</th>
|
||||
@@ -277,9 +328,15 @@ function HistoryRecordsSkeleton({ limit }: { limit: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function HistoryRecords({ matches }: { matches: MatchSummaryResponse[] }) {
|
||||
function HistoryRecords({
|
||||
matches,
|
||||
eventLabel,
|
||||
}: {
|
||||
matches: MatchSummaryResponse[];
|
||||
eventLabel: string;
|
||||
}) {
|
||||
if (matches.length === 0) {
|
||||
return <EmptyNote size="sm" title="아직 내전 기록이 없습니다." />;
|
||||
return <EmptyNote size="sm" title={`아직 ${eventLabel} 기록이 없습니다.`} />;
|
||||
}
|
||||
|
||||
const rows = matches.map((match) => {
|
||||
@@ -352,6 +409,261 @@ function HistoryRecords({ matches }: { matches: MatchSummaryResponse[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
function RecentMatchResults({ matches }: { matches: MatchSummaryResponse[] }) {
|
||||
if (matches.length === 0) {
|
||||
return <EmptyNote size="sm" title="아직 종료된 내전이 없습니다." />;
|
||||
}
|
||||
|
||||
return (
|
||||
<ul className="divide-y divide-line border-y border-line">
|
||||
{matches.map((match) => {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
const name = getHistoryMatchTitle(match.title, schedule);
|
||||
// 이름이 "내전"뿐이면 행을 구분할 수 없으므로 일정을 제목으로 올린다.
|
||||
const datedTitle = schedule && GENERIC_MATCH_NAME.test(name.trim());
|
||||
const details = [
|
||||
!datedTitle && (schedule?.compact ?? '일정 미정'),
|
||||
match.teams.length > 2 && `${match.teams.length}팀`,
|
||||
match.mapId !== DEFAULT_MAP_ID && mapIdToLabel(match.mapId),
|
||||
].filter(Boolean);
|
||||
return (
|
||||
<li key={match._id}>
|
||||
<Link
|
||||
to={`/match/${match._id}`}
|
||||
className="group grid gap-1 px-2 py-3.5 transition-colors hover:bg-sunken focus-visible:-outline-offset-2 md:grid-cols-[minmax(0,1fr)_auto] md:items-center md:gap-4"
|
||||
>
|
||||
<div className="min-w-0">
|
||||
<p className="tabular break-words text-[15px] font-semibold leading-snug text-content group-hover:underline">
|
||||
{datedTitle ? (
|
||||
<>
|
||||
<time dateTime={match.scheduledAt}>{schedule.compact}</time>{' '}
|
||||
{name}
|
||||
</>
|
||||
) : (
|
||||
name
|
||||
)}
|
||||
</p>
|
||||
{details.length > 0 && (
|
||||
<p className="tabular mt-0.5 text-xs text-content-muted">
|
||||
{details.join(' · ')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
{match.historyResult && (
|
||||
<div className="min-w-0 text-[13px] md:text-right">
|
||||
<HistoryResult match={match} showTeamNames />
|
||||
</div>
|
||||
)}
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
|
||||
function RecentMatchResultsSkeleton({ limit }: { limit: number }) {
|
||||
return (
|
||||
<div className="divide-y divide-line border-y border-line" aria-hidden="true">
|
||||
{Array.from({ length: limit }, (_, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="grid gap-2 px-2 py-3.5 md:grid-cols-2 md:items-center"
|
||||
>
|
||||
<div className="space-y-1">
|
||||
<Skeleton width={130} height={16} index={index} />
|
||||
<Skeleton width={96} height={12} index={index} />
|
||||
</div>
|
||||
<Skeleton width={120} height={14} index={index} className="md:justify-self-end" />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const RANK_BADGE_CLASS = [
|
||||
'bg-gold text-accent-content',
|
||||
'bg-sunken-strong text-content',
|
||||
'bg-gold-tint text-gold',
|
||||
] as const;
|
||||
|
||||
/** 현재 시즌 순위표의 앞부분. 전적 화면과 같은 집계를 그대로 보여준다. */
|
||||
function RankingPreview({ statsPath }: { statsPath: string }) {
|
||||
const leaderboardQuery = useCommunityLeaderboard({ seasonId: 'current' });
|
||||
const { data: manifest } = useDdragonManifest();
|
||||
const [slide, setSlide] = useState(0);
|
||||
const [direction, setDirection] = useState<1 | -1>(1);
|
||||
const [paused, setPaused] = useState(false);
|
||||
const [touchStartX, setTouchStartX] = useState<number>();
|
||||
const lane = RANKING_SLIDES[slide];
|
||||
const allRows = leaderboardQuery.data?.rows ?? [];
|
||||
const rows = (lane ? rankLeaderboardByLane(allRows, lane) : allRows).slice(
|
||||
0,
|
||||
HOME_RANKING_LIMIT,
|
||||
);
|
||||
const label = lane ? LANE_LABELS[lane] : '종합';
|
||||
const move = (step: 1 | -1) => {
|
||||
setDirection(step);
|
||||
setSlide(
|
||||
(current) => (current + step + RANKING_SLIDES.length) % RANKING_SLIDES.length,
|
||||
);
|
||||
};
|
||||
// key가 바뀌면 목록이 새로 붙으면서 넘긴 방향에서 들어오는 애니메이션이 다시 돈다.
|
||||
const slideStyle = {
|
||||
'--lts-rank-slide-from': `${direction * 1.5}rem`,
|
||||
} as CSSProperties;
|
||||
|
||||
// 읽거나 누르려는 동안에는 멈추고, 직접 넘기면 그 슬라이드부터 다시 센다.
|
||||
useEffect(() => {
|
||||
if (paused || window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
||||
return;
|
||||
}
|
||||
const timer = window.setTimeout(() => move(1), RANKING_SLIDE_INTERVAL_MS);
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [paused, slide]);
|
||||
|
||||
return (
|
||||
<aside
|
||||
aria-busy={leaderboardQuery.isLoading}
|
||||
onMouseEnter={() => setPaused(true)}
|
||||
onMouseLeave={() => setPaused(false)}
|
||||
onFocus={() => setPaused(true)}
|
||||
onBlur={() => setPaused(false)}
|
||||
onTouchStart={(event) => setTouchStartX(event.touches[0]?.clientX)}
|
||||
onTouchEnd={(event) => {
|
||||
const endX = event.changedTouches[0]?.clientX;
|
||||
if (touchStartX === undefined || endX === undefined) return;
|
||||
const distance = endX - touchStartX;
|
||||
if (Math.abs(distance) > 48) move(distance < 0 ? 1 : -1);
|
||||
setTouchStartX(undefined);
|
||||
}}
|
||||
>
|
||||
<PanelHeader
|
||||
title={`시즌 ${label} 순위`}
|
||||
variant="section"
|
||||
actions={
|
||||
<Link
|
||||
to={`${statsPath}?view=ranking`}
|
||||
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
|
||||
>
|
||||
전체 보기
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<div className="overflow-hidden rounded-2xl bg-sunken p-2">
|
||||
{leaderboardQuery.isLoading ? (
|
||||
<div className="space-y-3 p-3" aria-hidden="true">
|
||||
{Array.from({ length: HOME_RANKING_LIMIT }, (_, index) => (
|
||||
<Skeleton key={index} width="100%" height={36} index={index} />
|
||||
))}
|
||||
</div>
|
||||
) : leaderboardQuery.isError ? (
|
||||
<p className="p-3 text-sm text-content-muted">
|
||||
순위를 불러오지 못했습니다.
|
||||
</p>
|
||||
) : rows.length === 0 ? (
|
||||
<div
|
||||
key={slide}
|
||||
style={slideStyle}
|
||||
className="lts-rank-slide grid min-h-[17.5rem] place-items-center"
|
||||
>
|
||||
<EmptyNote size="sm" title="아직 집계된 순위가 없습니다." />
|
||||
</div>
|
||||
) : (
|
||||
<ol
|
||||
key={slide}
|
||||
style={slideStyle}
|
||||
className="lts-rank-slide min-h-[17.5rem]"
|
||||
>
|
||||
{rows.map((row, index) => (
|
||||
<li key={row.userId}>
|
||||
<Link
|
||||
to={`/users/${row.userId}/history?queueGroup=internal`}
|
||||
className={`${RANKING_COLUMNS_CLASS} group rounded-xl py-2.5 transition-colors hover:bg-card focus-visible:-outline-offset-2`}
|
||||
>
|
||||
<span
|
||||
className={`tabular grid size-6 place-items-center rounded-full text-xs font-bold ${
|
||||
RANK_BADGE_CLASS[index] ?? 'text-content-muted'
|
||||
}`}
|
||||
>
|
||||
{index + 1}
|
||||
<span className="sr-only">위</span>
|
||||
</span>
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<img
|
||||
src={profileIconUrl(manifest, row.profileIconId)}
|
||||
alt=""
|
||||
className="size-9 shrink-0 rounded-full bg-sunken-strong object-cover"
|
||||
loading="lazy"
|
||||
/>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block truncate text-sm font-semibold text-content group-hover:text-primary">
|
||||
{row.summonerName}
|
||||
</span>
|
||||
<span className="tabular block text-xs text-content-muted">
|
||||
{row.games}전 {row.wins}승 {row.losses}패
|
||||
</span>
|
||||
</span>
|
||||
<span className="hidden shrink-0 items-center gap-0.5 min-[420px]:flex lg:hidden">
|
||||
{row.topChampions.slice(0, 3).map((champion) => {
|
||||
const icon = championIconUrl(manifest, champion.championId);
|
||||
return icon ? (
|
||||
<img
|
||||
key={champion.championId}
|
||||
src={icon}
|
||||
alt=""
|
||||
className="size-6 rounded-full object-cover"
|
||||
loading="lazy"
|
||||
/>
|
||||
) : null;
|
||||
})}
|
||||
</span>
|
||||
</span>
|
||||
<strong
|
||||
className={`tabular text-right text-sm ${
|
||||
row.winRate >= 50 ? 'text-win' : 'text-content-muted'
|
||||
}`}
|
||||
>
|
||||
<span className="sr-only">승률 </span>
|
||||
{row.winRate}%
|
||||
</strong>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
)}
|
||||
<div className="flex items-center justify-center gap-1 pt-1">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="이전 순위"
|
||||
className="grid size-8 place-items-center rounded-full text-content-muted transition-colors hover:bg-card hover:text-content"
|
||||
onClick={() => move(-1)}
|
||||
>
|
||||
<ChevronLeft className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
<p
|
||||
className="tabular min-w-12 text-center text-[13px] text-content-muted"
|
||||
aria-live={paused ? 'polite' : 'off'}
|
||||
>
|
||||
<span className="sr-only">{label} 순위, </span>
|
||||
<strong className="font-bold text-content">{slide + 1}</strong> /{' '}
|
||||
{RANKING_SLIDES.length}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
aria-label="다음 순위"
|
||||
className="grid size-8 place-items-center rounded-full text-content-muted transition-colors hover:bg-card hover:text-content"
|
||||
onClick={() => move(1)}
|
||||
>
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
interface HistoryPaginationProps {
|
||||
page: number;
|
||||
pageCount: number;
|
||||
@@ -396,10 +708,12 @@ function HistoryPagination({
|
||||
);
|
||||
}
|
||||
|
||||
export default function HomePage() {
|
||||
export default function HomePage({ eventType }: { eventType?: MatchEventType }) {
|
||||
const showArchive = eventType !== undefined;
|
||||
const selectedEventType = eventType ?? 'inhouse';
|
||||
const eventLabel = MATCH_EVENT_LABEL[selectedEventType];
|
||||
const [timelineNow] = useState(() => new Date().toISOString());
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const showArchive = searchParams.get('history') === 'all';
|
||||
const requestedPage = Number(searchParams.get('page'));
|
||||
const historyPage =
|
||||
showArchive && Number.isSafeInteger(requestedPage) && requestedPage > 0
|
||||
@@ -415,14 +729,17 @@ export default function HomePage() {
|
||||
setSearchParams(params, { preventScrollReset: true });
|
||||
}
|
||||
const upcomingMatchesQuery = useMatches({
|
||||
eventType: selectedEventType,
|
||||
limit: UPCOMING_MATCH_LIST_LIMIT,
|
||||
scheduledFrom: timelineNow,
|
||||
sort: 'asc',
|
||||
});
|
||||
const historyMatchesQuery = useMatchesPage({
|
||||
eventType: selectedEventType,
|
||||
limit: historyLimit,
|
||||
page: historyPage,
|
||||
scheduledTo: timelineNow,
|
||||
status: showArchive ? undefined : 'finished',
|
||||
scheduledTo: showArchive ? timelineNow : undefined,
|
||||
sort: 'desc',
|
||||
includeResults: true,
|
||||
});
|
||||
@@ -438,7 +755,10 @@ export default function HomePage() {
|
||||
);
|
||||
}
|
||||
|
||||
const [nextMatch, ...upcomingMatches] = upcomingMatchesQuery.data ?? [];
|
||||
const allUpcomingMatches = upcomingMatchesQuery.data ?? [];
|
||||
const [nextMatch, ...upcomingMatches] = allUpcomingMatches;
|
||||
const bannerMatch = showArchive ? undefined : nextMatch;
|
||||
const visibleUpcomingMatches = showArchive ? allUpcomingMatches : upcomingMatches;
|
||||
const historyTotal = historyMatchesQuery.data?.total ?? 0;
|
||||
const historyPageCount = Math.max(
|
||||
1,
|
||||
@@ -450,25 +770,27 @@ export default function HomePage() {
|
||||
const hasHistoryError =
|
||||
Boolean(historyMatchesQuery.error) && !historyMatchesQuery.data;
|
||||
const statsPath = `/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`;
|
||||
const HistorySection = showArchive ? Panel : 'section';
|
||||
const UpcomingStatusHeading = showArchive ? 'p' : 'h1';
|
||||
const contentSpacing = showArchive ? 'space-y-5 pb-16' : 'space-y-8 pb-10 md:pb-16';
|
||||
const contentTopPadding = bannerMatch ? 'pt-10 md:pt-16' : 'pt-5 sm:pt-6';
|
||||
|
||||
return (
|
||||
<PlainPage className="lts-overview space-y-5 pt-5 pb-16 sm:pt-6">
|
||||
{showArchive ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<h1 className="text-2xl font-bold">전체 내전 일정</h1>
|
||||
<Link to="/" className="text-sm font-semibold hover:underline">
|
||||
내전 홈
|
||||
</Link>
|
||||
</div>
|
||||
) : upcomingMatchesQuery.isLoading ? (
|
||||
<h1 className="text-sm text-content-muted" aria-busy="true">
|
||||
내전 일정을 불러오는 중
|
||||
</h1>
|
||||
const content = (
|
||||
<div className={`${pageWidthClass()} ${contentSpacing} ${contentTopPadding}`}>
|
||||
{showArchive && (
|
||||
<header>
|
||||
<h1 className="text-2xl font-bold">{eventLabel} 일정</h1>
|
||||
</header>
|
||||
)}
|
||||
{upcomingMatchesQuery.isLoading ? (
|
||||
<UpcomingStatusHeading className="text-sm text-content-muted" aria-busy="true">
|
||||
{eventLabel} 일정을 불러오는 중
|
||||
</UpcomingStatusHeading>
|
||||
) : upcomingMatchesQuery.isError && !upcomingMatchesQuery.data ? (
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<h1 className="text-sm text-content-muted">
|
||||
내전 일정을 불러오지 못했습니다
|
||||
</h1>
|
||||
<UpcomingStatusHeading className="text-sm text-content-muted">
|
||||
{eventLabel} 일정을 불러오지 못했습니다
|
||||
</UpcomingStatusHeading>
|
||||
<button
|
||||
type="button"
|
||||
className="min-h-8 text-sm font-semibold underline"
|
||||
@@ -477,67 +799,91 @@ export default function HomePage() {
|
||||
다시 시도
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<NextMatch match={nextMatch} />
|
||||
)}
|
||||
) : !nextMatch ? (
|
||||
<UpcomingStatusHeading className="text-sm text-content-muted">
|
||||
예정된 {eventLabel}이 없습니다
|
||||
</UpcomingStatusHeading>
|
||||
) : null}
|
||||
|
||||
{!showArchive && upcomingMatches.length > 0 && (
|
||||
<UpcomingMatches matches={upcomingMatches} />
|
||||
)}
|
||||
|
||||
<Panel aria-busy={isHistoryPageLoading} aria-live="polite">
|
||||
<PanelHeader
|
||||
title={showArchive ? '지난 일정 전체' : '최근 내전 일정'}
|
||||
actions={
|
||||
<Link
|
||||
to={statsPath}
|
||||
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
|
||||
>
|
||||
전적 검색
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
}
|
||||
{visibleUpcomingMatches.length > 0 && (
|
||||
<UpcomingMatches
|
||||
matches={visibleUpcomingMatches}
|
||||
title={showArchive ? '다가오는 일정' : undefined}
|
||||
/>
|
||||
{isHistoryPageLoading ? (
|
||||
<HistoryRecordsSkeleton limit={historyLimit} />
|
||||
) : hasHistoryError ? (
|
||||
<div className="p-4">
|
||||
<ErrorNote
|
||||
title="지난 내전 기록을 불러오지 못했습니다"
|
||||
action={
|
||||
<Button
|
||||
label="다시 시도"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() => void historyMatchesQuery.refetch()}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<HistoryRecords matches={historyMatchesQuery.data?.matches ?? []} />
|
||||
)}
|
||||
{showArchive && !hasHistoryError && historyTotal > 0 && (
|
||||
<HistoryPagination
|
||||
page={historyPage}
|
||||
pageCount={historyPageCount}
|
||||
total={historyTotal}
|
||||
isFetching={historyMatchesQuery.isFetching}
|
||||
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
|
||||
onNext={() => setHistoryPage(historyPage + 1)}
|
||||
)}
|
||||
|
||||
<div
|
||||
className={
|
||||
showArchive
|
||||
? undefined
|
||||
: 'grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_20rem]'
|
||||
}
|
||||
>
|
||||
<HistorySection aria-busy={isHistoryPageLoading} aria-live="polite">
|
||||
<PanelHeader
|
||||
title={showArchive ? '지난 일정과 결과' : '최근 내전 결과'}
|
||||
variant={showArchive ? 'panel' : 'section'}
|
||||
actions={
|
||||
<Link
|
||||
to={showArchive ? statsPath : '/inhouse'}
|
||||
className="inline-flex items-center gap-0.5 text-[13px] font-semibold text-content-muted hover:text-content hover:underline"
|
||||
>
|
||||
{showArchive ? '전적 검색' : '전체 내전 기록'}
|
||||
<ChevronRight className="size-4" aria-hidden="true" />
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{!showArchive && historyTotal > HOME_HISTORY_LIMIT && (
|
||||
<div className="border-t border-line px-4 py-2.5 text-right sm:px-5">
|
||||
<Link
|
||||
to="/?history=all"
|
||||
className="text-sm text-content-muted hover:underline"
|
||||
>
|
||||
전체 일정 기록
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
</Panel>
|
||||
</PlainPage>
|
||||
{isHistoryPageLoading ? (
|
||||
showArchive ? (
|
||||
<HistoryRecordsSkeleton limit={historyLimit} />
|
||||
) : (
|
||||
<RecentMatchResultsSkeleton limit={historyLimit} />
|
||||
)
|
||||
) : hasHistoryError ? (
|
||||
<div className="p-4">
|
||||
<ErrorNote
|
||||
title={`지난 ${eventLabel} 기록을 불러오지 못했습니다`}
|
||||
action={
|
||||
<Button
|
||||
label="다시 시도"
|
||||
size="sm"
|
||||
variant="secondary"
|
||||
onClick={() => void historyMatchesQuery.refetch()}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : showArchive ? (
|
||||
<HistoryRecords
|
||||
matches={historyMatchesQuery.data?.matches ?? []}
|
||||
eventLabel={eventLabel}
|
||||
/>
|
||||
) : (
|
||||
<RecentMatchResults matches={historyMatchesQuery.data?.matches ?? []} />
|
||||
)}
|
||||
{showArchive && !hasHistoryError && historyTotal > 0 && (
|
||||
<HistoryPagination
|
||||
page={historyPage}
|
||||
pageCount={historyPageCount}
|
||||
total={historyTotal}
|
||||
isFetching={historyMatchesQuery.isFetching}
|
||||
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
|
||||
onNext={() => setHistoryPage(historyPage + 1)}
|
||||
/>
|
||||
)}
|
||||
</HistorySection>
|
||||
{!showArchive && <RankingPreview statsPath={statsPath} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<main>
|
||||
{bannerMatch && <NextMatch match={bannerMatch} />}
|
||||
{content}
|
||||
{!showArchive && (
|
||||
<HomeHallOfFame introReady={!upcomingMatchesQuery.isPending} />
|
||||
)}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ function GamePanel({
|
||||
<section className="lts-panel overflow-hidden">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5">
|
||||
<div>
|
||||
<h3 className="text-sm font-black text-base-content">
|
||||
<h3 className="text-sm font-black">
|
||||
{ordinal === undefined ? `전체 ${game.gameNumber}세트` : `${ordinal}세트`}
|
||||
{ordinal !== undefined && ordinal !== game.gameNumber && (
|
||||
<span className="ml-2 text-xs font-medium text-content-muted">전체 {game.gameNumber}</span>
|
||||
@@ -145,7 +145,7 @@ function GamePanel({
|
||||
? team.side === "blue"
|
||||
? "bg-win-tint text-win"
|
||||
: "bg-loss-tint text-loss"
|
||||
: "bg-sunken text-content-subtle"
|
||||
: "bg-sunken text-content-muted"
|
||||
}`}
|
||||
>
|
||||
{teamIndexLabel(team.teamIndex)} ({sideLabel(team.side)}){" "}
|
||||
|
||||
@@ -41,7 +41,7 @@ export default function LoginPage() {
|
||||
<span className="grid size-11 place-items-center rounded-full bg-primary-tint text-primary">
|
||||
<KeyRound className="size-5" aria-hidden="true" />
|
||||
</span>
|
||||
<h1 className="mt-4 text-xl font-extrabold text-content">로그인</h1>
|
||||
<h1 className="mt-4 text-xl font-extrabold">로그인</h1>
|
||||
<p className="mt-1.5 text-sm leading-relaxed text-content-muted">
|
||||
내전 참가 신청, 팀장 경매, 운영 기능은 로그인 후 사용할 수 있습니다.
|
||||
전적과 대진은 로그인 없이 볼 수 있습니다.
|
||||
|
||||
@@ -1835,7 +1835,7 @@ export default function MatchDetailPage() {
|
||||
title="내전을 찾을 수 없습니다"
|
||||
description="주소가 바뀌었거나 삭제된 내전일 수 있습니다."
|
||||
action={
|
||||
<Btn to="/" variant="secondary">
|
||||
<Btn to="/inhouse" variant="secondary">
|
||||
내전 목록으로
|
||||
</Btn>
|
||||
}
|
||||
@@ -2546,6 +2546,32 @@ export default function MatchDetailPage() {
|
||||
등록된 팀이 없습니다.
|
||||
</div>
|
||||
)}
|
||||
{!usesTabbedLayout && match.teams.length === 0 && (
|
||||
<div className="lts-panel">
|
||||
<EmptyNote
|
||||
title={
|
||||
showAuctionLink
|
||||
? "경매로 팀을 구성하고 있습니다"
|
||||
: "팀이 아직 확정되지 않았습니다"
|
||||
}
|
||||
description={
|
||||
showAuctionLink
|
||||
? "경매가 끝나면 팀 구성과 대진표가 이 화면에 표시됩니다."
|
||||
: "팀 구성이 끝나면 팀과 대진표가 이 화면에 표시됩니다."
|
||||
}
|
||||
action={
|
||||
showAuctionLink ? (
|
||||
<Btn
|
||||
to={`/match/${match.id}/auction`}
|
||||
variant="secondary"
|
||||
>
|
||||
경매 진행 상황 보기
|
||||
</Btn>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
{match.teams.map((team) => (
|
||||
<TeamCard key={team.teamIndex} team={team} />
|
||||
))}
|
||||
|
||||
@@ -334,7 +334,7 @@ function ItemStrip({
|
||||
itemId={itemId}
|
||||
manifest={manifest}
|
||||
trinket={index === 6}
|
||||
className="h-8 w-8"
|
||||
className="h-7 w-7"
|
||||
imageClassName=""
|
||||
/>
|
||||
))}
|
||||
@@ -716,7 +716,7 @@ function PostgameBreakdown({
|
||||
return (
|
||||
<section className="mt-5 overflow-hidden border border-base-content/10 bg-base-100">
|
||||
<div className="flex flex-wrap items-center justify-between gap-3 border-b border-base-content/8 px-4 py-3">
|
||||
<h2 className="text-sm font-black text-base-content">경기 요약</h2>
|
||||
<h2 className="text-sm font-black">경기 요약</h2>
|
||||
<div className="flex flex-wrap items-center gap-2 text-xs font-bold text-base-content/35">
|
||||
{version ? <span>Ver. {version}</span> : null}
|
||||
<span>{formatDuration(selectedGame.gameDuration)}</span>
|
||||
@@ -1147,7 +1147,7 @@ function TimelineGraph({
|
||||
<section className="mt-5 overflow-hidden border border-base-content/10 bg-base-100">
|
||||
<div className="flex flex-col gap-3 border-b border-base-content/8 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div>
|
||||
<h2 className="text-sm font-black text-base-content">경기 흐름</h2>
|
||||
<h2 className="text-sm font-black">경기 흐름</h2>
|
||||
<div className="mt-1 text-xs font-bold text-base-content/35">
|
||||
{finalPoint
|
||||
? `${finalLeader} ${formatSignedCompactNumber(finalPoint.value)}`
|
||||
@@ -1241,7 +1241,7 @@ function TimelineGraph({
|
||||
type="monotone"
|
||||
dataKey="positive"
|
||||
stroke="none"
|
||||
fill="#3b82f6"
|
||||
fill="var(--lts-win-fill)"
|
||||
fillOpacity={0.16}
|
||||
isAnimationActive={false}
|
||||
/>
|
||||
@@ -1249,7 +1249,7 @@ function TimelineGraph({
|
||||
type="monotone"
|
||||
dataKey="negative"
|
||||
stroke="none"
|
||||
fill="#ef4444"
|
||||
fill="var(--lts-loss-fill)"
|
||||
fillOpacity={0.16}
|
||||
isAnimationActive={false}
|
||||
/>
|
||||
@@ -1282,9 +1282,9 @@ function TimelineGraph({
|
||||
r={selected ? 5.5 : markerRadius}
|
||||
fill={
|
||||
event.side === "blue"
|
||||
? "#3b82f6"
|
||||
? "var(--lts-win-fill)"
|
||||
: event.side === "red"
|
||||
? "#ef4444"
|
||||
? "var(--lts-loss-fill)"
|
||||
: "currentColor"
|
||||
}
|
||||
stroke="currentColor"
|
||||
@@ -1321,7 +1321,7 @@ function TimelineGraph({
|
||||
{timelineEvents.length > 0 ? (
|
||||
<div className="border-t border-base-content/8 px-4 py-3">
|
||||
<div className="flex flex-wrap items-baseline justify-between gap-2">
|
||||
<h3 className="text-xs font-black text-base-content">주요 사건</h3>
|
||||
<h3 className="text-xs font-black">주요 사건</h3>
|
||||
<p className="text-[11px] font-bold text-base-content/30">
|
||||
항목을 선택하면 그래프의 해당 시점을 강조합니다
|
||||
</p>
|
||||
@@ -1348,7 +1348,7 @@ function TimelineGraph({
|
||||
))}
|
||||
</div>
|
||||
<ul
|
||||
className="m-0 mt-3 grid max-h-64 list-none gap-1.5 overflow-y-auto p-0 sm:grid-cols-2 lg:grid-cols-3"
|
||||
className="m-0 mt-3 max-h-80 list-none divide-y divide-line overflow-y-auto rounded-field border border-line p-0"
|
||||
aria-label="시간순 주요 사건"
|
||||
>
|
||||
{visibleEventEntries.map(({ event, key }) => {
|
||||
@@ -1370,10 +1370,8 @@ function TimelineGraph({
|
||||
type="button"
|
||||
aria-pressed={selected}
|
||||
onClick={() => setSelectedEventKey(selected ? null : key)}
|
||||
className={`grid h-full w-full grid-cols-[3.25rem_3.25rem_minmax(0,1fr)] items-start gap-2 border px-2.5 py-2 text-left text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary ${
|
||||
selected
|
||||
? "border-primary bg-primary/8"
|
||||
: "border-base-content/8 hover:bg-base-content/[0.03]"
|
||||
className={`grid w-full grid-cols-[3rem_3rem_minmax(0,1fr)] items-baseline gap-2 !rounded-none px-3 py-1.5 text-left text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary ${
|
||||
selected ? "bg-primary-tint" : "hover:bg-sunken"
|
||||
}`}
|
||||
>
|
||||
<span className="font-mono font-black tabular-nums text-base-content/55">
|
||||
@@ -1390,8 +1388,8 @@ function TimelineGraph({
|
||||
>
|
||||
{event.side ? sideLabel(event.side) : "-"}
|
||||
</span>
|
||||
<span className="min-w-0">
|
||||
<span className="block truncate font-bold text-base-content/75">
|
||||
<span className="min-w-0 sm:flex sm:items-baseline sm:gap-3">
|
||||
<span className="block truncate font-bold text-base-content/75 sm:w-32 sm:shrink-0">
|
||||
{teamName ? (
|
||||
<span className="sr-only">{teamName} </span>
|
||||
) : null}
|
||||
@@ -1399,7 +1397,7 @@ function TimelineGraph({
|
||||
</span>
|
||||
{actorLabel ? (
|
||||
<span
|
||||
className="mt-0.5 block truncate text-[10px] font-bold text-base-content/35"
|
||||
className="mt-0.5 block min-w-0 truncate text-[11px] text-content-muted sm:mt-0 sm:flex-1"
|
||||
title={actorLabel}
|
||||
>
|
||||
{actorLabel}
|
||||
@@ -1447,16 +1445,16 @@ function TeamTable({
|
||||
))}
|
||||
</div>
|
||||
<div className="hidden overflow-x-auto lg:block">
|
||||
<table className="w-full min-w-[1040px] table-fixed text-left">
|
||||
<table className="w-full min-w-[920px] table-fixed text-left">
|
||||
<thead>
|
||||
<tr className="bg-base-content/[0.02] text-xs uppercase tracking-wider text-base-content/35">
|
||||
<th className="w-[276px] px-3 py-2.5">선수</th>
|
||||
<th className="w-[108px] px-3 py-2.5 text-center">KDA</th>
|
||||
<th className="w-[120px] px-3 py-2.5 text-center">가한 피해량</th>
|
||||
<th className="w-[120px] px-3 py-2.5 text-center">받은 피해량</th>
|
||||
<th className="w-[80px] px-3 py-2.5 text-center">시야</th>
|
||||
<th className="w-[96px] px-3 py-2.5 text-center">CS · 경제</th>
|
||||
<th className="w-[260px] px-3 py-2.5">아이템</th>
|
||||
<th className="w-[228px] px-3 py-2.5">선수</th>
|
||||
<th className="w-[100px] px-3 py-2.5 text-center">KDA</th>
|
||||
<th className="w-[104px] px-3 py-2.5 text-center">가한 피해량</th>
|
||||
<th className="w-[104px] px-3 py-2.5 text-center">받은 피해량</th>
|
||||
<th className="w-[72px] px-3 py-2.5 text-center">시야</th>
|
||||
<th className="w-[92px] px-3 py-2.5 text-center">CS · 경제</th>
|
||||
<th className="w-[232px] px-3 py-2.5">아이템</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -1537,10 +1535,10 @@ function GameTabs({
|
||||
|
||||
return (
|
||||
<nav
|
||||
className="lts-panel sticky top-(--app-header-height) z-30 p-1"
|
||||
className="lts-panel sticky top-(--app-header-nav-height) z-30 p-1 sm:flex sm:items-center sm:gap-1"
|
||||
aria-label="세트 선택"
|
||||
>
|
||||
<label className="flex min-w-0 items-center gap-2 border-b border-line px-2 py-1.5 text-xs font-semibold text-content-muted">
|
||||
<label className="flex min-w-0 items-center gap-2 border-b border-line px-2 py-1.5 text-xs font-semibold text-content-muted sm:w-72 sm:shrink-0 sm:border-b-0 sm:border-r sm:py-0 sm:pr-3">
|
||||
<span className="shrink-0">대진</span>
|
||||
<select
|
||||
className="lts-select min-w-0"
|
||||
@@ -1555,7 +1553,7 @@ function GameTabs({
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<div className="flex items-center gap-1">
|
||||
<div className="flex min-w-0 items-center gap-1 sm:flex-1">
|
||||
<Link
|
||||
to={previousGame ? pathFor(previousGame.gameNumber) : "#"}
|
||||
state={navigationState}
|
||||
@@ -1577,9 +1575,9 @@ function GameTabs({
|
||||
to={pathFor(game.gameNumber)}
|
||||
state={navigationState}
|
||||
aria-current={active ? "page" : undefined}
|
||||
className={`flex h-10 shrink-0 items-center gap-2 rounded-[10px] px-3.5 text-sm transition-colors ${
|
||||
className={`group flex h-10 shrink-0 items-center gap-2 rounded-[10px] px-3.5 text-sm 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"
|
||||
}`}
|
||||
>
|
||||
@@ -1590,7 +1588,7 @@ function GameTabs({
|
||||
<span className="text-xs opacity-80">전체 {game.gameNumber}</span>
|
||||
)}
|
||||
<span
|
||||
className={`max-w-28 truncate text-xs ${active ? "opacity-80" : "text-content-subtle"}`}
|
||||
className={`max-w-28 truncate text-xs ${active ? "opacity-80" : "text-content-subtle group-hover:text-content-muted"}`}
|
||||
>
|
||||
{winnerTeam
|
||||
? `${getTeamName(detail, winnerTeam.teamIndex)} 승`
|
||||
@@ -1638,7 +1636,7 @@ function MatchScoreHero({
|
||||
const showSeriesScore = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries) && leftScore !== undefined && rightScore !== undefined;
|
||||
const decision = selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
|
||||
const sideTone = (side: TeamSide) =>
|
||||
side === "blue" ? "text-[#8fb6ff]" : "text-[#ff99a5]";
|
||||
side === "blue" ? "text-win" : "text-loss";
|
||||
|
||||
return (
|
||||
<PageHero
|
||||
|
||||
@@ -191,7 +191,7 @@ export default function MatchTeamProgressPage() {
|
||||
actions={
|
||||
<Link
|
||||
to={`/match/${id}/team?select=1`}
|
||||
className="inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-field bg-white/10 px-4 text-sm font-bold text-on-ink transition-colors hover:bg-white/20"
|
||||
className="inline-flex h-10 shrink-0 items-center justify-center gap-2 rounded-field bg-on-ink/10 px-4 text-sm font-bold text-on-ink transition-colors hover:bg-on-ink/20"
|
||||
>
|
||||
<UsersRound className="h-4 w-4" aria-hidden="true" />
|
||||
팀 변경
|
||||
@@ -335,7 +335,7 @@ function SectionHeading({
|
||||
}) {
|
||||
return (
|
||||
<div className="mb-3 border-b border-base-content/10 pb-2">
|
||||
<h2 id={id} className="text-base font-black text-base-content">
|
||||
<h2 id={id} className="text-base font-black">
|
||||
{title}
|
||||
</h2>
|
||||
<p className="mt-0.5 text-xs text-content-muted">{description}</p>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useQueryClient } from '@tanstack/react-query';
|
||||
import type {
|
||||
GrandFinalGameCount,
|
||||
MatchDetailResponse,
|
||||
MatchEventType,
|
||||
MatchGameMode,
|
||||
MatchLifecycleStatus,
|
||||
MatchScheduleItemView,
|
||||
@@ -17,11 +18,13 @@ import {
|
||||
} from '../../api/hooks';
|
||||
import type { MatchMutationRequest } from '../../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../../config';
|
||||
import { MATCH_EVENT_LABEL } from '../../lib/match-event-type';
|
||||
|
||||
import { Btn, Chip, ErrorNote, LoadingNote, Pill, type PillTone } from '../../ui';
|
||||
import { AdminNotice, AdminPage } from '../../components/AdminPage';
|
||||
const DEFAULT_FORM: MatchMutationRequest = {
|
||||
title: '',
|
||||
eventType: 'inhouse',
|
||||
description: '',
|
||||
mapId: 11,
|
||||
scheduledAt: toInputValue(new Date(Date.now() + 24 * 60 * 60 * 1000)),
|
||||
@@ -147,6 +150,7 @@ function makeForm(match?: MatchDetailResponse): MatchMutationRequest & {
|
||||
|
||||
return {
|
||||
title: match.title,
|
||||
eventType: match.eventType ?? 'inhouse',
|
||||
description: match.description,
|
||||
mapId: match.mapId,
|
||||
scheduledAt: toInputValue(match.scheduledAt),
|
||||
@@ -204,6 +208,7 @@ export default function MatchAdminPage() {
|
||||
async function invalidate() {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ['matches', communityId] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['matches-page', communityId] }),
|
||||
queryClient.invalidateQueries({ queryKey: ['match', communityId] }),
|
||||
]);
|
||||
}
|
||||
@@ -225,6 +230,7 @@ export default function MatchAdminPage() {
|
||||
function buildPayload(): MatchMutationRequest {
|
||||
const details: MatchMutationRequest = {
|
||||
title: form.title.trim(),
|
||||
eventType: form.eventType,
|
||||
description: form.description?.trim() ?? '',
|
||||
mapId: Number(form.mapId ?? 11),
|
||||
scheduledAt: toIsoFromInput(form.scheduledAt),
|
||||
@@ -275,7 +281,7 @@ export default function MatchAdminPage() {
|
||||
await invalidate();
|
||||
setShowForm(false);
|
||||
setEditing(null);
|
||||
setMessage(editing ? '내전을 수정했습니다.' : '내전을 만들었습니다.');
|
||||
setMessage(editing ? '대회를 수정했습니다.' : '대회를 만들었습니다.');
|
||||
},
|
||||
onError: (error: Error) => setMessage(error.message),
|
||||
};
|
||||
@@ -296,7 +302,7 @@ export default function MatchAdminPage() {
|
||||
variant="destructive"
|
||||
disabled={deleteMutation.isPending}
|
||||
onClick={() => {
|
||||
if (!window.confirm('이 내전을 삭제할까요?')) return;
|
||||
if (!window.confirm('이 대회를 삭제할까요?')) return;
|
||||
deleteMutation.mutate(match._id, {
|
||||
onSuccess: invalidate,
|
||||
onError: (error) => setMessage(error instanceof Error ? error.message : '삭제 실패'),
|
||||
@@ -318,7 +324,7 @@ export default function MatchAdminPage() {
|
||||
return (
|
||||
<AdminNotice title="권한이 필요합니다">
|
||||
<p className="mt-2 text-sm text-base-content/40">
|
||||
내전 관리는 owner/admin만 사용할 수 있습니다.
|
||||
대회 관리는 owner/admin만 사용할 수 있습니다.
|
||||
</p>
|
||||
</AdminNotice>
|
||||
);
|
||||
@@ -327,11 +333,11 @@ export default function MatchAdminPage() {
|
||||
return (
|
||||
<AdminPage
|
||||
communityId={communityId}
|
||||
title="내전 관리"
|
||||
description="내전 생성, 모집 정원, 게임 모드와 공지 내용을 관리합니다."
|
||||
title="대회 관리"
|
||||
description="내전과 멸망전의 일정, 참가 설정과 공지를 관리합니다."
|
||||
>
|
||||
<div className="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="flex flex-wrap gap-2" role="group" aria-label="내전 상태 필터">
|
||||
<div className="flex flex-wrap gap-2" role="group" aria-label="대회 상태 필터">
|
||||
<Chip selected={!statusFilter} onClick={() => setStatusFilter(undefined)}>전체</Chip>
|
||||
{matchStatusFilters.map((status) => (
|
||||
<Chip key={status} selected={statusFilter === status} onClick={() => setStatusFilter(status)}>
|
||||
@@ -340,7 +346,7 @@ export default function MatchAdminPage() {
|
||||
))}
|
||||
</div>
|
||||
<Btn variant="primary" onClick={openCreate}>
|
||||
새 내전 만들기
|
||||
새 대회 만들기
|
||||
</Btn>
|
||||
</div>
|
||||
|
||||
@@ -354,7 +360,7 @@ export default function MatchAdminPage() {
|
||||
<section className="mb-6 border border-base-content/10 bg-base-100 p-4">
|
||||
<div className="mb-4 flex items-center justify-between gap-3">
|
||||
<h2 ref={formHeading} tabIndex={-1} className="scroll-mt-28 text-sm font-bold">
|
||||
{editing ? '내전 수정' : '새 내전'}
|
||||
{editing ? '대회 수정' : '새 대회'}
|
||||
</h2>
|
||||
<button
|
||||
type="button"
|
||||
@@ -397,6 +403,21 @@ export default function MatchAdminPage() {
|
||||
className="lts-input mt-1 w-full"
|
||||
/>
|
||||
</label>
|
||||
<label className="text-xs text-base-content/45">
|
||||
대회 유형
|
||||
<select
|
||||
value={form.eventType}
|
||||
onChange={(event) => {
|
||||
const eventType = event.target.value as MatchEventType;
|
||||
setForm((current) => ({ ...current, eventType }));
|
||||
}}
|
||||
className="lts-select mt-1 w-full"
|
||||
>
|
||||
{Object.entries(MATCH_EVENT_LABEL).map(([value, label]) => (
|
||||
<option key={value} value={value}>{label}</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="text-xs text-base-content/45">
|
||||
정원
|
||||
<select
|
||||
@@ -585,15 +606,15 @@ export default function MatchAdminPage() {
|
||||
)}
|
||||
|
||||
{matchesQuery.isLoading ? (
|
||||
<LoadingNote label="내전 목록을 불러오는 중" />
|
||||
<LoadingNote label="대회 목록을 불러오는 중" />
|
||||
) : matchesQuery.isError ? (
|
||||
<ErrorNote title="내전 목록을 불러오지 못했습니다" action={<Btn onClick={() => void matchesQuery.refetch()}>다시 시도</Btn>} />
|
||||
<ErrorNote title="대회 목록을 불러오지 못했습니다" action={<Btn onClick={() => void matchesQuery.refetch()}>다시 시도</Btn>} />
|
||||
) : matches.length === 0 ? (
|
||||
<p role="status" className="lts-panel p-6 text-center text-sm text-content-muted">
|
||||
{statusFilter ? '이 상태의 내전이 없습니다.' : '등록된 내전이 없습니다.'}
|
||||
{statusFilter ? '이 상태의 대회가 없습니다.' : '등록된 대회가 없습니다.'}
|
||||
</p>
|
||||
) : (
|
||||
<section className="lts-panel overflow-hidden" aria-label="내전 목록">
|
||||
<section className="lts-panel overflow-hidden" aria-label="대회 목록">
|
||||
<ul className="divide-y divide-line lg:hidden">
|
||||
{matches.map((match) => (
|
||||
<li key={match._id} className="space-y-2 px-4 py-3">
|
||||
@@ -604,7 +625,7 @@ export default function MatchAdminPage() {
|
||||
<Pill tone={MATCH_STATES[match.status].tone}>{MATCH_STATES[match.status].label}</Pill>
|
||||
</div>
|
||||
<p className="text-xs text-content-muted">
|
||||
{formatDate(match.scheduledAt)} · {match.participants.length}/{match.maxParticipants}명
|
||||
{MATCH_EVENT_LABEL[match.eventType ?? 'inhouse']} · {formatDate(match.scheduledAt)} · {match.participants.length}/{match.maxParticipants}명
|
||||
</p>
|
||||
<details className="text-sm">
|
||||
<summary className="cursor-pointer py-2 font-semibold">상세·관리</summary>
|
||||
@@ -623,7 +644,8 @@ export default function MatchAdminPage() {
|
||||
<thead>
|
||||
<tr className="bg-base-200/40 border-b border-base-content/10 text-xs uppercase tracking-wider text-base-content/35">
|
||||
<th className="px-3 py-2">시간</th>
|
||||
<th className="px-3 py-2">내전</th>
|
||||
<th className="px-3 py-2">대회</th>
|
||||
<th className="px-3 py-2">유형</th>
|
||||
<th className="px-3 py-2">상태</th>
|
||||
<th className="px-3 py-2">정원</th>
|
||||
<th className="px-3 py-2">모드</th>
|
||||
@@ -644,6 +666,7 @@ export default function MatchAdminPage() {
|
||||
{match.description || '-'}
|
||||
</div>
|
||||
</td>
|
||||
<td className="px-3 py-2 text-xs">{MATCH_EVENT_LABEL[match.eventType ?? 'inhouse']}</td>
|
||||
<td className="px-3 py-2 text-xs"><Pill tone={MATCH_STATES[match.status].tone}>{MATCH_STATES[match.status].label}</Pill></td>
|
||||
<td className="px-3 py-2 text-xs tabular-nums">
|
||||
{match.participants.length}/{match.maxParticipants}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
--lts-content-disabled: var(--color-text-disabled);
|
||||
|
||||
color: var(--color-text-primary);
|
||||
font-family: Figtree, "Asta Sans", system-ui, sans-serif;
|
||||
font-size: var(--text-body-size);
|
||||
line-height: var(--text-body-leading);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,11 @@ export const HOME_MATCH_STATUS = {
|
||||
finished: '종료',
|
||||
} as const;
|
||||
|
||||
type HomeMatchEnrollment = Pick<
|
||||
MatchDetailResponse,
|
||||
'status' | 'joined' | 'participants' | 'maxParticipants'
|
||||
>;
|
||||
|
||||
export function getHomeMatchSchedule(scheduledAt: string) {
|
||||
const value = new Date(scheduledAt);
|
||||
if (Number.isNaN(value.getTime())) return;
|
||||
@@ -61,12 +66,7 @@ export function getHistoryMatchTitle(
|
||||
: title;
|
||||
}
|
||||
|
||||
export function getHomeMatchEnrollment(
|
||||
match: Pick<
|
||||
MatchDetailResponse,
|
||||
'status' | 'joined' | 'participants' | 'maxParticipants'
|
||||
>,
|
||||
) {
|
||||
export function getHomeMatchEnrollment(match: HomeMatchEnrollment) {
|
||||
const current = match.participants.length;
|
||||
const remaining = match.maxParticipants - current;
|
||||
const isRecruiting = match.status === 'recruiting';
|
||||
@@ -84,3 +84,20 @@ export function getHomeMatchEnrollment(
|
||||
|
||||
return { canApply, capacity, label };
|
||||
}
|
||||
|
||||
export function getNextMatchBanner(
|
||||
match: HomeMatchEnrollment & Pick<MatchDetailResponse, 'title'>,
|
||||
) {
|
||||
const { canApply, capacity } = getHomeMatchEnrollment(match);
|
||||
const regularTitle = /^(?:[월화수목금토일]요일\s*(?:정기\s*)?|정기\s*)내전$/u;
|
||||
const title = regularTitle.test(match.title.trim()) ? '정기 내전' : match.title;
|
||||
|
||||
let status: string = HOME_MATCH_STATUS[match.status];
|
||||
if (match.status === 'team-built') status = '팀 편성';
|
||||
if (match.status === 'recruiting') {
|
||||
if (match.joined) status = '신청 완료';
|
||||
else if (!canApply) status = match.maxParticipants > 0 ? '정원 마감' : '모집 마감';
|
||||
}
|
||||
|
||||
return { title, status, capacity, canApply };
|
||||
}
|
||||
Reference in new issue
Block a user