refactor(web): restyle home schedule and results as divided lists

Replace the panel cards on the home page with section lists separated
by horizontal rules, sharing one schedule row layout. Remove the
obsolete home history test and record the design QA notes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
dahyeonandClaude Fable 5.2 committed 2026-11-11 13:48:41 +09:00
1 parent cc358697d4
commit 9064340584
3 files changed
+236 -200

No files matched your search

+162 -168
View File
@@ -25,9 +25,7 @@ import {
EmptyNote,
ErrorNote,
LoadingNote,
Panel,
PanelHeader,
Pill,
PlainPage,
Skeleton,
pageWidthClass,
@@ -45,6 +43,9 @@ const MATCH_ARCHIVE_PAGE_SIZE = 10;
const HOME_HISTORY_LIMIT = 4;
const HOME_RANKING_LIMIT = 5;
const DEFAULT_MAP_ID = 11;
const SCHEDULE_LIST_CLASS = 'divide-y divide-line border-y border-line';
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';
/** 순위 카드의 슬라이드 순서. undefined는 종합 순위. */
@@ -128,60 +129,129 @@ function NextMatch({ match }: { match: MatchDetailResponse }) {
function UpcomingMatches({
matches,
title = '이어지는 내전',
actions,
footer,
}: {
matches: MatchDetailResponse[];
title?: string;
actions?: ReactNode;
footer?: ReactNode;
}) {
return (
<Panel>
<PanelHeader title={title} />
<ul className="divide-y divide-line">
{matches.map((match) => {
const schedule = getHomeMatchSchedule(match.scheduledAt);
const { capacity, label } = getHomeMatchEnrollment(match);
return (
<li key={match._id}>
<Link
to={`/match/${match._id}`}
className="group grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 px-4 py-3 transition-colors hover:bg-sunken sm:grid-cols-[8rem_minmax(0,1fr)_auto_1rem] sm:px-5"
>
<time
dateTime={match.scheduledAt}
className="tabular col-start-1 text-xs text-content-muted"
>
{schedule?.compact ?? '일정 미정'}
</time>
<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">
{match.status === 'recruiting'
? label
: getMatchStageLabel(match)}{' '}
· {capacity}
</p>
<ChevronRight
className="col-start-2 row-span-3 row-start-1 size-4 text-content-muted sm:col-start-4 sm:row-span-1"
aria-hidden="true"
/>
</Link>
</li>
);
})}
<section>
<PanelHeader title={title} variant="section" actions={actions} />
<ul className={SCHEDULE_LIST_CLASS}>
{matches.map((match) => (
<li key={match._id}>
<ScheduleMatchRow match={match} />
</li>
))}
</ul>
{matches.length === 0 && (
<EmptyNote size="sm" title="이 페이지에 표시할 일정이 없습니다." />
)}
{footer}
</Panel>
</section>
);
}
function ScheduleMatchRow({ match }: { match: MatchDetailResponse }) {
const { capacity, label } = getHomeMatchEnrollment(match);
return (
<ScheduleRow
href={`/match/${match._id}`}
scheduledAt={match.scheduledAt}
title={match.title}
meta={`참가 ${capacity}`}
result={<ScheduleStatus match={match} label={match.status === 'recruiting' ? label : undefined} />}
/>
);
}
function ScheduleStatus({
match,
label = getMatchStageLabel(match),
}: {
match: Pick<MatchSummaryResponse, 'status' | 'eventProgress'>;
label?: string;
}) {
const stage = match.eventProgress?.stage ?? match.status;
const statusColor = stage === 'in-progress'
? 'text-leaf'
: stage === 'auction'
? 'text-gold'
: 'text-content-muted';
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>
);
}
function ScheduleRow({
href,
scheduledAt,
title,
meta,
result,
resultBelowOnMobile = false,
}: {
href: string;
scheduledAt: string;
title: string;
meta: ReactNode;
result: ReactNode;
resultBelowOnMobile?: boolean;
}) {
const schedule = getHomeMatchSchedule(scheduledAt);
return (
<Link
to={href}
className={`${SCHEDULE_ROW_CLASS} group transition-colors hover:bg-sunken focus-visible:-outline-offset-2`}
>
<time
dateTime={schedule ? scheduledAt : undefined}
className="tabular flex flex-wrap items-baseline gap-x-2 md:block"
>
<span className="text-[15px] font-semibold leading-snug text-content">
{schedule ? `${schedule.month}/${schedule.day} (${schedule.weekday})` : '일정 미정'}
</span>
{schedule && (
<span className="text-xs text-content-subtle md:mt-0.5 md:block">
{schedule.time}
</span>
)}
</time>
<div className="col-span-2 col-start-1 row-start-2 min-w-0 md:col-span-1 md:col-start-2 md:row-start-1">
<h3 className="text-[15px] font-semibold leading-snug text-content [overflow-wrap:anywhere] group-hover:underline group-hover:underline-offset-2">
{title}
</h3>
<p className="tabular mt-0.5 text-[13px] text-content-subtle">
{meta}
</p>
</div>
<div className={`flex min-w-0 items-center gap-2 md:col-start-3 md:row-start-1 md:max-w-72 md:justify-self-end ${
resultBelowOnMobile
? 'col-span-2 col-start-1 row-start-3 md:col-span-1'
: 'col-start-2 row-start-1'
}`}>
<span className="min-w-0 text-[13px]">
{result}
</span>
<ChevronRight className="hidden size-4 shrink-0 text-content-muted md:block" aria-hidden="true" />
</div>
</Link>
);
}
function HistoryResult({ match }: { match: MatchSummaryResponse }) {
const result = match.historyResult;
const teamLabelClass = 'min-w-0 break-words text-content-muted md:truncate';
const teamLabelClass = 'min-w-0 text-content-muted [overflow-wrap:anywhere]';
if (match.status === 'finished' && result) {
switch (result.type) {
case 'score': {
@@ -240,14 +310,7 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
}
}
if (match.status === 'team-built' || match.status === 'in-progress') {
return (
<Pill
tone={match.status === 'in-progress' ? 'live' : 'neutral'}
dot={match.status === 'in-progress'}
>
{getMatchStageLabel(match)}
</Pill>
);
return <ScheduleStatus match={match} />;
}
return (
<span className="text-content-muted">
@@ -256,65 +319,25 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
);
}
function HistoryTableColumns() {
return (
<>
<colgroup>
<col className="w-36" />
<col />
<col className="w-44" />
<col className="w-16" />
</colgroup>
<thead>
<tr>
<th scope="col">일정</th>
<th scope="col">대회</th>
<th scope="col">상태·결과</th>
<th scope="col" className="!text-right">
참가
</th>
</tr>
</thead>
</>
);
}
function HistoryRecordsSkeleton({ limit }: { limit: number }) {
const rows = Array.from({ length: limit });
return (
<>
<div className="hidden md:block">
<table className="lts-table table-fixed" aria-hidden="true">
<HistoryTableColumns />
<tbody>
{rows.map((_, index) => (
<tr key={index}>
<td>
<Skeleton width={96} height={14} index={index} />
</td>
<td>
<Skeleton width="60%" height={14} index={index} />
</td>
<td>
<Skeleton width={56} height={14} index={index} />
</td>
<td>
<Skeleton width={28} height={14} className="ml-auto" />
</td>
</tr>
))}
</tbody>
</table>
</div>
<div className="divide-y divide-line md:hidden" aria-hidden="true">
{rows.map((_, index) => (
<div key={index} className="space-y-2 px-4 py-3">
<Skeleton width={110} height={12} index={index} />
<Skeleton width="70%" height={16} index={index} />
<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>
))}
</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>
<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>
</li>
))}
</ul>
);
}
@@ -335,67 +358,26 @@ function HistoryRecords({
match,
title: getHistoryMatchTitle(match.title, schedule),
href: `/match/${match._id}`,
schedule: schedule?.compact ?? '일정 미정',
map:
match.mapId === DEFAULT_MAP_ID ? undefined : mapIdToLabel(match.mapId),
};
});
return (
<>
<div className="hidden md:block">
<table className="lts-table table-fixed">
<HistoryTableColumns />
<tbody>
{rows.map(({ match, title, href, schedule, map }) => (
<tr key={match._id} className="transition-colors hover:bg-sunken">
<td className="tabular whitespace-nowrap text-[13px] text-content-muted">
<time dateTime={match.scheduledAt}>{schedule}</time>
</td>
<td>
<Link
to={href}
className="block truncate font-semibold text-content hover:underline"
title={match.title}
>
{title}
</Link>
{map && <p className="text-xs text-content-muted">{map}</p>}
</td>
<td className="text-[13px]">
<HistoryResult match={match} />
</td>
<td className="tabular whitespace-nowrap text-right text-[13px] text-content-muted">
{match.participants.length}명
</td>
</tr>
))}
</tbody>
</table>
</div>
<ul className="divide-y divide-line md:hidden">
{rows.map(({ match, title, href, schedule, map }) => (
<li key={match._id}>
<Link
to={href}
className="group block px-4 py-3 transition-colors hover:bg-sunken"
>
<div className="tabular flex flex-wrap justify-between gap-x-3 text-xs text-content-muted">
<time dateTime={match.scheduledAt}>{schedule}</time>
<span>{match.participants.length}명</span>
</div>
<p className="mt-0.5 break-words text-[15px] font-semibold leading-snug text-content group-hover:underline">
{title}
</p>
<div className="mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-1 text-[13px]">
<HistoryResult match={match} />
{map && <span className="text-content-muted">· {map}</span>}
</div>
</Link>
</li>
))}
</ul>
</>
<ul className={SCHEDULE_LIST_CLASS}>
{rows.map(({ match, title, href, map }) => (
<li key={match._id}>
<ScheduleRow
href={href}
scheduledAt={match.scheduledAt}
title={title}
meta={<>참가 {match.participants.length}명{map && <> · {map}</>}</>}
result={<HistoryResult match={match} />}
resultBelowOnMobile
/>
</li>
))}
</ul>
);
}
@@ -772,6 +754,7 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
}
interface MatchPaginationProps {
label: string;
page: number;
pageCount: number;
total: number;
@@ -781,6 +764,7 @@ interface MatchPaginationProps {
}
function MatchPagination({
label,
page,
pageCount,
total,
@@ -789,7 +773,7 @@ function MatchPagination({
onNext,
}: MatchPaginationProps) {
return (
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-t border-line px-4 py-2.5 sm:px-5">
<nav aria-label={label} className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 px-2 py-2.5">
<span className="tabular text-xs text-content-muted">
총 {total.toLocaleString('ko-KR')}개 · {page} / {pageCount}
</span>
@@ -811,7 +795,7 @@ function MatchPagination({
onClick={onNext}
/>
</div>
</div>
</nav>
);
}
@@ -893,9 +877,8 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
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 contentSpacing = 'space-y-8 pb-10 md:pb-16';
const contentTopPadding = bannerMatch ? 'pt-10 md:pt-16' : 'pt-5 sm:pt-6';
const content = (
@@ -909,17 +892,27 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
<ErrorNote title="진행 중인 일정을 불러오지 못했습니다"
action={<Button size="sm" label="다시 시도" onClick={() => void activeMatchesQuery.refetch()} />} />
) : activeMatchesQuery.isPlaceholderData ? (
<Panel aria-busy="true">
<PanelHeader title="진행 중인 일정" />
<section aria-busy="true">
<PanelHeader title="진행 중인 일정" variant="section" />
<LoadingNote label="일정을 불러오는 중" />
</Panel>
</section>
) : activeMatchesQuery.data &&
(activeMatchesQuery.data.matches.length > 0 || activePage > 1) ? (
<UpcomingMatches
matches={activeMatchesQuery.data.matches}
title="진행 중인 일정"
actions={!showArchive && (
<Link
to="/inhouse"
className="inline-flex min-h-6 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>
)}
footer={showArchive && (activePageCount > 1 || activePage > 1) && (
<MatchPagination
label="진행 중인 일정 페이지"
page={activePage}
pageCount={activePageCount}
total={activeTotal}
@@ -967,10 +960,10 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
: 'grid items-start gap-8 lg:grid-cols-[minmax(0,1fr)_20rem]'
}
>
<HistorySection aria-busy={isHistoryPageLoading} aria-live="polite">
<section aria-busy={isHistoryPageLoading} aria-live="polite">
<PanelHeader
title={showArchive ? '종료된 일정과 결과' : '최근 내전 결과'}
variant={showArchive ? 'panel' : 'section'}
variant="section"
actions={
<Link
to={showArchive ? statsPath : '/inhouse'}
@@ -1011,6 +1004,7 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
)}
{showArchive && !hasHistoryError && (historyTotal > 0 || historyPage > 1) && (
<MatchPagination
label="종료된 일정 페이지"
page={historyPage}
pageCount={historyPageCount}
total={historyTotal}
@@ -1019,7 +1013,7 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
onNext={() => setPage('page', historyPage + 1)}
/>
)}
</HistorySection>
</section>
{!showArchive && <RankingPreview statsPath={statsPath} />}
</div>
</div>
-32
View File
@@ -1,32 +0,0 @@
import assert from "node:assert/strict";
import { readFile } from "node:fs/promises";
import test from "node:test";
const homePageSource = await readFile(
new URL("../src/pages/HomePage.tsx", import.meta.url),
"utf8",
);
test("shares the four history columns between records and the loading state", () => {
const columns = sourceForFunction("HistoryTableColumns");
const skeleton = sourceForFunction("HistoryRecordsSkeleton");
const records = sourceForFunction("HistoryRecords");
assert.equal(columns.match(/<col(?:\s|\/|>)/g)?.length, 4);
assert.deepEqual(
Array.from(columns.matchAll(/<th\b[^>]*>\s*([^<]+?)\s*<\/th>/g), (match) => match[1]),
["일정", "대회", "상태·결과", "참가"],
);
assert.match(skeleton, /<HistoryTableColumns\s*\/>/);
assert.match(records, /<HistoryTableColumns\s*\/>/);
assert.doesNotMatch(skeleton, /<HistoryResult\b/);
});
function sourceForFunction(name: string): string {
const start = homePageSource.indexOf(`function ${name}(`);
assert.notEqual(start, -1, `${name} should exist`);
const nextFunction = homePageSource.indexOf("\nfunction ", start + 1);
assert.notEqual(nextFunction, -1, `${name} should have a following function`);
return homePageSource.slice(start, nextFunction);
}