feat(web): refresh the app with Astryx and coral branding

This commit is contained in:
dahyeon committed 2026-11-10 13:35:11 +09:00
1 parent f649490cd2
commit da7b502936
140 files changed
+4531 -2368

No files matched your search

+519 -283
View File
@@ -1,3 +1,4 @@
import { ChevronRight } from 'lucide-react';
import { Link, useLocation, useSearchParams } from 'react-router';
import {
useCommunity,
@@ -10,39 +11,48 @@ import type {
ApiInternalMatchCard,
ApiLeaderHighlight,
ApiLeaderboardRow,
TeamSide,
} from '../api/types';
import { DEFAULT_COMMUNITY_ID } from '../config';
import { championDisplayName, championIconUrl, profileIconUrl } from '../lib/ddragon';
import { sideShortLabel, teamIndexColorClasses, teamIndexLabel } from '../lib/league';
import { teamIndexColorClasses, teamIndexLabel } from '../lib/league';
import {
Btn,
Chip,
EmptyNote,
ErrorNote,
LoadingNote,
MetaDot,
PageBody,
PageHero,
Panel,
PanelHeader,
Pill,
PlainPage,
Skeleton,
} from '../ui';
type Manifest = ReturnType<typeof useDdragonManifest>['data'];
function formatDateTime(value: string) {
return new Intl.DateTimeFormat('ko-KR', {
month: 'long',
day: 'numeric',
weekday: 'short',
hour: '2-digit',
minute: '2-digit',
}).format(new Date(value));
}
function formatDuration(seconds: number) {
const minutes = Math.floor(seconds / 60);
const rest = seconds % 60;
return `${minutes}:${String(rest).padStart(2, '0')}`;
}
function sideLabel(side: TeamSide) {
return sideShortLabel(side);
}
function sideText(side: TeamSide) {
return side === 'blue' ? 'text-blue-400' : 'text-red-400';
}
function ratioClass(value: number) {
if (value >= 55) return 'text-blue-400';
if (value >= 50) return 'text-amber-400';
return 'text-base-content/45';
if (value >= 60) return 'text-loss';
if (value >= 50) return 'text-win';
return 'text-content-muted';
}
function kdaClass(value: number) {
if (value >= 5) return 'text-gold';
if (value >= 3) return 'text-leaf';
return 'text-content-muted';
}
function ChampionChip({
@@ -50,143 +60,233 @@ function ChampionChip({
manifest,
}: {
championId: number;
manifest: ReturnType<typeof useDdragonManifest>['data'];
manifest: Manifest;
}) {
const icon = championIconUrl(manifest, championId);
const name = championDisplayName(manifest, championId) ?? String(championId);
return (
<span className="inline-flex items-center gap-1.5">
<span className="w-5 h-5 bg-base-content/10 overflow-hidden">
{icon ? <img src={icon} alt="" className="w-full h-full object-cover" /> : null}
</span>
<span>{name}</span>
<span
className="size-7 overflow-hidden rounded-full bg-sunken-strong"
title={name}
>
{icon ? (
<img
src={icon}
alt={name}
className="size-full scale-[1.15] object-cover"
loading="lazy"
/>
) : null}
</span>
);
}
function AvatarStack({
members,
manifest,
}: {
members: ApiInternalMatchCard['teams'][number]['members'];
manifest: Manifest;
}) {
return (
<span className="flex shrink-0 -space-x-1.5">
{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 MatchCard({
match,
manifest,
}: {
match: ApiInternalMatchCard;
manifest: ReturnType<typeof useDdragonManifest>['data'];
manifest: Manifest;
}) {
const primarySeries = match.seriesResults[0];
const isHeadToHead = match.teams.length === 2;
const series = isHeadToHead ? match.seriesResults[0] : undefined;
const winnerTeam = match.teams.find(
(team) => team.teamIndex === match.winnerTeamIndex,
);
const teamName = (teamIndex: number) =>
teamIndexLabel(
teamIndex,
match.teams.find((team) => team.teamIndex === teamIndex)?.name,
);
const finishedGames = match.games.filter(
(game) => game.winnerTeamIndex !== null,
).length;
return (
<Link
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats/match/${match.matchId}`}
className="block group"
>
<article className="border border-base-content/10 bg-base-100 hover:border-primary/25 transition-colors">
<div className="p-4 grid lg:grid-cols-[1fr_auto_1fr] gap-4 items-center">
<div className="min-w-0">
<div className="text-xs text-base-content/35">
{formatDateTime(match.scheduledAt)}
</div>
<h3 className="mt-1 text-base font-black text-base-content truncate group-hover:text-primary">
{match.title}
</h3>
<div className="mt-2 flex flex-wrap gap-1.5">
{match.games.map((game) => (
<span
key={game.gameNumber}
className="inline-flex items-center gap-1 border border-base-content/10 px-2 py-1 text-xs text-base-content/45"
>
{game.gameNumber}경기
{game.winnerSide && game.winnerTeamIndex ? (
<span className={sideText(game.winnerSide)}>
{teamName(game.winnerTeamIndex)} 승 ({sideLabel(game.winnerSide)})
</span>
) : (
'대기'
)}
<span>{formatDuration(game.gameDuration)}</span>
</span>
))}
</div>
</div>
<div className="text-center px-8">
{primarySeries && (
<div className="flex items-center justify-center gap-5">
<div className={primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : 'text-base-content/30'}>
<div className="text-4xl font-black tabular-nums">{primarySeries.teamAWins}</div>
<div className="text-xs font-bold uppercase tracking-wider">
{teamName(primarySeries.teamAIndex)}
</div>
</div>
<div className="text-base-content/15 text-xs font-black">VS</div>
<div className={primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : 'text-base-content/30'}>
<div className="text-4xl font-black tabular-nums">{primarySeries.teamBWins}</div>
<div className="text-xs font-bold uppercase tracking-wider">
{teamName(primarySeries.teamBIndex)}
</div>
</div>
</div>
<li>
<Link
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats/match/${match.matchId}`}
className="group grid gap-x-6 gap-y-3 px-4 py-4 transition-colors hover:bg-sunken sm:px-5 lg:grid-cols-[minmax(0,1fr)_minmax(0,1.3fr)_20px] lg:items-center"
>
<div className="min-w-0">
<div className="flex flex-wrap items-center gap-2 text-xs text-content-subtle">
<span className="tabular">{formatDateTime(match.scheduledAt)}</span>
{match.status === 'in-progress' && (
<Pill tone="accent" dot pulse>
진행중
</Pill>
)}
</div>
<div className="grid sm:grid-cols-2 gap-2">
{match.teams.map((team) => (
<div
key={team.teamIndex}
className={`border ${teamIndexColorClasses(team.teamIndex).border} p-2`}
>
<div className={`text-xs font-black uppercase tracking-wider ${teamIndexColorClasses(team.teamIndex).text}`}>
{team.name}
</div>
<div className="mt-2 space-y-1">
{team.members.slice(0, 5).map((member) => (
<div key={member.userId} className="flex items-center gap-1.5 min-w-0">
<span className="w-5 h-5 bg-base-content/10 overflow-hidden shrink-0">
<img
src={profileIconUrl(manifest, member.profileIconId)}
alt=""
className="w-full h-full object-cover"
loading="lazy"
/>
</span>
<span className="text-xs truncate text-base-content/65">
{member.summonerName}
</span>
</div>
))}
</div>
</div>
))}
</div>
<h3 className="mt-1 truncate text-base font-bold text-content group-hover:text-primary">
{match.title}
</h3>
<p className="mt-1 flex flex-wrap items-center gap-2 text-[13px] text-content-muted">
<span>{match.teams.length}팀</span>
<MetaDot />
<span className="tabular">
{finishedGames === match.gameCount
? `${match.gameCount}경기`
: `${finishedGames}/${match.gameCount}경기 완료`}
</span>
</p>
</div>
</article>
</Link>
{series ? (
<div className="grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3">
{[series.teamAIndex, series.teamBIndex].map((teamIndex, side) => {
const team = match.teams.find(
(candidate) => candidate.teamIndex === teamIndex,
);
const won = series.winnerTeamIndex === teamIndex;
return (
<div
key={teamIndex}
className={`flex min-w-0 items-center gap-2 ${
side === 0
? 'order-1 flex-row-reverse text-right'
: 'order-3'
}`}
>
{team && (
<AvatarStack members={team.members} manifest={manifest} />
)}
<span
className={`truncate text-sm ${
won
? 'font-bold text-content'
: 'font-medium text-content-muted'
}`}
>
{teamName(teamIndex)}
</span>
</div>
);
})}
<div className="tabular order-2 flex items-baseline gap-1.5 rounded-field bg-sunken px-3 py-1 text-xl font-extrabold">
<span
className={
series.winnerTeamIndex === series.teamAIndex
? 'text-content'
: 'text-content-subtle'
}
>
{series.teamAWins}
</span>
<span className="text-sm text-content-disabled">:</span>
<span
className={
series.winnerTeamIndex === series.teamBIndex
? 'text-content'
: 'text-content-subtle'
}
>
{series.teamBWins}
</span>
</div>
</div>
) : (
<div className="flex flex-wrap items-center gap-x-4 gap-y-2">
{winnerTeam ? (
<div className="flex items-center gap-2">
<Pill tone="gold">우승</Pill>
<AvatarStack members={winnerTeam.members} manifest={manifest} />
<span className="text-sm font-bold text-content">
{winnerTeam.name}
</span>
</div>
) : (
<span className="text-[13px] text-content-muted">
우승 팀 미정
</span>
)}
<div className="flex flex-wrap gap-1.5">
{match.teams
.filter((team) => team.teamIndex !== winnerTeam?.teamIndex)
.slice(0, 7)
.map((team) => (
<span
key={team.teamIndex}
className={`inline-flex h-6 max-w-28 items-center rounded-full border px-2 text-xs font-medium ${teamIndexColorClasses(team.teamIndex).border} ${teamIndexColorClasses(team.teamIndex).text}`}
>
<span className="truncate">{team.name}</span>
</span>
))}
</div>
</div>
)}
<ChevronRight
className="hidden size-5 text-content-disabled group-hover:text-primary lg:block"
aria-hidden="true"
/>
</Link>
</li>
);
}
function HighlightCard({
function HighlightCell({
title,
highlight,
suffix = '',
isLoading,
}: {
title: string;
highlight: ApiLeaderHighlight | null | undefined;
suffix?: string;
isLoading: boolean;
}) {
const location = useLocation();
return (
<div className="border border-base-content/10 bg-base-100 p-4">
<div className="text-xs font-black uppercase tracking-wider text-base-content/30">
{title}
</div>
<div className="mt-2 text-xl font-black text-base-content tabular-nums">
{highlight ? `${highlight.metric}${suffix}` : '-'}
</div>
<div className="mt-1 text-xs text-base-content/45">
{highlight?.summonerName ?? '기록 없음'}
</div>
<div className="min-w-0 px-4 py-3.5 sm:px-5">
<div className="text-xs font-semibold text-content-subtle">{title}</div>
{isLoading ? (
<Skeleton width={64} height={26} className="mt-1.5" />
) : (
<div className="tabular mt-1 text-[22px] font-extrabold leading-tight text-content">
{highlight ? `${highlight.metric}${suffix}` : '—'}
</div>
)}
{highlight ? (
<Link
to={`/users/${highlight.userId}/history?queueGroup=internal`}
state={{ backTo: `${location.pathname}${location.search}` }}
className="mt-0.5 block truncate text-[13px] font-medium text-content-muted hover:text-primary"
>
{highlight.summonerName}
</Link>
) : (
<div className="mt-0.5 text-[13px] text-content-subtle">
{isLoading ? ' ' : '기록 없음'}
</div>
)}
</div>
);
}
@@ -196,100 +296,144 @@ function LeaderboardTable({
manifest,
}: {
rows: ApiLeaderboardRow[];
manifest: ReturnType<typeof useDdragonManifest>['data'];
manifest: Manifest;
}) {
const location = useLocation();
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
return (
<div className="border border-base-content/10 bg-base-100 overflow-hidden">
<div className="overflow-x-auto">
<table className="w-full text-left min-w-[920px]">
<thead>
<tr className="border-b border-base-content/10 bg-base-200/50 text-xs uppercase tracking-wider text-base-content/35">
<th className="px-3 py-2.5">#</th>
<th className="px-3 py-2.5">소환사</th>
<th className="px-3 py-2.5 text-center">승률</th>
<th className="px-3 py-2.5 text-center">게임</th>
<th className="px-3 py-2.5 text-center">KDA</th>
<th className="px-3 py-2.5 text-center">GPM</th>
<th className="px-3 py-2.5 text-center">킬관여</th>
<th className="px-3 py-2.5 text-center">분당 CS</th>
<th className="px-3 py-2.5">주 챔피언</th>
</tr>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={row.userId} className="border-b border-base-content/5 last:border-b-0">
<td className="px-3 py-2.5 text-xs text-base-content/30">
{index + 1}
</td>
<td className="px-3 py-2.5">
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="flex items-center gap-2 group"
<div className="overflow-x-auto">
<table className="lts-table min-w-[860px]">
<thead>
<tr>
<th scope="col" className="w-12 !text-center">
순위
</th>
<th scope="col">소환사</th>
<th scope="col" className="!text-right">
승률
</th>
<th scope="col" className="!text-right">
전적
</th>
<th scope="col" className="!text-right">
KDA
</th>
<th scope="col" className="!text-right">
GPM
</th>
<th scope="col" className="!text-right">
킬관여
</th>
<th scope="col" className="!text-right">
분당 CS
</th>
<th scope="col">주 챔피언</th>
</tr>
</thead>
<tbody>
{rows.map((row, index) => (
<tr key={row.userId} className="transition-colors hover:bg-sunken">
<td className="tabular text-center">
{index < 3 ? (
<span
className={`inline-grid size-6 place-items-center rounded-full text-xs font-extrabold ${
index === 0
? 'bg-gold text-accent-content'
: 'bg-sunken-strong text-content-muted'
}`}
>
<span className="w-7 h-7 bg-base-content/10 overflow-hidden">
<img
src={profileIconUrl(manifest, row.profileIconId)}
alt=""
className="w-full h-full object-cover"
loading="lazy"
/>
</span>
<span className="font-bold text-sm group-hover:text-primary">
{row.summonerName}
</span>
</Link>
</td>
<td className={`px-3 py-2.5 text-center text-sm font-black ${ratioClass(row.winRate)}`}>
{row.winRate}%
</td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums">
{row.games}
</td>
<td className="px-3 py-2.5 text-center text-xs font-bold tabular-nums">
{row.kda}
</td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums">
{row.avgGoldPerMin}
</td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums">
{row.avgKillParticipation}%
</td>
<td className="px-3 py-2.5 text-center text-xs tabular-nums">
{row.avgCsPerMin}
</td>
<td className="px-3 py-2.5">
<div className="flex flex-wrap gap-2 text-xs text-base-content/55">
{row.topChampions.map((champion) => (
<ChampionChip
key={champion.championId}
championId={champion.championId}
manifest={manifest}
/>
))}
</div>
</td>
</tr>
))}
{rows.length === 0 && (
<tr>
<td colSpan={9} className="py-10 text-center text-sm text-base-content/35">
아직 집계할 내전 기록이 없습니다.
</td>
</tr>
)}
</tbody>
</table>
{index + 1}
</span>
) : (
<span className="text-[13px] text-content-subtle">
{index + 1}
</span>
)}
</td>
<td>
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="group flex items-center gap-2.5"
>
<img
src={profileIconUrl(manifest, row.profileIconId)}
alt=""
className="size-8 rounded-full bg-sunken-strong object-cover"
loading="lazy"
/>
<span className="font-semibold text-content group-hover:text-primary">
{row.summonerName}
</span>
</Link>
</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 ${kdaClass(row.kda)}`}
>
{row.kda}
</td>
<td className="tabular text-right text-[13px]">
{row.avgGoldPerMin}
</td>
<td className="tabular text-right text-[13px]">
{row.avgKillParticipation}%
</td>
<td className="tabular text-right text-[13px]">
{row.avgCsPerMin}
</td>
<td>
<div className="flex gap-1">
{row.topChampions.map((champion) => (
<ChampionChip
key={champion.championId}
championId={champion.championId}
manifest={manifest}
/>
))}
</div>
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
function SideWinRate({ blue, red }: { blue: number; red: number }) {
const total = blue + red;
const blueShare = total > 0 ? (blue / total) * 100 : 50;
return (
<div className="w-full max-w-64 sm:w-64">
<div className="tabular flex justify-between text-xs font-semibold">
<span className="text-[#8fb6ff]">블루 {blue}%</span>
<span className="text-[#ff99a5]">레드 {red}%</span>
</div>
<div
className="mt-1.5 flex h-1.5 gap-0.5 overflow-hidden rounded-full"
role="img"
aria-label={`진영 승률 블루 ${blue}%, 레드 ${red}%`}
>
<span className="bg-win" style={{ width: `${blueShare}%` }} />
<span className="flex-1 bg-loss" />
</div>
</div>
);
}
export default function CommunityInternalStatsPage() {
const [searchParams] = useSearchParams();
const [searchParams, setSearchParams] = useSearchParams();
const view = searchParams.get('view') === 'ranking' ? 'ranking' : 'matches';
const championIdParam = Number(searchParams.get('championId'));
const championId =
Number.isFinite(championIdParam) && championIdParam > 0
@@ -308,99 +452,191 @@ export default function CommunityInternalStatsPage() {
const matches = matchesQuery.data?.pages.flatMap((page) => page.matches) ?? [];
const season =
leaderboardQuery.data?.season ?? matchesQuery.data?.pages[0]?.season ?? null;
const insights = insightsQuery.data;
const leaderboardRows = leaderboardQuery.data?.rows ?? [];
if (!DEFAULT_COMMUNITY_ID) {
return (
<main className="max-w-6xl mx-auto px-4 py-20 text-center text-sm text-amber-600">
`VITE_DEFAULT_COMMUNITY_ID` 설정이 필요합니다.
</main>
<PlainPage className="py-16">
<ErrorNote
title="커뮤니티가 설정되지 않았습니다"
description="VITE_DEFAULT_COMMUNITY_ID 설정이 필요합니다."
/>
</PlainPage>
);
}
function setView(next: 'matches' | 'ranking') {
const params = new URLSearchParams(searchParams);
if (next === 'matches') params.delete('view');
else params.set('view', next);
setSearchParams(params, { preventScrollReset: true });
}
return (
<main className="max-w-6xl mx-auto px-4 sm:px-6 py-6">
<Link to="/" className="text-xs text-base-content/40 hover:text-base-content">
← 홈으로
</Link>
<section className="mt-5 mb-6 border border-base-content/10 bg-base-100 p-5">
<div className="flex flex-col sm:flex-row sm:items-end sm:justify-between gap-4">
<div>
<p className="text-xs font-black uppercase tracking-[0.24em] text-primary">
Community Records
</p>
<h1 className="mt-2 text-3xl font-black text-base-content">
{communityQuery.data?.name ?? '커뮤니티'} 내전 전적
</h1>
<p className="mt-2 text-sm text-base-content/45">
토너먼트 코드로 수집된 결과를 기준으로 매치, 선수 순위, 팀 인사이트를 보여줍니다.
</p>
</div>
<div className="border border-base-content/10 px-4 py-3 text-sm text-base-content/55">
<div className="text-xs uppercase tracking-wider text-base-content/30">
시즌
<>
<PageHero
eyebrow={season?.label ?? '현재 시즌'}
title={`${communityQuery.data?.name ?? '커뮤니티'} 내전 전적`}
meta="토너먼트 코드로 수집한 내전 결과를 집계합니다."
actions={
insights ? (
<SideWinRate
blue={insights.sideWinRate.blue}
red={insights.sideWinRate.red}
/>
) : undefined
}
/>
<PageBody className="space-y-5">
<Panel aria-busy={insightsQuery.isLoading}>
<PanelHeader title="시즌 기록" />
{insightsQuery.error ? (
<div className="p-4">
<ErrorNote
title="시즌 기록을 불러오지 못했습니다"
action={
<Btn size="sm" onClick={() => void insightsQuery.refetch()}>
다시 시도
</Btn>
}
/>
</div>
<div className="mt-1 font-bold">{season?.label ?? '현재 시즌'}</div>
</div>
</div>
</section>
) : (
<div className="grid grid-cols-2 divide-line max-lg:[&>*:nth-child(even)]:border-l max-lg:[&>*:nth-child(n+3)]:border-t lg:grid-cols-5 lg:divide-x">
<HighlightCell
title="최고 KDA"
highlight={insights?.topKda}
isLoading={insightsQuery.isLoading}
/>
<HighlightCell
title="누적 킬"
highlight={insights?.mostKills}
isLoading={insightsQuery.isLoading}
/>
<HighlightCell
title="단일 경기 GPM"
highlight={insights?.topTeamGpm}
isLoading={insightsQuery.isLoading}
/>
<HighlightCell
title="킬 관여율"
highlight={insights?.topKillParticipation}
suffix="%"
isLoading={insightsQuery.isLoading}
/>
<HighlightCell
title="분당 CS"
highlight={insights?.bestFarm}
isLoading={insightsQuery.isLoading}
/>
</div>
)}
</Panel>
<section className="grid sm:grid-cols-2 lg:grid-cols-5 gap-3 mb-6">
<HighlightCard title="최고 KDA" highlight={insightsQuery.data?.topKda} />
<HighlightCard title="누적 킬 1위" highlight={insightsQuery.data?.mostKills} />
<HighlightCard title="단일 경기 GPM" highlight={insightsQuery.data?.topTeamGpm} />
<HighlightCard title="킬 관여율" highlight={insightsQuery.data?.topKillParticipation} suffix="%" />
<HighlightCard title="분당 CS" highlight={insightsQuery.data?.bestFarm} />
</section>
<section className="mb-8">
<div className="flex items-center justify-between gap-3 mb-3">
<h2 className="text-sm font-black text-base-content">최근 내전</h2>
<div className="text-xs text-base-content/35">
블루 승률 {insightsQuery.data?.sideWinRate.blue ?? 0}% · 레드 승률{' '}
{insightsQuery.data?.sideWinRate.red ?? 0}%
</div>
<div
className="flex items-center gap-1.5"
role="tablist"
aria-label="전적 보기"
>
<Chip
role="tab"
aria-selected={view === 'matches'}
selected={view === 'matches'}
onClick={() => setView('matches')}
>
최근 내전
</Chip>
<Chip
role="tab"
aria-selected={view === 'ranking'}
selected={view === 'ranking'}
onClick={() => setView('ranking')}
>
선수 순위
{leaderboardRows.length > 0 && (
<span className="tabular opacity-70">
{leaderboardRows.length}
</span>
)}
</Chip>
</div>
{matchesQuery.isLoading ? (
<div className="border border-base-content/10 bg-base-100 px-4 py-12 text-center text-sm text-base-content/35">
내전 기록을 불러오는 중...
</div>
) : (
<div className="space-y-3">
{matches.map((match) => (
<MatchCard key={match.matchId} match={match} manifest={ddragon} />
))}
{matches.length === 0 && (
<div className="border border-base-content/10 bg-base-100 px-4 py-12 text-center text-sm text-base-content/35">
아직 수집된 내전 결과가 없습니다.
{view === 'matches' ? (
<Panel>
{matchesQuery.isLoading ? (
<LoadingNote label="내전 기록을 불러오는 중" />
) : matchesQuery.error ? (
<div className="p-4">
<ErrorNote
title="내전 기록을 불러오지 못했습니다"
action={
<Btn size="sm" onClick={() => void matchesQuery.refetch()}>
다시 시도
</Btn>
}
/>
</div>
) : matches.length === 0 ? (
<EmptyNote
title="아직 수집된 내전 결과가 없습니다"
description="내전이 끝나고 결과가 수집되면 이곳에 표시됩니다."
/>
) : (
<ul className="divide-y divide-line">
{matches.map((match) => (
<MatchCard
key={match.matchId}
match={match}
manifest={ddragon}
/>
))}
</ul>
)}
{matchesQuery.hasNextPage && (
<div className="border-t border-line p-3">
<Btn
variant="ghost"
className="w-full"
disabled={matchesQuery.isFetchingNextPage}
loading={matchesQuery.isFetchingNextPage}
onClick={() => void matchesQuery.fetchNextPage()}
>
더 보기
</Btn>
</div>
)}
</div>
</Panel>
) : (
<Panel>
<PanelHeader
title="선수 순위"
description="승률 순. 포지션은 Riot 매치의 라인 정보를 기준으로 합니다."
/>
{leaderboardQuery.isLoading ? (
<LoadingNote label="순위를 불러오는 중" />
) : leaderboardQuery.error ? (
<div className="p-4">
<ErrorNote
title="순위를 불러오지 못했습니다"
action={
<Btn
size="sm"
onClick={() => void leaderboardQuery.refetch()}
>
다시 시도
</Btn>
}
/>
</div>
) : leaderboardRows.length === 0 ? (
<EmptyNote title="아직 집계할 내전 기록이 없습니다" />
) : (
<LeaderboardTable rows={leaderboardRows} manifest={ddragon} />
)}
</Panel>
)}
{matchesQuery.hasNextPage && (
<button
type="button"
className="mt-3 w-full border border-base-content/15 bg-base-100 py-3 text-sm font-bold text-base-content/60 hover:text-primary hover:border-primary/30 disabled:opacity-40"
disabled={matchesQuery.isFetchingNextPage}
onClick={() => matchesQuery.fetchNextPage()}
>
{matchesQuery.isFetchingNextPage ? '불러오는 중...' : '+ 더 보기'}
</button>
)}
</section>
<section>
<div className="flex items-center justify-between gap-3 mb-3">
<h2 className="text-sm font-black text-base-content">선수 순위</h2>
<div className="text-xs text-base-content/35">
포지션은 Riot Match의 라인 정보를 기준으로 합니다.
</div>
</div>
<LeaderboardTable
rows={leaderboardQuery.data?.rows ?? []}
manifest={ddragon}
/>
</section>
</main>
</PageBody>
</>
);
}