feat: enhance auction interactions and player statistics UI

This commit is contained in:
dahyeon committed 2026-11-11 20:06:22 +09:00
1 parent 6c582ba3cf
commit be4de61bb7
115 files changed
+13292 -2871

No files matched your search

+139 -50
View File
@@ -25,7 +25,6 @@ import {
Button,
EmptyNote,
ErrorNote,
LoadingNote,
PanelHeader,
PlainPage,
Skeleton,
@@ -49,6 +48,8 @@ const SCHEDULE_ROW_CLASS =
'grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-2 px-2 py-3.5 md:grid-cols-[7.5rem_minmax(0,1fr)_auto] md:items-center md:gap-4';
const RANKING_COLUMNS_CLASS =
'grid grid-cols-[1.5rem_minmax(0,1fr)_3rem] items-center gap-3 px-3';
const NEXT_MATCH_CONTENT_CLASS =
'flex min-h-[16rem] items-center py-8 md:min-h-[clamp(22rem,29vw,30rem)] md:py-12';
/** 순위 카드의 슬라이드 순서. undefined는 종합 순위. */
const RANKING_SLIDES = [
undefined,
@@ -86,7 +87,7 @@ function NextMatch({ match }: { match: MatchDetailResponse }) {
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`}
className={`${pageWidthClass()} ${NEXT_MATCH_CONTENT_CLASS}`}
>
<div className="w-full max-w-xl">
<p
@@ -127,6 +128,38 @@ function NextMatch({ match }: { match: MatchDetailResponse }) {
);
}
function NextMatchSkeleton() {
return (
<section className="bg-sunken" aria-busy="true" aria-label="다음 내전">
<span role="status" className="sr-only">다음 내전을 불러오는 중</span>
<div className={`${pageWidthClass()} ${NEXT_MATCH_CONTENT_CLASS}`}>
<div className="w-full max-w-xl">
<h1 className="text-sm font-semibold text-content-muted md:text-base">다음 내전</h1>
<div className="mt-3">
<Skeleton width="80%" height="clamp(2.3rem,5.75vw,4.025rem)" radius={2} />
</div>
<div className="mt-4 md:mt-6">
<Skeleton width="min(16rem,70%)" height="1.75rem" index={1} />
</div>
<div className="mt-3">
<Skeleton width="min(12rem,55%)" height="1.5rem" index={2} />
</div>
</div>
</div>
</section>
);
}
function UpcomingMatchesSkeleton({ title, limit }: { title: string; limit: number }) {
return (
<section aria-busy="true" aria-label={title}>
<PanelHeader title={title} variant="section" />
<span role="status" className="sr-only">{title}을 불러오는 중</span>
<ScheduleRowsSkeleton limit={limit} />
</section>
);
}
function UpcomingMatches({
matches,
title = '이어지는 내전',
@@ -185,9 +218,6 @@ function ScheduleStatus({
return (
<span className={`inline-flex min-h-6 items-center gap-1.5 whitespace-nowrap rounded-full border border-current/25 px-2.5 py-0.5 text-xs font-semibold ${statusColor}`}>
{stage === 'in-progress' && (
<span className="size-1.5 rounded-full bg-current" aria-hidden="true" />
)}
{label}
</span>
);
@@ -320,21 +350,37 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
);
}
function HistoryRecordsSkeleton({ limit }: { limit: number }) {
function ScheduleRowsSkeleton({
limit,
resultBelowOnMobile = false,
}: {
limit: number;
resultBelowOnMobile?: boolean;
}) {
return (
<ul className={SCHEDULE_LIST_CLASS} aria-hidden="true">
{Array.from({ length: limit }, (_, index) => (
<li key={index} className={SCHEDULE_ROW_CLASS}>
<div className="flex items-center gap-2 md:block md:space-y-2">
<Skeleton width={76} height={14} index={index} />
<Skeleton width={32} height={12} index={index} />
<div className="flex items-center gap-2 md:block md:space-y-0.5">
<Skeleton width={76} height={21} index={index} />
<Skeleton width={32} height={16} index={index} />
</div>
<div className="col-span-2 col-start-1 row-start-2 space-y-2 md:col-span-1 md:col-start-2 md:row-start-1">
<Skeleton width="60%" height={16} index={index} />
<Skeleton width={64} height={13} index={index} />
<div className="col-span-2 col-start-1 row-start-2 min-w-0 space-y-0.5 md:col-span-1 md:col-start-2 md:row-start-1">
<Skeleton width="60%" height={21} index={index} />
<Skeleton width={64} height={20} index={index} />
</div>
<div className="col-span-2 col-start-1 row-start-3 md:col-span-1 md:col-start-3 md:row-start-1">
<Skeleton width={96} height={16} index={index} />
<div className={`flex items-center gap-2 md:col-start-3 md:row-start-1 md:justify-self-end ${
resultBelowOnMobile
? 'col-span-2 col-start-1 row-start-3 md:col-span-1'
: 'col-start-2 row-start-1'
}`}>
<Skeleton
width={resultBelowOnMobile ? 96 : 64}
height={resultBelowOnMobile ? 20 : 24}
radius={resultBelowOnMobile ? 3 : 'rounded'}
index={index}
/>
<span className="hidden size-4 md:block" />
</div>
</li>
))}
@@ -557,13 +603,27 @@ function RecentMatchResultsSkeleton({ limit }: { limit: number }) {
<div className="divide-y divide-line border-y border-line" aria-hidden="true">
{Array.from({ length: limit }, (_, index) => (
<div key={index} className={RECENT_RESULT_ROW_CLASS}>
<div className="space-y-1">
<Skeleton width={80} height={16} index={index} />
<Skeleton width={64} height={12} index={index} />
<div className="flex items-center gap-2 md:block md:space-y-0.5">
<Skeleton width={80} height={21} index={index} />
<Skeleton width={48} height={16} index={index} />
</div>
<div className="space-y-2">
<Skeleton width={140} height={16} index={index} />
<Skeleton width={200} height={28} index={index} />
<div className="min-w-0">
<div className="flex items-center gap-1.5">
<Skeleton width={16} height={16} index={index} />
<Skeleton width="min(10rem,70%)" height={23} index={index} />
</div>
<div className="mt-1.5 flex min-w-0 items-center gap-2.5">
<div className="flex shrink-0 -space-x-1.5">
{Array.from({ length: 5 }, (_, memberIndex) => (
<Skeleton key={memberIndex} width={28} height={28} radius="rounded" index={index} />
))}
</div>
<Skeleton width="35%" height={16} index={index} />
</div>
</div>
<div className="flex items-center gap-2 md:justify-self-end">
<Skeleton width={40} height={23} index={index} />
<span className="hidden size-4 md:block" />
</div>
</div>
))}
@@ -577,6 +637,26 @@ const RANK_BADGE_CLASS = [
'bg-gold-tint text-gold',
] as const;
function RankingSkeleton() {
return (
<div className="min-h-[17.5rem]" aria-hidden="true">
{Array.from({ length: HOME_RANKING_LIMIT }, (_, index) => (
<div key={index} className={`${RANKING_COLUMNS_CLASS} py-2.5`}>
<Skeleton width={24} height={24} radius="rounded" index={index} />
<div className="flex min-w-0 items-center gap-2">
<Skeleton width={36} height={36} radius="rounded" index={index} className="shrink-0" />
<div className="min-w-0 flex-1 space-y-1">
<Skeleton width="80%" height={16} index={index} />
<Skeleton width="95%" height={12} index={index} />
</div>
</div>
<Skeleton width={40} height={20} index={index} className="justify-self-end" />
</div>
))}
</div>
);
}
/** 현재 시즌 순위표의 앞부분. 전적 화면과 같은 집계를 그대로 보여준다. */
function RankingPreview({ statsPath }: { statsPath: string }) {
const leaderboardQuery = useCommunityLeaderboard({ seasonId: 'current' });
@@ -605,16 +685,16 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
// 읽거나 누르려는 동안에는 멈추고, 직접 넘기면 그 슬라이드부터 다시 센다.
useEffect(() => {
if (paused || window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
if (leaderboardQuery.isPending || 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]);
}, [leaderboardQuery.isPending, paused, slide]);
return (
<aside
aria-busy={leaderboardQuery.isLoading}
aria-busy={leaderboardQuery.isPending}
onMouseEnter={() => setPaused(true)}
onMouseLeave={() => setPaused(false)}
onFocus={() => setPaused(true)}
@@ -622,7 +702,7 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
onTouchStart={(event) => setTouchStartX(event.touches[0]?.clientX)}
onTouchEnd={(event) => {
const endX = event.changedTouches[0]?.clientX;
if (touchStartX === undefined || endX === undefined) return;
if (leaderboardQuery.isPending || touchStartX === undefined || endX === undefined) return;
const distance = endX - touchStartX;
if (Math.abs(distance) > 48) move(distance < 0 ? 1 : -1);
setTouchStartX(undefined);
@@ -642,12 +722,11 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
}
/>
<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.isPending ? (
<>
<span role="status" className="sr-only">시즌 순위를 불러오는 중</span>
<RankingSkeleton />
</>
) : leaderboardQuery.isError ? (
<p className="p-3 text-sm text-content-muted">
순위를 불러오지 못했습니다.
@@ -727,7 +806,8 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
<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"
disabled={leaderboardQuery.isPending}
className="grid size-8 place-items-center rounded-full text-content-muted transition-colors hover:bg-card hover:text-content disabled:pointer-events-none disabled:opacity-40"
onClick={() => move(-1)}
>
<ChevronLeft className="size-4" aria-hidden="true" />
@@ -743,7 +823,8 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
<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"
disabled={leaderboardQuery.isPending}
className="grid size-8 place-items-center rounded-full text-content-muted transition-colors hover:bg-card hover:text-content disabled:pointer-events-none disabled:opacity-40"
onClick={() => move(1)}
>
<ChevronRight className="size-4" aria-hidden="true" />
@@ -861,6 +942,7 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
const allUpcomingMatches = upcomingMatchesQuery.data ?? [];
const [nextMatch, ...upcomingMatches] = allUpcomingMatches;
const bannerMatch = showArchive ? undefined : nextMatch;
const isBannerLoading = !showArchive && upcomingMatchesQuery.isPending;
const visibleUpcomingMatches = showArchive ? allUpcomingMatches : upcomingMatches;
const historyTotal = historyMatchesQuery.data?.total ?? 0;
const activeTotal = activeMatchesQuery.data?.total ?? 0;
@@ -873,14 +955,17 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
Math.ceil(historyTotal / (historyMatchesQuery.data?.limit ?? historyLimit)),
);
const isHistoryPageLoading =
historyMatchesQuery.isLoading ||
historyMatchesQuery.isPending ||
(historyMatchesQuery.isFetching && historyMatchesQuery.isPlaceholderData);
const isActivePageLoading =
activeMatchesQuery.isPending ||
(activeMatchesQuery.isFetching && activeMatchesQuery.isPlaceholderData);
const hasHistoryError =
Boolean(historyMatchesQuery.error) && !historyMatchesQuery.data;
const statsPath = `/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`;
const UpcomingStatusHeading = showArchive ? 'p' : 'h1';
const contentSpacing = 'space-y-8 pb-10 md:pb-16';
const contentTopPadding = bannerMatch ? 'pt-10 md:pt-16' : 'pt-5 sm:pt-6';
const contentTopPadding = bannerMatch || isBannerLoading ? 'pt-10 md:pt-16' : 'pt-5 sm:pt-6';
const content = (
<div className={`${pageWidthClass()} ${contentSpacing} ${contentTopPadding}`}>
@@ -892,11 +977,11 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
{activeMatchesQuery.isError && !activeMatchesQuery.data ? (
<ErrorNote title="진행 중인 일정을 불러오지 못했습니다"
action={<Button size="sm" label="다시 시도" onClick={() => void activeMatchesQuery.refetch()} />} />
) : activeMatchesQuery.isPlaceholderData ? (
<section aria-busy="true">
<PanelHeader title="진행 중인 일정" variant="section" />
<LoadingNote label="일정을 불러오는 중" />
</section>
) : isActivePageLoading ? (
<UpcomingMatchesSkeleton
title="진행 중인 일정"
limit={activeMatchesQuery.data?.matches.length || activeLimit}
/>
) : activeMatchesQuery.data &&
(activeMatchesQuery.data.matches.length > 0 || activePage > 1) ? (
<UpcomingMatches
@@ -924,10 +1009,11 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
)}
/>
) : null}
{upcomingMatchesQuery.isLoading ? (
<UpcomingStatusHeading className="text-sm text-content-muted" aria-busy="true">
{eventLabel} 일정을 불러오는 중
</UpcomingStatusHeading>
{upcomingMatchesQuery.isPending ? (
<UpcomingMatchesSkeleton
title={showArchive ? '다가오는 일정' : '이어지는 내전'}
limit={showArchive ? UPCOMING_MATCH_LIST_LIMIT : UPCOMING_MATCH_LIST_LIMIT - 1}
/>
) : upcomingMatchesQuery.isError && !upcomingMatchesQuery.data ? (
<div className="flex flex-wrap items-center gap-3">
<UpcomingStatusHeading className="text-sm text-content-muted">
@@ -976,11 +1062,14 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
}
/>
{isHistoryPageLoading ? (
showArchive ? (
<HistoryRecordsSkeleton limit={historyLimit} />
) : (
<RecentMatchResultsSkeleton limit={historyLimit} />
)
<>
<span role="status" className="sr-only">{showArchive ? '종료된 일정과 결과' : '최근 내전 결과'}를 불러오는 중</span>
{showArchive ? (
<ScheduleRowsSkeleton limit={historyLimit} resultBelowOnMobile />
) : (
<RecentMatchResultsSkeleton limit={historyLimit} />
)}
</>
) : hasHistoryError ? (
<div className="p-4">
<ErrorNote
@@ -1021,8 +1110,8 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
);
return (
<main>
{bannerMatch && <NextMatch match={bannerMatch} />}
<main className="[--color-skeleton:var(--color-text-disabled)]">
{isBannerLoading ? <NextMatchSkeleton /> : bannerMatch && <NextMatch match={bannerMatch} />}
{content}
{!showArchive && (
<HomeHallOfFame introReady={!upcomingMatchesQuery.isPending} />