feat(web): redesign team progress experience
This commit is contained in:
1 parent
81b951889f
commit
bb32c26694
7 files changed
+973
-183
No files matched your search
@@ -0,0 +1,138 @@
|
|||||||
|
import type {
|
||||||
|
CompetitionTeamView,
|
||||||
|
SeriesProjection,
|
||||||
|
TeamId,
|
||||||
|
} from "@lolympus/contracts";
|
||||||
|
import type { ReactNode } from "react";
|
||||||
|
import {
|
||||||
|
getTeamSeriesPresentation,
|
||||||
|
type TeamSeriesTone,
|
||||||
|
} from "../../pages/match-team-progress-view";
|
||||||
|
import { isSeriesEntryWinner } from "./series-score-card-model";
|
||||||
|
|
||||||
|
const STATUS_TONE_CLASS: Record<TeamSeriesTone, string> = {
|
||||||
|
muted: "border-base-content/15 bg-base-200 text-base-content",
|
||||||
|
ready: "border-primary/50 bg-primary/10 text-base-content",
|
||||||
|
live: "border-info/60 bg-info/10 text-base-content",
|
||||||
|
completed: "border-base-content/20 bg-base-200 text-base-content",
|
||||||
|
adjudicated: "border-warning/60 bg-warning/15 text-base-content",
|
||||||
|
};
|
||||||
|
|
||||||
|
export function TeamSeriesCard({
|
||||||
|
series,
|
||||||
|
displayLabel,
|
||||||
|
teamById,
|
||||||
|
highlightedTeamId,
|
||||||
|
emphasized = false,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
series: SeriesProjection;
|
||||||
|
displayLabel: string;
|
||||||
|
teamById: ReadonlyMap<TeamId, CompetitionTeamView>;
|
||||||
|
highlightedTeamId: TeamId;
|
||||||
|
emphasized?: boolean;
|
||||||
|
children?: ReactNode;
|
||||||
|
}) {
|
||||||
|
const presentation = getTeamSeriesPresentation(series);
|
||||||
|
const headingId = `team-series-${String(series.seriesId)}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<article
|
||||||
|
className={`overflow-hidden border bg-base-100 ${
|
||||||
|
emphasized ? "border-primary/30" : "border-base-content/10"
|
||||||
|
}`}
|
||||||
|
aria-labelledby={headingId}
|
||||||
|
>
|
||||||
|
<header
|
||||||
|
className={`flex flex-wrap items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 ${
|
||||||
|
emphasized
|
||||||
|
? "border-primary/20 bg-primary/[0.035]"
|
||||||
|
: "border-base-content/10 bg-base-200/40"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<div className="min-w-0">
|
||||||
|
<h3
|
||||||
|
id={headingId}
|
||||||
|
className="break-words text-base font-black text-base-content"
|
||||||
|
>
|
||||||
|
{displayLabel}
|
||||||
|
</h3>
|
||||||
|
<div className="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-content-muted">
|
||||||
|
{series.code && (
|
||||||
|
<code className="break-all font-mono">{series.code}</code>
|
||||||
|
)}
|
||||||
|
<span>{seriesRuleLabel(series)}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
className={`shrink-0 border-l-2 px-2 py-1 text-xs font-bold ${STATUS_TONE_CLASS[presentation.tone]}`}
|
||||||
|
>
|
||||||
|
{presentation.label}
|
||||||
|
</span>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<ul
|
||||||
|
className="divide-y divide-base-content/10"
|
||||||
|
aria-label={`${displayLabel} 대진`}
|
||||||
|
>
|
||||||
|
{series.entries.map((entry) => {
|
||||||
|
const team = entry.teamId ? teamById.get(entry.teamId) : undefined;
|
||||||
|
const teamName =
|
||||||
|
team?.name ?? (entry.teamId ? "알 수 없는 팀" : "상대 결정 대기");
|
||||||
|
const isHighlightedTeam = entry.teamId === highlightedTeamId;
|
||||||
|
const isWinner = isSeriesEntryWinner(series, entry.teamId);
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
key={entry.slot}
|
||||||
|
className={`grid min-h-12 grid-cols-[minmax(0,1fr)_3rem] items-center gap-3 px-4 py-2.5 sm:px-5 ${
|
||||||
|
isHighlightedTeam ? "bg-base-200/35" : ""
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||||
|
<span
|
||||||
|
className={`min-w-0 break-words text-sm ${
|
||||||
|
isWinner || isHighlightedTeam
|
||||||
|
? "font-bold text-base-content"
|
||||||
|
: "text-content-subtle"
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span className="sr-only">{entry.slot} 슬롯: </span>
|
||||||
|
{teamName}
|
||||||
|
</span>
|
||||||
|
{isHighlightedTeam && (
|
||||||
|
<span className="border border-base-content/15 bg-base-100 px-1.5 py-0.5 text-[11px] font-bold text-base-content">
|
||||||
|
이 팀
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{isWinner && (
|
||||||
|
<span className="border-l-2 border-success bg-success/10 px-1.5 py-0.5 text-[11px] font-bold text-base-content">
|
||||||
|
승리
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<span className="text-right font-mono text-base font-bold tabular-nums text-base-content">
|
||||||
|
<span className="sr-only">
|
||||||
|
{presentation.showScore ? "게임 승수: " : "점수 없음"}
|
||||||
|
</span>
|
||||||
|
{presentation.showScore ? (
|
||||||
|
entry.gameWins
|
||||||
|
) : (
|
||||||
|
<span aria-hidden="true">—</span>
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
{children}
|
||||||
|
</article>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function seriesRuleLabel(series: SeriesProjection): string {
|
||||||
|
if (series.rule.type === "fixed-games") {
|
||||||
|
return `${series.rule.gameCount}게임`;
|
||||||
|
}
|
||||||
|
return `${series.rule.maxGames}전 ${series.rule.winsRequired}선승`;
|
||||||
|
}
|
||||||
@@ -0,0 +1,264 @@
|
|||||||
|
import type { TeamTournamentCodeView } from "@lolympus/contracts";
|
||||||
|
import { Check, Copy, LoaderCircle } from "lucide-react";
|
||||||
|
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
||||||
|
import {
|
||||||
|
copyTournamentCode,
|
||||||
|
getNextTournamentCodeExpiryDelay,
|
||||||
|
getTournamentCodeCopyLabel,
|
||||||
|
getTournamentCodeExpiryLabel,
|
||||||
|
getTournamentCodePresentation,
|
||||||
|
type TournamentCodeCopyFeedback,
|
||||||
|
type TournamentCodeTone,
|
||||||
|
} from "../../pages/match-team-progress-view";
|
||||||
|
|
||||||
|
const CODE_TONE_CLASS: Record<TournamentCodeTone, string> = {
|
||||||
|
pending: "border-base-content/15 bg-base-200 text-base-content",
|
||||||
|
available: "border-primary/50 bg-primary/10 text-base-content",
|
||||||
|
expired: "border-error/50 bg-error/10 text-base-content",
|
||||||
|
used: "border-base-content/20 bg-base-200 text-base-content",
|
||||||
|
};
|
||||||
|
|
||||||
|
type VisibleFeedback = TournamentCodeCopyFeedback & { gameSlotId: string };
|
||||||
|
|
||||||
|
export function TeamTournamentCodes({
|
||||||
|
assignments,
|
||||||
|
seriesLabel,
|
||||||
|
}: {
|
||||||
|
assignments: readonly TeamTournamentCodeView[];
|
||||||
|
seriesLabel: string;
|
||||||
|
}) {
|
||||||
|
const [copyingSlotId, setCopyingSlotId] = useState<string | null>(null);
|
||||||
|
const [feedback, setFeedback] = useState<VisibleFeedback | null>(null);
|
||||||
|
const [now, setNow] = useState(() => Date.now());
|
||||||
|
const clearFeedbackTimeoutRef = useRef<number | null>(null);
|
||||||
|
|
||||||
|
useEffect(
|
||||||
|
() => () => {
|
||||||
|
if (clearFeedbackTimeoutRef.current !== null) {
|
||||||
|
window.clearTimeout(clearFeedbackTimeoutRef.current);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const delay = getNextTournamentCodeExpiryDelay(assignments, now);
|
||||||
|
if (delay === null) return;
|
||||||
|
const timeoutId = window.setTimeout(
|
||||||
|
() => setNow(Date.now()),
|
||||||
|
Math.max(1, delay),
|
||||||
|
);
|
||||||
|
return () => window.clearTimeout(timeoutId);
|
||||||
|
}, [assignments, now]);
|
||||||
|
|
||||||
|
if (assignments.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className="border-t border-base-content/10 px-4 py-5 sm:px-5">
|
||||||
|
<p role="status" className="text-sm text-content-muted">
|
||||||
|
이 경기에 배정된 토너먼트 코드가 없습니다.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleCopy(assignment: TeamTournamentCodeView) {
|
||||||
|
if (!assignment.code || copyingSlotId !== null) return;
|
||||||
|
if (clearFeedbackTimeoutRef.current !== null) {
|
||||||
|
window.clearTimeout(clearFeedbackTimeoutRef.current);
|
||||||
|
clearFeedbackTimeoutRef.current = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const slotId = String(assignment.gameSlotId);
|
||||||
|
const gameLabel = `${seriesLabel} ${assignment.ordinal}세트`;
|
||||||
|
const currentTime = readCurrentTime();
|
||||||
|
setNow(currentTime);
|
||||||
|
if (!getTournamentCodePresentation(assignment, currentTime).canCopy) {
|
||||||
|
setFeedback({
|
||||||
|
kind: "error",
|
||||||
|
gameSlotId: slotId,
|
||||||
|
message: `${gameLabel} 코드는 만료되었거나 사용할 수 없어 복사하지 않았습니다.`,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setCopyingSlotId(slotId);
|
||||||
|
setFeedback(null);
|
||||||
|
const clipboard = navigator.clipboard;
|
||||||
|
const result = await copyTournamentCode(
|
||||||
|
clipboard?.writeText ? clipboard.writeText.bind(clipboard) : undefined,
|
||||||
|
assignment.code,
|
||||||
|
gameLabel,
|
||||||
|
);
|
||||||
|
setCopyingSlotId(null);
|
||||||
|
setFeedback({ ...result, gameSlotId: slotId });
|
||||||
|
|
||||||
|
if (result.kind === "success") {
|
||||||
|
clearFeedbackTimeoutRef.current = window.setTimeout(() => {
|
||||||
|
setFeedback(null);
|
||||||
|
clearFeedbackTimeoutRef.current = null;
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
className="border-t border-base-content/10"
|
||||||
|
aria-label={`${seriesLabel} 토너먼트 코드`}
|
||||||
|
>
|
||||||
|
<div className="flex flex-wrap items-baseline justify-between gap-2 bg-base-200/25 px-4 py-2.5 sm:px-5">
|
||||||
|
<h4 className="text-sm font-bold text-base-content">게임 코드</h4>
|
||||||
|
<p className="text-xs text-content-muted">
|
||||||
|
세트에 맞는 코드를 복사해 클라이언트에 입력하세요.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<ol className="divide-y divide-base-content/10">
|
||||||
|
{assignments.map((assignment) => {
|
||||||
|
const slotId = String(assignment.gameSlotId);
|
||||||
|
const presentation = getTournamentCodePresentation(assignment, now);
|
||||||
|
const isCopying = copyingSlotId === slotId;
|
||||||
|
const copied =
|
||||||
|
feedback?.kind === "success" && feedback.gameSlotId === slotId;
|
||||||
|
return (
|
||||||
|
<li
|
||||||
|
key={slotId}
|
||||||
|
className="grid gap-3 px-4 py-3 sm:px-5 md:grid-cols-[5.5rem_minmax(0,1fr)_auto] md:items-center"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<p className="text-sm font-bold text-base-content">
|
||||||
|
{assignment.ordinal}세트
|
||||||
|
</p>
|
||||||
|
<p className="mt-0.5 text-xs text-content-muted">
|
||||||
|
전체 Game {assignment.displayNumber}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="min-w-0">
|
||||||
|
{assignment.code ? (
|
||||||
|
<AutoSizingCodeField
|
||||||
|
label={`${seriesLabel} ${assignment.ordinal}세트 토너먼트 코드`}
|
||||||
|
value={assignment.code}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<p className="text-sm font-bold text-content-muted">
|
||||||
|
발급 대기 중
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{assignment.code &&
|
||||||
|
assignment.state === "reserved" &&
|
||||||
|
assignment.expiresAt && (
|
||||||
|
<p className="mt-1 text-xs text-content-muted">
|
||||||
|
<time dateTime={assignment.expiresAt}>
|
||||||
|
{getTournamentCodeExpiryLabel(
|
||||||
|
assignment.expiresAt,
|
||||||
|
now,
|
||||||
|
)}
|
||||||
|
</time>
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex flex-wrap items-center gap-2 md:justify-end">
|
||||||
|
<span
|
||||||
|
className={`border-l-2 px-2 py-1 text-xs font-bold ${CODE_TONE_CLASS[presentation.tone]}`}
|
||||||
|
role="status"
|
||||||
|
aria-live="polite"
|
||||||
|
aria-atomic="true"
|
||||||
|
>
|
||||||
|
{presentation.label}
|
||||||
|
</span>
|
||||||
|
{assignment.code && assignment.state === "reserved" && (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="inline-flex min-h-11 items-center justify-center gap-1.5 border border-base-content/20 bg-base-100 px-3 text-sm font-bold text-base-content hover:border-primary/50 hover:bg-primary/5 focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-70"
|
||||||
|
aria-label={
|
||||||
|
presentation.canCopy
|
||||||
|
? getTournamentCodeCopyLabel(assignment, seriesLabel)
|
||||||
|
: `${seriesLabel} ${assignment.ordinal}세트 토너먼트 코드 만료됨`
|
||||||
|
}
|
||||||
|
disabled={!presentation.canCopy || copyingSlotId !== null}
|
||||||
|
onClick={() => void handleCopy(assignment)}
|
||||||
|
>
|
||||||
|
{!presentation.canCopy ? null : isCopying ? (
|
||||||
|
<LoaderCircle
|
||||||
|
className="h-4 w-4 animate-spin motion-reduce:animate-none"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
) : copied ? (
|
||||||
|
<Check className="h-4 w-4" aria-hidden="true" />
|
||||||
|
) : (
|
||||||
|
<Copy className="h-4 w-4" aria-hidden="true" />
|
||||||
|
)}
|
||||||
|
{!presentation.canCopy
|
||||||
|
? "복사 불가"
|
||||||
|
: isCopying
|
||||||
|
? "복사 중"
|
||||||
|
: copied
|
||||||
|
? "복사됨"
|
||||||
|
: "복사"}
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
{feedback && (
|
||||||
|
<p
|
||||||
|
className={`border-t px-4 py-2.5 text-sm sm:px-5 ${
|
||||||
|
feedback.kind === "error"
|
||||||
|
? "border-error/30 bg-error/10 text-base-content"
|
||||||
|
: "border-success/30 bg-success/10 text-base-content"
|
||||||
|
}`}
|
||||||
|
role={feedback.kind === "error" ? "alert" : "status"}
|
||||||
|
aria-live={feedback.kind === "error" ? "assertive" : "polite"}
|
||||||
|
aria-atomic="true"
|
||||||
|
>
|
||||||
|
{feedback.message}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function readCurrentTime(): number {
|
||||||
|
return Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
function AutoSizingCodeField({
|
||||||
|
label,
|
||||||
|
value,
|
||||||
|
}: {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
}) {
|
||||||
|
const fieldRef = useRef<HTMLTextAreaElement>(null);
|
||||||
|
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
const resizeToContent = () => {
|
||||||
|
const field = fieldRef.current;
|
||||||
|
if (!field) return;
|
||||||
|
field.style.height = "auto";
|
||||||
|
const borderHeight = field.offsetHeight - field.clientHeight;
|
||||||
|
field.style.height = `${field.scrollHeight + borderHeight}px`;
|
||||||
|
};
|
||||||
|
|
||||||
|
resizeToContent();
|
||||||
|
window.addEventListener("resize", resizeToContent);
|
||||||
|
return () => window.removeEventListener("resize", resizeToContent);
|
||||||
|
}, [value]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<textarea
|
||||||
|
ref={fieldRef}
|
||||||
|
aria-label={label}
|
||||||
|
className="block min-h-11 w-full resize-none overflow-hidden border border-base-content/15 bg-base-100 px-3 py-2 font-mono text-sm font-bold leading-5 text-base-content focus-visible:ring-2 focus-visible:ring-primary"
|
||||||
|
onClick={(event) => event.currentTarget.select()}
|
||||||
|
onFocus={(event) => event.currentTarget.select()}
|
||||||
|
readOnly
|
||||||
|
rows={1}
|
||||||
|
spellCheck={false}
|
||||||
|
value={value}
|
||||||
|
wrap="soft"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,15 +1,27 @@
|
|||||||
import type { CompetitionDetailResponse } from "@lolympus/contracts";
|
import type {
|
||||||
import { useEffect, useRef, useState } from "react";
|
CompetitionDetailResponse,
|
||||||
|
SeriesProjection,
|
||||||
|
} from "@lolympus/contracts";
|
||||||
|
import { ArrowLeft, ChevronDown, UsersRound } from "lucide-react";
|
||||||
|
import { useEffect, useRef } from "react";
|
||||||
import { Link, useParams, useSearchParams } from "react-router";
|
import { Link, useParams, useSearchParams } from "react-router";
|
||||||
import { useCompetition, useTeamCompetition } from "../api/hooks";
|
import { useCompetition, useTeamCompetition } from "../api/hooks";
|
||||||
import { SeriesScoreCard } from "../components/competition/SeriesScoreCard";
|
import { TeamSeriesCard } from "../components/competition/TeamSeriesCard";
|
||||||
|
import { TeamTournamentCodes } from "../components/competition/TeamTournamentCodes";
|
||||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||||
|
import { positionLabel } from "../lib/league";
|
||||||
import {
|
import {
|
||||||
getTeamProgressErrorContent,
|
getTeamProgressErrorContent,
|
||||||
isConsistentTeamProgressSnapshot,
|
isConsistentTeamProgressSnapshot,
|
||||||
shouldOfferTeamSelection,
|
shouldOfferTeamSelection,
|
||||||
type TeamProgressErrorContent,
|
type TeamProgressErrorContent,
|
||||||
} from "./match-team-progress-state";
|
} from "./match-team-progress-state";
|
||||||
|
import {
|
||||||
|
createTeamSeriesGroups,
|
||||||
|
getTeamSeriesDisplayLabel,
|
||||||
|
sortCompletedTeamSeries,
|
||||||
|
sortTeamMembersForRoster,
|
||||||
|
} from "./match-team-progress-view";
|
||||||
|
|
||||||
export default function MatchTeamProgressPage() {
|
export default function MatchTeamProgressPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
@@ -24,10 +36,11 @@ export default function MatchTeamProgressPage() {
|
|||||||
);
|
);
|
||||||
const refetchCompetition = competitionQuery.refetch;
|
const refetchCompetition = competitionQuery.refetch;
|
||||||
const refetchTeam = teamQuery.refetch;
|
const refetchTeam = teamQuery.refetch;
|
||||||
const [copiedSlotId, setCopiedSlotId] = useState<string | null>(null);
|
|
||||||
const lastAutoRefetchedMismatchRef = useRef<string | null>(null);
|
const lastAutoRefetchedMismatchRef = useRef<string | null>(null);
|
||||||
|
const contentHeadingRef = useRef<HTMLHeadingElement>(null);
|
||||||
const competition = competitionQuery.data;
|
const competition = competitionQuery.data;
|
||||||
const teamView = teamQuery.data;
|
const teamView = teamQuery.data;
|
||||||
|
const teamViewId = teamView?.teamId;
|
||||||
const hasQueryError = Boolean(
|
const hasQueryError = Boolean(
|
||||||
competitionQuery.error || teamQuery.error,
|
competitionQuery.error || teamQuery.error,
|
||||||
);
|
);
|
||||||
@@ -66,6 +79,11 @@ export default function MatchTeamProgressPage() {
|
|||||||
revisionMismatchKey,
|
revisionMismatchKey,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (isSelectingTeam || !teamViewId || !revisionsMatch) return;
|
||||||
|
contentHeadingRef.current?.focus({ preventScroll: true });
|
||||||
|
}, [isSelectingTeam, revisionsMatch, teamViewId]);
|
||||||
|
|
||||||
function retryBoth() {
|
function retryBoth() {
|
||||||
void Promise.all([refetchCompetition(), refetchTeam()]).catch(
|
void Promise.all([refetchCompetition(), refetchTeam()]).catch(
|
||||||
() => undefined,
|
() => undefined,
|
||||||
@@ -136,179 +154,191 @@ export default function MatchTeamProgressPage() {
|
|||||||
competition.teams.map((team) => [team.teamId, team]),
|
competition.teams.map((team) => [team.teamId, team]),
|
||||||
);
|
);
|
||||||
const team = teamById.get(teamView.teamId);
|
const team = teamById.get(teamView.teamId);
|
||||||
const completedSeries = competition.projection.series.filter(
|
const activeSeriesGroups = createTeamSeriesGroups(
|
||||||
(series) =>
|
teamView.activeSeries,
|
||||||
series.status === "completed" &&
|
teamView.tournamentCodes,
|
||||||
series.entries.some((entry) => entry.teamId === teamView.teamId),
|
|
||||||
);
|
);
|
||||||
|
const completedSeries = sortCompletedTeamSeries(
|
||||||
async function copyCode(gameSlotId: string, code: string | null) {
|
competition.projection.series.filter(
|
||||||
if (!code) return;
|
(
|
||||||
try {
|
series,
|
||||||
await navigator.clipboard.writeText(code);
|
): series is Extract<SeriesProjection, { status: "completed" }> =>
|
||||||
setCopiedSlotId(gameSlotId);
|
series.status === "completed" &&
|
||||||
window.setTimeout(() => setCopiedSlotId(null), 1500);
|
series.entries.some((entry) => entry.teamId === teamView.teamId),
|
||||||
} catch {
|
),
|
||||||
setCopiedSlotId(null);
|
);
|
||||||
}
|
const recentSeries = completedSeries.slice(0, 2);
|
||||||
}
|
const olderSeries = completedSeries.slice(2);
|
||||||
|
const rounds = competition.projection.rounds;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="mx-auto max-w-5xl px-4 py-6 sm:px-6">
|
<main className="mx-auto max-w-5xl px-4 py-6 sm:px-6">
|
||||||
<Link
|
<Link
|
||||||
to={`/match/${id}`}
|
to={`/match/${id}`}
|
||||||
className="mb-5 inline-flex text-xs text-base-content/40 hover:text-base-content"
|
className="mb-5 inline-flex min-h-11 items-center gap-1.5 text-sm font-bold text-content-muted hover:text-base-content focus-visible:ring-2 focus-visible:ring-primary"
|
||||||
>
|
>
|
||||||
← 내전 상세로
|
<ArrowLeft className="h-4 w-4" aria-hidden="true" />
|
||||||
|
내전 상세로
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<header className="mb-6 border-b border-base-content/10 pb-5">
|
<header className="mb-8 flex flex-col gap-4 border-b border-base-content/10 pb-6 sm:flex-row sm:items-end sm:justify-between">
|
||||||
<p className="text-[11px] font-bold uppercase tracking-wider text-base-content/35">
|
<div className="min-w-0">
|
||||||
{selectedTeamId ? "Team Competition" : "My Competition"}
|
<p className="text-xs font-bold text-content-muted">팀 경기 현황</p>
|
||||||
</p>
|
<h1
|
||||||
<h1 className="mt-1 text-2xl font-black">
|
ref={contentHeadingRef}
|
||||||
{team?.name ?? (selectedTeamId ? "팀" : "내 팀")}
|
className="mt-1 min-w-0 break-words text-2xl font-black sm:text-3xl"
|
||||||
</h1>
|
tabIndex={-1}
|
||||||
<p className="mt-1 text-sm text-base-content/45">
|
>
|
||||||
해당 팀의 공식 대진과 토너먼트 코드가 표시됩니다.
|
{team?.name ?? (selectedTeamId ? "팀" : "내 팀")}
|
||||||
</p>
|
</h1>
|
||||||
|
<p className="mt-2 max-w-2xl text-sm text-content-muted">
|
||||||
|
다음 상대와 세트별 토너먼트 코드를 한곳에서 확인할 수 있습니다.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<Link
|
<Link
|
||||||
to={`/match/${id}/team?select=1`}
|
to={`/match/${id}/team?select=1`}
|
||||||
className="mt-2 inline-flex text-xs text-base-content/40 hover:text-primary"
|
className="inline-flex min-h-11 shrink-0 items-center justify-center gap-2 border border-base-content/20 bg-base-100 px-3 text-sm font-bold text-base-content hover:border-primary/40 hover:bg-primary/5 focus-visible:ring-2 focus-visible:ring-primary"
|
||||||
>
|
>
|
||||||
다른 팀 보기
|
<UsersRound className="h-4 w-4" aria-hidden="true" />
|
||||||
|
팀 변경
|
||||||
</Link>
|
</Link>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section className="mb-6" aria-labelledby="active-series-heading">
|
<section className="mb-8" aria-labelledby="active-series-heading">
|
||||||
<h2
|
<SectionHeading
|
||||||
id="active-series-heading"
|
id="active-series-heading"
|
||||||
className="mb-3 text-xs font-bold uppercase tracking-wider text-base-content/40"
|
title="다음 경기"
|
||||||
>
|
description="현재 팀이 준비하거나 진행해야 하는 공식 대진입니다."
|
||||||
진행할 Series
|
/>
|
||||||
</h2>
|
{activeSeriesGroups.length > 0 ? (
|
||||||
{teamView.activeSeries.length > 0 ? (
|
<div className="space-y-4">
|
||||||
<div className="grid gap-3 md:grid-cols-2">
|
{activeSeriesGroups.map(({ series, codes }) => {
|
||||||
{teamView.activeSeries.map((series) => (
|
const displayLabel = getTeamSeriesDisplayLabel(series, rounds);
|
||||||
<SeriesScoreCard
|
return (
|
||||||
key={series.seriesId}
|
<TeamSeriesCard
|
||||||
series={series}
|
key={series.seriesId}
|
||||||
teamById={teamById}
|
series={series}
|
||||||
/>
|
displayLabel={displayLabel}
|
||||||
))}
|
teamById={teamById}
|
||||||
|
highlightedTeamId={teamView.teamId}
|
||||||
|
emphasized
|
||||||
|
>
|
||||||
|
<TeamTournamentCodes
|
||||||
|
assignments={codes}
|
||||||
|
seriesLabel={displayLabel}
|
||||||
|
/>
|
||||||
|
</TeamSeriesCard>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<EmptyState message="현재 진행할 대진이 없습니다." />
|
<EmptyState message="현재 준비하거나 진행할 대진이 없습니다." />
|
||||||
)}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-6" aria-labelledby="codes-heading">
|
|
||||||
<h2
|
|
||||||
id="codes-heading"
|
|
||||||
className="mb-3 text-xs font-bold uppercase tracking-wider text-base-content/40"
|
|
||||||
>
|
|
||||||
토너먼트 코드
|
|
||||||
</h2>
|
|
||||||
{teamView.tournamentCodes.length > 0 ? (
|
|
||||||
<ul className="grid gap-3 sm:grid-cols-2">
|
|
||||||
{teamView.tournamentCodes.map((assignment) => (
|
|
||||||
<li
|
|
||||||
key={assignment.gameSlotId}
|
|
||||||
className="border border-base-content/10 bg-base-100 p-4"
|
|
||||||
>
|
|
||||||
<div className="flex items-center justify-between gap-3">
|
|
||||||
<span className="text-xs font-bold text-base-content/45">
|
|
||||||
Game {assignment.displayNumber}
|
|
||||||
</span>
|
|
||||||
<span className="text-[11px] text-base-content/35">
|
|
||||||
{assignment.state === "used"
|
|
||||||
? "사용됨"
|
|
||||||
: assignment.state === "reserved"
|
|
||||||
? "사용 가능"
|
|
||||||
: "발급 대기"}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<div className="mt-3 flex items-center gap-2">
|
|
||||||
<code className="min-w-0 flex-1 truncate font-mono text-sm font-bold text-primary">
|
|
||||||
{assignment.code ?? "발급 대기"}
|
|
||||||
</code>
|
|
||||||
{assignment.code && assignment.state !== "used" && (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="border border-base-content/10 px-2 py-1 text-xs font-bold hover:border-primary/30 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
|
|
||||||
onClick={() =>
|
|
||||||
void copyCode(assignment.gameSlotId, assignment.code)
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{copiedSlotId === assignment.gameSlotId
|
|
||||||
? "복사됨"
|
|
||||||
: "복사"}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
) : (
|
|
||||||
<EmptyState message="배정된 토너먼트 코드가 없습니다." />
|
|
||||||
)}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section className="mb-6" aria-labelledby="completed-heading">
|
|
||||||
<h2
|
|
||||||
id="completed-heading"
|
|
||||||
className="mb-3 text-xs font-bold uppercase tracking-wider text-base-content/40"
|
|
||||||
>
|
|
||||||
종료된 Series
|
|
||||||
</h2>
|
|
||||||
{completedSeries.length > 0 ? (
|
|
||||||
<div className="grid gap-3 md:grid-cols-2">
|
|
||||||
{completedSeries.map((series) => (
|
|
||||||
<SeriesScoreCard
|
|
||||||
key={series.seriesId}
|
|
||||||
series={series}
|
|
||||||
teamById={teamById}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<EmptyState message="아직 종료된 대진이 없습니다." />
|
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{team && (
|
{team && (
|
||||||
<section className="border border-base-content/10 bg-base-100">
|
<section className="mb-8" aria-labelledby="roster-heading">
|
||||||
<h2 className="border-b border-base-content/10 bg-base-200/40 px-4 py-2 text-xs font-bold uppercase tracking-wider text-base-content/40">
|
<SectionHeading
|
||||||
팀 구성
|
id="roster-heading"
|
||||||
</h2>
|
title="팀 구성"
|
||||||
<ul className="divide-y divide-base-content/8">
|
description={`${team.members.length}명의 라인업을 포지션 순서로 보여줍니다.`}
|
||||||
{team.members.map((member) => (
|
/>
|
||||||
|
<ul className="divide-y divide-base-content/10 border border-base-content/10 bg-base-100">
|
||||||
|
{sortTeamMembersForRoster(team.members).map((member) => (
|
||||||
<li
|
<li
|
||||||
key={member.userId}
|
key={member.userId}
|
||||||
className="flex items-center gap-3 px-4 py-3"
|
className="grid min-h-12 grid-cols-[4.5rem_minmax(0,1fr)] items-center gap-3 px-4 py-2 sm:px-5"
|
||||||
>
|
>
|
||||||
<div className="min-w-0 flex-1">
|
<span className="text-xs font-bold text-content-muted">
|
||||||
<p className="truncate text-sm font-bold">
|
{member.assignedPosition
|
||||||
|
? positionLabel[member.assignedPosition]
|
||||||
|
: "미정"}
|
||||||
|
</span>
|
||||||
|
<div className="flex min-w-0 flex-wrap items-center gap-2">
|
||||||
|
<span className="min-w-0 break-words text-sm font-bold text-base-content">
|
||||||
{member.displayName}
|
{member.displayName}
|
||||||
</p>
|
</span>
|
||||||
{member.assignedPosition && (
|
{member.userId === team.captainUserId && (
|
||||||
<p className="mt-0.5 text-xs text-base-content/35">
|
<span className="border-l-2 border-warning bg-warning/15 px-1.5 py-0.5 text-[11px] font-bold text-base-content">
|
||||||
{member.assignedPosition}
|
팀장
|
||||||
</p>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{member.userId === team.captainUserId && (
|
|
||||||
<span className="text-xs font-bold text-warning">팀장</span>
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<section className="mb-6" aria-labelledby="completed-heading">
|
||||||
|
<SectionHeading
|
||||||
|
id="completed-heading"
|
||||||
|
title="지난 경기"
|
||||||
|
description="최근 결과를 먼저 보여주며, 오래된 결과는 펼쳐서 확인할 수 있습니다."
|
||||||
|
/>
|
||||||
|
{completedSeries.length > 0 ? (
|
||||||
|
<>
|
||||||
|
<div className="grid gap-3 md:grid-cols-2">
|
||||||
|
{recentSeries.map((series) => (
|
||||||
|
<TeamSeriesCard
|
||||||
|
key={series.seriesId}
|
||||||
|
series={series}
|
||||||
|
displayLabel={getTeamSeriesDisplayLabel(series, rounds)}
|
||||||
|
teamById={teamById}
|
||||||
|
highlightedTeamId={teamView.teamId}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
{olderSeries.length > 0 && (
|
||||||
|
<details className="group mt-3 border border-base-content/10 bg-base-100">
|
||||||
|
<summary className="flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-bold text-base-content hover:bg-base-200/50 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary [&::-webkit-details-marker]:hidden">
|
||||||
|
<span>이전 경기 {olderSeries.length}개 더 보기</span>
|
||||||
|
<ChevronDown
|
||||||
|
className="h-4 w-4 transition-transform group-open:rotate-180 motion-reduce:transition-none"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
</summary>
|
||||||
|
<div className="grid gap-3 border-t border-base-content/10 p-3 md:grid-cols-2">
|
||||||
|
{olderSeries.map((series) => (
|
||||||
|
<TeamSeriesCard
|
||||||
|
key={series.seriesId}
|
||||||
|
series={series}
|
||||||
|
displayLabel={getTeamSeriesDisplayLabel(series, rounds)}
|
||||||
|
teamById={teamById}
|
||||||
|
highlightedTeamId={teamView.teamId}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</details>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<EmptyState message="아직 종료된 대진이 없습니다." />
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SectionHeading({
|
||||||
|
id,
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
}: {
|
||||||
|
id: string;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<div className="mb-3 border-b border-base-content/10 pb-2">
|
||||||
|
<h2 id={id} className="text-base font-black text-base-content">
|
||||||
|
{title}
|
||||||
|
</h2>
|
||||||
|
<p className="mt-0.5 text-xs text-content-muted">{description}</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function TeamSelectionState({
|
function TeamSelectionState({
|
||||||
competition,
|
competition,
|
||||||
matchId,
|
matchId,
|
||||||
@@ -316,21 +346,28 @@ function TeamSelectionState({
|
|||||||
competition: CompetitionDetailResponse;
|
competition: CompetitionDetailResponse;
|
||||||
matchId: string | undefined;
|
matchId: string | undefined;
|
||||||
}) {
|
}) {
|
||||||
|
const headingRef = useRef<HTMLHeadingElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
headingRef.current?.focus({ preventScroll: true });
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="mx-auto max-w-5xl px-4 py-6 sm:px-6">
|
<main className="mx-auto max-w-5xl px-4 py-6 sm:px-6">
|
||||||
<Link
|
<Link
|
||||||
to={`/match/${matchId}`}
|
to={`/match/${matchId}`}
|
||||||
className="mb-5 inline-flex text-xs text-base-content/40 hover:text-base-content"
|
className="mb-5 inline-flex min-h-11 items-center gap-1.5 text-sm font-bold text-content-muted hover:text-base-content focus-visible:ring-2 focus-visible:ring-primary"
|
||||||
>
|
>
|
||||||
← 내전 상세로
|
<ArrowLeft className="h-4 w-4" aria-hidden="true" />
|
||||||
|
내전 상세로
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<header className="mb-6 border-b border-base-content/10 pb-5">
|
<header className="mb-6 border-b border-base-content/10 pb-5">
|
||||||
<p className="text-[11px] font-bold uppercase tracking-wider text-base-content/35">
|
<p className="text-xs font-bold text-content-muted">팀 경기 현황</p>
|
||||||
Team Competition
|
<h1 ref={headingRef} className="mt-1 text-2xl font-black" tabIndex={-1}>
|
||||||
</p>
|
팀 선택
|
||||||
<h1 className="mt-1 text-2xl font-black">팀 선택</h1>
|
</h1>
|
||||||
<p className="mt-1 text-sm text-base-content/45">
|
<p className="mt-1 text-sm text-content-muted">
|
||||||
진행 상황과 토너먼트 코드를 확인할 팀을 선택해 주세요.
|
진행 상황과 토너먼트 코드를 확인할 팀을 선택해 주세요.
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
@@ -341,12 +378,12 @@ function TeamSelectionState({
|
|||||||
<li key={team.teamId}>
|
<li key={team.teamId}>
|
||||||
<Link
|
<Link
|
||||||
to={`/match/${matchId}/team?teamId=${team.teamId}`}
|
to={`/match/${matchId}/team?teamId=${team.teamId}`}
|
||||||
className="flex items-center justify-between gap-3 border border-base-content/10 bg-base-100 px-4 py-4 hover:border-primary/30 hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary"
|
className="flex min-h-12 items-center justify-between gap-3 border border-base-content/10 bg-base-100 px-4 py-3 text-base-content hover:border-primary/40 hover:bg-primary/5 focus-visible:ring-2 focus-visible:ring-primary"
|
||||||
>
|
>
|
||||||
<span className="min-w-0 truncate text-sm font-bold">
|
<span className="min-w-0 break-words text-sm font-bold">
|
||||||
{team.name}
|
{team.name}
|
||||||
</span>
|
</span>
|
||||||
<span className="shrink-0 text-xs text-base-content/35">
|
<span className="shrink-0 text-xs text-content-muted">
|
||||||
{team.members.length}명
|
{team.members.length}명
|
||||||
</span>
|
</span>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -366,9 +403,11 @@ function TeamProgressLoadingState() {
|
|||||||
className="mx-auto max-w-5xl space-y-3 px-4 py-12 sm:px-6"
|
className="mx-auto max-w-5xl space-y-3 px-4 py-12 sm:px-6"
|
||||||
aria-busy="true"
|
aria-busy="true"
|
||||||
aria-label="팀 진행 정보를 불러오는 중"
|
aria-label="팀 진행 정보를 불러오는 중"
|
||||||
|
role="status"
|
||||||
>
|
>
|
||||||
<div className="h-7 w-48 animate-pulse bg-base-200" />
|
<span className="sr-only">팀 진행 정보를 불러오는 중입니다.</span>
|
||||||
<div className="h-32 animate-pulse bg-base-200/70" />
|
<div className="h-7 w-48 animate-pulse bg-base-200 motion-reduce:animate-none" />
|
||||||
|
<div className="h-32 animate-pulse bg-base-200/70 motion-reduce:animate-none" />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -384,6 +423,12 @@ function TeamProgressProblemState({
|
|||||||
matchId: string | undefined;
|
matchId: string | undefined;
|
||||||
onRetry: () => void;
|
onRetry: () => void;
|
||||||
}) {
|
}) {
|
||||||
|
const headingRef = useRef<HTMLHeadingElement>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
headingRef.current?.focus({ preventScroll: true });
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="mx-auto max-w-5xl px-4 py-20 sm:px-6">
|
<main className="mx-auto max-w-5xl px-4 py-20 sm:px-6">
|
||||||
<section
|
<section
|
||||||
@@ -391,20 +436,25 @@ function TeamProgressProblemState({
|
|||||||
aria-busy={isRetrying}
|
aria-busy={isRetrying}
|
||||||
className="border border-base-content/10 bg-base-100 px-5 py-8 text-center"
|
className="border border-base-content/10 bg-base-100 px-5 py-8 text-center"
|
||||||
>
|
>
|
||||||
<h1 className="text-lg font-bold">{content.title}</h1>
|
<h1 ref={headingRef} className="text-lg font-bold" tabIndex={-1}>
|
||||||
<p className="mt-2 text-sm text-base-content/45">
|
{content.title}
|
||||||
|
</h1>
|
||||||
|
<p className="mt-2 text-sm text-content-muted">
|
||||||
{content.description}
|
{content.description}
|
||||||
</p>
|
</p>
|
||||||
<div className="mt-5 flex flex-wrap justify-center gap-2">
|
<div className="mt-5 flex flex-wrap justify-center gap-2">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-primary btn-sm"
|
className="inline-flex min-h-11 items-center justify-center border border-primary/50 bg-primary/10 px-4 text-sm font-bold text-base-content hover:bg-primary/15 focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-wait disabled:opacity-70"
|
||||||
disabled={isRetrying}
|
disabled={isRetrying}
|
||||||
onClick={onRetry}
|
onClick={onRetry}
|
||||||
>
|
>
|
||||||
{isRetrying ? "다시 불러오는 중..." : "다시 시도"}
|
{isRetrying ? "다시 불러오는 중..." : "다시 시도"}
|
||||||
</button>
|
</button>
|
||||||
<Link to={`/match/${matchId}`} className="btn btn-ghost btn-sm">
|
<Link
|
||||||
|
to={`/match/${matchId}`}
|
||||||
|
className="inline-flex min-h-11 items-center justify-center border border-base-content/20 bg-base-100 px-4 text-sm font-bold text-base-content hover:bg-base-200 focus-visible:ring-2 focus-visible:ring-primary"
|
||||||
|
>
|
||||||
내전 상세로
|
내전 상세로
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
@@ -417,7 +467,7 @@ function EmptyState({ message }: { message: string }) {
|
|||||||
return (
|
return (
|
||||||
<p
|
<p
|
||||||
role="status"
|
role="status"
|
||||||
className="border border-dashed border-base-content/10 px-4 py-8 text-center text-sm text-base-content/40"
|
className="border border-dashed border-base-content/10 px-4 py-8 text-center text-sm text-content-muted"
|
||||||
>
|
>
|
||||||
{message}
|
{message}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type {
|
import type {
|
||||||
BracketRoundView,
|
BracketRoundView,
|
||||||
SeriesId,
|
CompetitionTeamMemberView,
|
||||||
SeriesProjection,
|
SeriesProjection,
|
||||||
TeamTournamentCodeView,
|
TeamTournamentCodeView,
|
||||||
} from "@lolympus/contracts";
|
} from "@lolympus/contracts";
|
||||||
@@ -10,6 +10,19 @@ export interface TeamSeriesGroup {
|
|||||||
codes: TeamTournamentCodeView[];
|
codes: TeamTournamentCodeView[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TeamSeriesTone =
|
||||||
|
| "muted"
|
||||||
|
| "ready"
|
||||||
|
| "live"
|
||||||
|
| "completed"
|
||||||
|
| "adjudicated";
|
||||||
|
|
||||||
|
export interface TeamSeriesPresentation {
|
||||||
|
label: string;
|
||||||
|
tone: TeamSeriesTone;
|
||||||
|
showScore: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export type TournamentCodeTone =
|
export type TournamentCodeTone =
|
||||||
| "pending"
|
| "pending"
|
||||||
| "available"
|
| "available"
|
||||||
@@ -28,6 +41,12 @@ export type TournamentCodeCopyFeedback =
|
|||||||
|
|
||||||
type ClipboardWriter = ((value: string) => Promise<void>) | undefined;
|
type ClipboardWriter = ((value: string) => Promise<void>) | undefined;
|
||||||
|
|
||||||
|
const POSITION_RANK = new Map(
|
||||||
|
(["TOP", "JGL", "MID", "ADC", "SUP"] as const).map(
|
||||||
|
(position, index) => [position, index],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
export function createTeamSeriesGroups(
|
export function createTeamSeriesGroups(
|
||||||
activeSeries: readonly SeriesProjection[],
|
activeSeries: readonly SeriesProjection[],
|
||||||
tournamentCodes: readonly TeamTournamentCodeView[],
|
tournamentCodes: readonly TeamTournamentCodeView[],
|
||||||
@@ -74,6 +93,41 @@ export function getTeamSeriesDisplayLabel(
|
|||||||
: baseLabel;
|
: baseLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTeamSeriesPresentation(
|
||||||
|
series: SeriesProjection,
|
||||||
|
): TeamSeriesPresentation {
|
||||||
|
switch (series.status) {
|
||||||
|
case "inactive":
|
||||||
|
return { label: "비활성", tone: "muted", showScore: false };
|
||||||
|
case "waiting":
|
||||||
|
return { label: "대진 대기", tone: "muted", showScore: false };
|
||||||
|
case "ready":
|
||||||
|
return { label: "경기 가능", tone: "ready", showScore: false };
|
||||||
|
case "in-progress":
|
||||||
|
return { label: "진행 중", tone: "live", showScore: true };
|
||||||
|
case "completed":
|
||||||
|
switch (series.outcome.type) {
|
||||||
|
case "played":
|
||||||
|
return { label: "종료", tone: "completed", showScore: true };
|
||||||
|
case "draw":
|
||||||
|
return {
|
||||||
|
label: "무승부",
|
||||||
|
tone:
|
||||||
|
series.outcome.basis.type === "played"
|
||||||
|
? "completed"
|
||||||
|
: "adjudicated",
|
||||||
|
showScore: series.outcome.basis.type === "played",
|
||||||
|
};
|
||||||
|
case "walkover":
|
||||||
|
return { label: "부전승", tone: "adjudicated", showScore: false };
|
||||||
|
case "forfeit":
|
||||||
|
return { label: "기권승", tone: "adjudicated", showScore: false };
|
||||||
|
case "administrative":
|
||||||
|
return { label: "판정승", tone: "adjudicated", showScore: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getTournamentCodePresentation(
|
export function getTournamentCodePresentation(
|
||||||
assignment: TeamTournamentCodeView,
|
assignment: TeamTournamentCodeView,
|
||||||
now = Date.now(),
|
now = Date.now(),
|
||||||
@@ -84,12 +138,58 @@ export function getTournamentCodePresentation(
|
|||||||
if (assignment.state === "pending" || !assignment.code) {
|
if (assignment.state === "pending" || !assignment.code) {
|
||||||
return { label: "발급 대기", tone: "pending", canCopy: false };
|
return { label: "발급 대기", tone: "pending", canCopy: false };
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
assignment.expiresAt &&
|
||||||
|
!Number.isFinite(Date.parse(assignment.expiresAt))
|
||||||
|
) {
|
||||||
|
return { label: "만료 정보 오류", tone: "expired", canCopy: false };
|
||||||
|
}
|
||||||
if (isExpired(assignment.expiresAt, now)) {
|
if (isExpired(assignment.expiresAt, now)) {
|
||||||
return { label: "만료", tone: "expired", canCopy: false };
|
return { label: "만료", tone: "expired", canCopy: false };
|
||||||
}
|
}
|
||||||
return { label: "사용 가능", tone: "available", canCopy: true };
|
return { label: "사용 가능", tone: "available", canCopy: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getTournamentCodeExpiryLabel(
|
||||||
|
expiresAt: string,
|
||||||
|
now: number,
|
||||||
|
): string {
|
||||||
|
const date = new Date(expiresAt);
|
||||||
|
if (Number.isNaN(date.getTime())) return "만료 시각 정보 없음";
|
||||||
|
|
||||||
|
const formatted = new Intl.DateTimeFormat("ko-KR", {
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
timeZone: "Asia/Seoul",
|
||||||
|
timeZoneName: "short",
|
||||||
|
}).format(date);
|
||||||
|
return date.getTime() <= now
|
||||||
|
? `${formatted}에 만료됨`
|
||||||
|
: `${formatted}까지 사용 가능`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getNextTournamentCodeExpiryDelay(
|
||||||
|
assignments: readonly TeamTournamentCodeView[],
|
||||||
|
now: number,
|
||||||
|
): number | null {
|
||||||
|
let nearestExpiry = Number.POSITIVE_INFINITY;
|
||||||
|
for (const assignment of assignments) {
|
||||||
|
if (assignment.state !== "reserved" || !assignment.code) continue;
|
||||||
|
const expiry = assignment.expiresAt
|
||||||
|
? Date.parse(assignment.expiresAt)
|
||||||
|
: Number.NaN;
|
||||||
|
if (Number.isFinite(expiry) && expiry > now) {
|
||||||
|
nearestExpiry = Math.min(nearestExpiry, expiry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number.isFinite(nearestExpiry)) return null;
|
||||||
|
return Math.min(nearestExpiry - now, 2_147_483_647);
|
||||||
|
}
|
||||||
|
|
||||||
export function getTournamentCodeCopyLabel(
|
export function getTournamentCodeCopyLabel(
|
||||||
assignment: TeamTournamentCodeView,
|
assignment: TeamTournamentCodeView,
|
||||||
seriesLabel: string,
|
seriesLabel: string,
|
||||||
@@ -129,6 +229,21 @@ export function sortCompletedTeamSeries(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function sortTeamMembersForRoster(
|
||||||
|
members: readonly CompetitionTeamMemberView[],
|
||||||
|
): CompetitionTeamMemberView[] {
|
||||||
|
return [...members].sort(
|
||||||
|
(left, right) =>
|
||||||
|
(left.assignedPosition
|
||||||
|
? (POSITION_RANK.get(left.assignedPosition) ?? POSITION_RANK.size)
|
||||||
|
: POSITION_RANK.size) -
|
||||||
|
(right.assignedPosition
|
||||||
|
? (POSITION_RANK.get(right.assignedPosition) ?? POSITION_RANK.size)
|
||||||
|
: POSITION_RANK.size) ||
|
||||||
|
left.displayName.localeCompare(right.displayName, "ko"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function compareSeriesDisplayOrder(
|
function compareSeriesDisplayOrder(
|
||||||
left: SeriesProjection,
|
left: SeriesProjection,
|
||||||
right: SeriesProjection,
|
right: SeriesProjection,
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
|
|||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import type {
|
import type {
|
||||||
BracketRoundView,
|
BracketRoundView,
|
||||||
|
CompetitionTeamMemberView,
|
||||||
CompetitionFactId,
|
CompetitionFactId,
|
||||||
GameSlotId,
|
GameSlotId,
|
||||||
SeriesId,
|
SeriesId,
|
||||||
@@ -13,9 +14,13 @@ import {
|
|||||||
copyTournamentCode,
|
copyTournamentCode,
|
||||||
createTeamSeriesGroups,
|
createTeamSeriesGroups,
|
||||||
getTeamSeriesDisplayLabel,
|
getTeamSeriesDisplayLabel,
|
||||||
|
getTeamSeriesPresentation,
|
||||||
|
getNextTournamentCodeExpiryDelay,
|
||||||
|
getTournamentCodeExpiryLabel,
|
||||||
getTournamentCodeCopyLabel,
|
getTournamentCodeCopyLabel,
|
||||||
getTournamentCodePresentation,
|
getTournamentCodePresentation,
|
||||||
sortCompletedTeamSeries,
|
sortCompletedTeamSeries,
|
||||||
|
sortTeamMembersForRoster,
|
||||||
} from "../src/pages/match-team-progress-view.ts";
|
} from "../src/pages/match-team-progress-view.ts";
|
||||||
|
|
||||||
const TEAM_A = "team-a" as TeamId;
|
const TEAM_A = "team-a" as TeamId;
|
||||||
@@ -67,6 +72,101 @@ test("uses Korean round names while keeping global game numbers secondary", () =
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("hides misleading scores before play and for adjudicated outcomes", () => {
|
||||||
|
const ready = readySeries("ready", 1);
|
||||||
|
const walkover = completedSeries(
|
||||||
|
"walkover",
|
||||||
|
"2026-07-13T10:00:00.000Z",
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
const played: Extract<SeriesProjection, { status: "completed" }> = {
|
||||||
|
...walkover,
|
||||||
|
code: "PLAYED",
|
||||||
|
entries: [
|
||||||
|
{ slot: "A", teamId: TEAM_A, gameWins: 2 },
|
||||||
|
{ slot: "B", teamId: TEAM_B, gameWins: 1 },
|
||||||
|
],
|
||||||
|
outcome: {
|
||||||
|
type: "played",
|
||||||
|
winnerTeamId: TEAM_A,
|
||||||
|
loserTeamId: TEAM_B,
|
||||||
|
decidedByGameIds: [],
|
||||||
|
completedAt: "2026-07-13T11:00:00.000Z",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
assert.deepEqual(getTeamSeriesPresentation(ready), {
|
||||||
|
label: "경기 가능",
|
||||||
|
tone: "ready",
|
||||||
|
showScore: false,
|
||||||
|
});
|
||||||
|
for (const [status, expected] of [
|
||||||
|
["inactive", { label: "비활성", tone: "muted", showScore: false }],
|
||||||
|
["waiting", { label: "대진 대기", tone: "muted", showScore: false }],
|
||||||
|
["in-progress", { label: "진행 중", tone: "live", showScore: true }],
|
||||||
|
] as const) {
|
||||||
|
assert.deepEqual(
|
||||||
|
getTeamSeriesPresentation({ ...ready, status } as SeriesProjection),
|
||||||
|
expected,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
assert.deepEqual(getTeamSeriesPresentation(walkover), {
|
||||||
|
label: "부전승",
|
||||||
|
tone: "adjudicated",
|
||||||
|
showScore: false,
|
||||||
|
});
|
||||||
|
assert.deepEqual(getTeamSeriesPresentation(played), {
|
||||||
|
label: "종료",
|
||||||
|
tone: "completed",
|
||||||
|
showScore: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const adjudicatedOutcomes = [
|
||||||
|
["forfeit", "기권승"],
|
||||||
|
["administrative", "판정승"],
|
||||||
|
] as const;
|
||||||
|
for (const [type, label] of adjudicatedOutcomes) {
|
||||||
|
const series: Extract<SeriesProjection, { status: "completed" }> = {
|
||||||
|
...walkover,
|
||||||
|
outcome: {
|
||||||
|
...walkover.outcome,
|
||||||
|
type,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
assert.deepEqual(getTeamSeriesPresentation(series), {
|
||||||
|
label,
|
||||||
|
tone: "adjudicated",
|
||||||
|
showScore: false,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const basis of ["played", "administrative"] as const) {
|
||||||
|
const draw: Extract<SeriesProjection, { status: "completed" }> = {
|
||||||
|
...walkover,
|
||||||
|
entries: [
|
||||||
|
{ slot: "A", teamId: TEAM_A, gameWins: 1 },
|
||||||
|
{ slot: "B", teamId: TEAM_B, gameWins: 1 },
|
||||||
|
],
|
||||||
|
outcome: {
|
||||||
|
type: "draw",
|
||||||
|
basis:
|
||||||
|
basis === "played"
|
||||||
|
? { type: basis, decidedByGameIds: [] }
|
||||||
|
: {
|
||||||
|
type: basis,
|
||||||
|
decisionFactId: "draw-fact" as CompetitionFactId,
|
||||||
|
},
|
||||||
|
completedAt: "2026-07-13T12:00:00.000Z",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
assert.deepEqual(getTeamSeriesPresentation(draw), {
|
||||||
|
label: "무승부",
|
||||||
|
tone: basis === "played" ? "completed" : "adjudicated",
|
||||||
|
showScore: basis === "played",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("distinguishes pending, available, expired, and used code states", () => {
|
test("distinguishes pending, available, expired, and used code states", () => {
|
||||||
const now = Date.parse("2026-07-13T12:00:00.000Z");
|
const now = Date.parse("2026-07-13T12:00:00.000Z");
|
||||||
const pending = tournamentCode("pending", "series-a" as SeriesId, 1, 1, {
|
const pending = tournamentCode("pending", "series-a" as SeriesId, 1, 1, {
|
||||||
@@ -91,6 +191,26 @@ test("distinguishes pending, available, expired, and used code states", () => {
|
|||||||
state: "used",
|
state: "used",
|
||||||
expiresAt: "2026-07-13T11:00:00.000Z",
|
expiresAt: "2026-07-13T11:00:00.000Z",
|
||||||
});
|
});
|
||||||
|
const expiresNow = tournamentCode(
|
||||||
|
"expires-now",
|
||||||
|
"series-a" as SeriesId,
|
||||||
|
5,
|
||||||
|
5,
|
||||||
|
{ expiresAt: "2026-07-13T12:00:00.000Z" },
|
||||||
|
);
|
||||||
|
const noExpiry = tournamentCode(
|
||||||
|
"no-expiry",
|
||||||
|
"series-a" as SeriesId,
|
||||||
|
6,
|
||||||
|
6,
|
||||||
|
);
|
||||||
|
const invalidExpiry = tournamentCode(
|
||||||
|
"invalid-expiry",
|
||||||
|
"series-a" as SeriesId,
|
||||||
|
7,
|
||||||
|
7,
|
||||||
|
{ expiresAt: "not-a-date" },
|
||||||
|
);
|
||||||
|
|
||||||
assert.deepEqual(getTournamentCodePresentation(pending, now), {
|
assert.deepEqual(getTournamentCodePresentation(pending, now), {
|
||||||
label: "발급 대기",
|
label: "발급 대기",
|
||||||
@@ -112,6 +232,76 @@ test("distinguishes pending, available, expired, and used code states", () => {
|
|||||||
tone: "used",
|
tone: "used",
|
||||||
canCopy: false,
|
canCopy: false,
|
||||||
});
|
});
|
||||||
|
assert.deepEqual(getTournamentCodePresentation(expiresNow, now), {
|
||||||
|
label: "만료",
|
||||||
|
tone: "expired",
|
||||||
|
canCopy: false,
|
||||||
|
});
|
||||||
|
assert.deepEqual(getTournamentCodePresentation(noExpiry, now), {
|
||||||
|
label: "사용 가능",
|
||||||
|
tone: "available",
|
||||||
|
canCopy: true,
|
||||||
|
});
|
||||||
|
assert.deepEqual(getTournamentCodePresentation(invalidExpiry, now), {
|
||||||
|
label: "만료 정보 오류",
|
||||||
|
tone: "expired",
|
||||||
|
canCopy: false,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("describes tournament-code expiry according to its current state", () => {
|
||||||
|
const beforeExpiry = Date.parse("2026-07-13T12:00:00.000Z");
|
||||||
|
const atExpiry = Date.parse("2026-07-13T13:00:00.000Z");
|
||||||
|
const expiresAt = "2026-07-13T13:00:00.000Z";
|
||||||
|
const formatter = new Intl.DateTimeFormat("ko-KR", {
|
||||||
|
year: "numeric",
|
||||||
|
month: "long",
|
||||||
|
day: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
timeZone: "Asia/Seoul",
|
||||||
|
timeZoneName: "short",
|
||||||
|
});
|
||||||
|
const formatted = formatter.format(new Date(expiresAt));
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
getTournamentCodeExpiryLabel(expiresAt, beforeExpiry),
|
||||||
|
`${formatted}까지 사용 가능`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
getTournamentCodeExpiryLabel(expiresAt, atExpiry),
|
||||||
|
`${formatted}에 만료됨`,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
getTournamentCodeExpiryLabel("not-a-date", beforeExpiry),
|
||||||
|
"만료 시각 정보 없음",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("schedules the next code-state refresh at the nearest future expiry", () => {
|
||||||
|
const now = Date.parse("2026-07-13T12:00:00.000Z");
|
||||||
|
const first = tournamentCode("first", "series-a" as SeriesId, 1, 1, {
|
||||||
|
expiresAt: "2026-07-13T12:01:00.000Z",
|
||||||
|
});
|
||||||
|
const later = tournamentCode("later", "series-a" as SeriesId, 2, 2, {
|
||||||
|
expiresAt: "2026-07-13T13:00:00.000Z",
|
||||||
|
});
|
||||||
|
const alreadyExpired = tournamentCode(
|
||||||
|
"expired",
|
||||||
|
"series-a" as SeriesId,
|
||||||
|
3,
|
||||||
|
3,
|
||||||
|
{ expiresAt: "2026-07-13T11:00:00.000Z" },
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.equal(
|
||||||
|
getNextTournamentCodeExpiryDelay([later, alreadyExpired, first], now),
|
||||||
|
60_000,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
getNextTournamentCodeExpiryDelay([alreadyExpired], now),
|
||||||
|
null,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("returns explicit game-specific clipboard success and failure feedback", async () => {
|
test("returns explicit game-specific clipboard success and failure feedback", async () => {
|
||||||
@@ -153,6 +343,22 @@ test("sorts completed Series by most recent decision time", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("orders the roster by the canonical League positions", () => {
|
||||||
|
const members: CompetitionTeamMemberView[] = [
|
||||||
|
{ userId: "support" as never, displayName: "Support", assignedPosition: "SUP" },
|
||||||
|
{ userId: "top" as never, displayName: "Top", assignedPosition: "TOP" },
|
||||||
|
{ userId: "unknown" as never, displayName: "Unknown" },
|
||||||
|
{ userId: "mid" as never, displayName: "Mid", assignedPosition: "MID" },
|
||||||
|
{ userId: "jungle" as never, displayName: "Jungle", assignedPosition: "JGL" },
|
||||||
|
{ userId: "adc" as never, displayName: "Adc", assignedPosition: "ADC" },
|
||||||
|
];
|
||||||
|
|
||||||
|
assert.deepEqual(
|
||||||
|
sortTeamMembersForRoster(members).map(({ displayName }) => displayName),
|
||||||
|
["Top", "Jungle", "Mid", "Adc", "Support", "Unknown"],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
function readySeries(
|
function readySeries(
|
||||||
id: string,
|
id: string,
|
||||||
displayOrder: number,
|
displayOrder: number,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ metadata, outcome categories, and code expiry.
|
|||||||
into a pure module that the existing Node test runner can exercise.
|
into a pure module that the existing Node test runner can exercise.
|
||||||
- Compose the active-Series card with code rows instead of maintaining a separate
|
- Compose the active-Series card with code rows instead of maintaining a separate
|
||||||
page-wide code grid.
|
page-wide code grid.
|
||||||
- Reuse existing Competition history result and score helpers instead of creating
|
- Keep the team page's Series presentation in a page-specific card so shared
|
||||||
a second interpretation of adjudicated outcomes.
|
bracket/history layouts are unaffected; exhaustively test its outcome mapping.
|
||||||
- Use one responsive layout and native disclosure/table semantics rather than
|
- Use one responsive layout and native disclosure/table semantics rather than
|
||||||
separate desktop and mobile component trees.
|
separate desktop and mobile component trees.
|
||||||
|
|
||||||
@@ -22,30 +22,30 @@ metadata, outcome categories, and code expiry.
|
|||||||
|
|
||||||
### Phase 1: Tested View Model
|
### Phase 1: Tested View Model
|
||||||
|
|
||||||
- [ ] Add failing tests for Series/code grouping, stable ordering, Korean round
|
- [x] Add failing tests for Series/code grouping, stable ordering, Korean round
|
||||||
labels, code availability/expiry, unique copy labels, and explicit clipboard
|
labels, code availability/expiry, unique copy labels, and explicit clipboard
|
||||||
results.
|
results.
|
||||||
- Acceptance: the new focused test fails because the behavior is not implemented.
|
- Acceptance: the new focused test fails because the behavior is not implemented.
|
||||||
- Verify: `pnpm --filter web exec node --test --experimental-strip-types test/match-team-progress-view.test.ts`
|
- Verify: `pnpm --filter web exec node --test --experimental-strip-types test/match-team-progress-view.test.ts`
|
||||||
- Files: `apps/web/test/match-team-progress-view.test.ts`
|
- Files: `apps/web/test/match-team-progress-view.test.ts`
|
||||||
- [ ] Implement the minimal pure view helpers.
|
- [x] Implement the minimal pure view helpers.
|
||||||
- Acceptance: all focused assertions pass without React or DOM mocks.
|
- Acceptance: all focused assertions pass without React or DOM mocks.
|
||||||
- Verify: rerun the focused command once after implementation.
|
- Verify: rerun the focused command once after implementation.
|
||||||
- Files: `apps/web/src/pages/match-team-progress-view.ts`
|
- Files: `apps/web/src/pages/match-team-progress-view.ts`
|
||||||
|
|
||||||
### Checkpoint: View Model
|
### Checkpoint: View Model
|
||||||
|
|
||||||
- [ ] Focused tests pass and no API/contract file changed.
|
- [x] Focused tests pass and no API/contract file changed.
|
||||||
|
|
||||||
### Phase 2: Series Semantics and Code Interaction
|
### Phase 2: Series Semantics and Code Interaction
|
||||||
|
|
||||||
- [ ] Update the shared Series card to prefer supplied human labels, show technical
|
- [x] Add a page-specific Series card that prefers supplied human labels, shows
|
||||||
codes secondarily, and hide misleading pre-start/adjudicated scores.
|
technical codes secondarily, and hides misleading pre-start/adjudicated scores.
|
||||||
- Acceptance: ready and adjudicated cards show `—`; result categories remain
|
- Acceptance: ready and adjudicated cards show `—`; result categories remain
|
||||||
text-visible; bracket geometry stays unchanged.
|
text-visible; bracket geometry stays unchanged.
|
||||||
- Verify: `pnpm --filter web test`
|
- Verify: `pnpm --filter web test`
|
||||||
- Files: `apps/web/src/components/competition/SeriesScoreCard.tsx`
|
- Files: `apps/web/src/components/competition/TeamSeriesCard.tsx`
|
||||||
- [ ] Add the responsive tournament-code list with accessible clipboard feedback.
|
- [x] Add the responsive tournament-code list with accessible clipboard feedback.
|
||||||
- Acceptance: code rows show local set number first, full selectable codes,
|
- Acceptance: code rows show local set number first, full selectable codes,
|
||||||
unique 44px copy controls, expiry/state text, and success/failure announcements.
|
unique 44px copy controls, expiry/state text, and success/failure announcements.
|
||||||
- Verify: TypeScript build plus runtime keyboard/copy check.
|
- Verify: TypeScript build plus runtime keyboard/copy check.
|
||||||
@@ -53,16 +53,16 @@ metadata, outcome categories, and code expiry.
|
|||||||
|
|
||||||
### Checkpoint: Interaction
|
### Checkpoint: Interaction
|
||||||
|
|
||||||
- [ ] Full web tests pass and the web build succeeds.
|
- [x] Full web tests pass and the web build succeeds.
|
||||||
|
|
||||||
### Phase 3: Page Hierarchy and Polish
|
### Phase 3: Page Hierarchy and Polish
|
||||||
|
|
||||||
- [ ] Reorder the page and integrate code rows with matching active Series.
|
- [x] Reorder the page and integrate code rows with matching active Series.
|
||||||
- Acceptance: order is next match, roster, recent results; every code appears
|
- Acceptance: order is next match, roster, recent results; every code appears
|
||||||
under exactly one matching Series; empty states remain meaningful.
|
under exactly one matching Series; empty states remain meaningful.
|
||||||
- Verify: desktop and mobile runtime screenshots.
|
- Verify: desktop and mobile runtime screenshots.
|
||||||
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
|
- Files: `apps/web/src/pages/MatchTeamProgressPage.tsx`
|
||||||
- [ ] Compact and order the roster, and collapse results beyond the newest two.
|
- [x] Compact and order the roster, and collapse results beyond the newest two.
|
||||||
- Acceptance: position labels are Korean and role-ordered, captain is adjacent,
|
- Acceptance: position labels are Korean and role-ordered, captain is adjacent,
|
||||||
and older results remain keyboard-accessible.
|
and older results remain keyboard-accessible.
|
||||||
- Verify: 320/768/1024/1440px reflow and keyboard traversal.
|
- Verify: 320/768/1024/1440px reflow and keyboard traversal.
|
||||||
@@ -70,10 +70,14 @@ metadata, outcome categories, and code expiry.
|
|||||||
|
|
||||||
### Checkpoint: Complete
|
### Checkpoint: Complete
|
||||||
|
|
||||||
- [ ] Focused and full tests pass without skips.
|
- [x] Focused (9) and full web tests (87) pass without skips.
|
||||||
- [ ] Lint and build pass.
|
- [x] Scoped lint and the production build pass.
|
||||||
- [ ] Runtime review confirms no console errors or horizontal overflow.
|
- [ ] Full repository lint passes. It is currently blocked by pre-existing errors
|
||||||
- [ ] Final diff contains only the spec, plan, focused tests, and team-progress UI.
|
outside the team-progress scope.
|
||||||
|
- [ ] Runtime review confirms no console errors or horizontal overflow. The
|
||||||
|
required in-app browser was unavailable in this session.
|
||||||
|
- [x] The scoped implementation contains only the spec, plan, focused tests, and
|
||||||
|
team-progress UI; unrelated concurrent worktree changes are excluded.
|
||||||
|
|
||||||
## Risks and Mitigations
|
## Risks and Mitigations
|
||||||
|
|
||||||
@@ -84,13 +88,13 @@ metadata, outcome categories, and code expiry.
|
|||||||
| Adjudication looks like a played 0–0 | High | Reuse tested outcome/score helpers from Competition history. |
|
| Adjudication looks like a played 0–0 | High | Reuse tested outcome/score helpers from Competition history. |
|
||||||
| Clipboard permissions fail silently | Medium | Return a typed result and render an alert with manual-selection guidance. |
|
| Clipboard permissions fail silently | Medium | Return a typed result and render an alert with manual-selection guidance. |
|
||||||
| Long codes overflow at mobile widths | Medium | Use `minmax(0,1fr)`, `break-all`, selectable text, and a stacked mobile row. |
|
| Long codes overflow at mobile widths | Medium | Use `minmax(0,1fr)`, `break-all`, selectable text, and a stacked mobile row. |
|
||||||
| Shared Series card changes bracket dimensions | Medium | Preserve the bracket variant's fixed geometry and compact metadata treatment. |
|
| Page-specific result semantics drift | Medium | Cover every lifecycle/outcome branch in the pure presentation tests. |
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
```text
|
```text
|
||||||
View-model tests -> view helpers -> code component -> page composition
|
View-model tests -> view helpers -> code component -> page composition
|
||||||
Existing history outcome helpers -> Series score semantics -> recent results
|
Exhaustive Series outcome tests -> page-specific score semantics -> recent results
|
||||||
```
|
```
|
||||||
|
|
||||||
## Open Questions
|
## Open Questions
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ accessible and explicit.
|
|||||||
labels, code state, and copy-result behavior.
|
labels, code state, and copy-result behavior.
|
||||||
- `apps/web/src/components/competition/TeamTournamentCodes.tsx` owns code rows and
|
- `apps/web/src/components/competition/TeamTournamentCodes.tsx` owns code rows and
|
||||||
clipboard feedback.
|
clipboard feedback.
|
||||||
- `apps/web/src/components/competition/SeriesScoreCard.tsx` remains the shared
|
- `apps/web/src/components/competition/TeamSeriesCard.tsx` owns the page-specific
|
||||||
Series summary while respecting pre-start and adjudicated score semantics.
|
Series summary, leaving bracket/history card geometry and behavior unchanged.
|
||||||
- `apps/web/test/match-team-progress-view.test.ts` specifies the new pure behavior.
|
- `apps/web/test/match-team-progress-view.test.ts` specifies the new pure behavior.
|
||||||
|
|
||||||
## Code Style
|
## Code Style
|
||||||
@@ -82,11 +82,12 @@ high-contrast base-content color.
|
|||||||
ordering before adding the UI.
|
ordering before adding the UI.
|
||||||
- Test Korean round labels, code availability/expiry state, unique copy labels,
|
- Test Korean round labels, code availability/expiry state, unique copy labels,
|
||||||
and explicit clipboard success/failure results as pure functions.
|
and explicit clipboard success/failure results as pure functions.
|
||||||
- Reuse existing tested Competition history helpers for adjudicated result labels
|
- Test every page-specific Series lifecycle/outcome branch, including played and
|
||||||
and score visibility.
|
administrative draws, so the local summary cannot drift silently.
|
||||||
- Run the complete web suite, lint, and build after the focused tests pass.
|
- Run the complete web suite, lint, and build after the focused tests pass.
|
||||||
- Runtime verification covers 320px, 768px, 1024px, and 1440px; keyboard focus,
|
- When the in-app browser is available, runtime verification covers 320px, 768px,
|
||||||
copy announcements, long-code reflow, and console output are checked manually.
|
1024px, and 1440px; keyboard focus, copy announcements, long-code reflow, and
|
||||||
|
console output are checked manually.
|
||||||
|
|
||||||
## Boundaries
|
## Boundaries
|
||||||
|
|
||||||
@@ -126,7 +127,19 @@ high-contrast base-content color.
|
|||||||
marker close to the player name.
|
marker close to the player name.
|
||||||
- At most two recent results are expanded by default; older results are available
|
- At most two recent results are expanded by default; older results are available
|
||||||
through a keyboard-accessible disclosure.
|
through a keyboard-accessible disclosure.
|
||||||
- Focused and full tests, lint, build, and responsive runtime review pass.
|
- Focused and full tests, scoped lint, and build pass. Responsive runtime review is
|
||||||
|
recorded separately when the in-app browser is available.
|
||||||
|
|
||||||
|
## Verification Record
|
||||||
|
|
||||||
|
- Focused view-model tests: 9 passed.
|
||||||
|
- Full web suite: 87 passed without skips.
|
||||||
|
- Scoped ESLint for all team-progress files: passed.
|
||||||
|
- Production TypeScript/Vite build: passed; only the existing large-chunk warning
|
||||||
|
remains.
|
||||||
|
- Full repository lint remains blocked by pre-existing errors in unrelated files.
|
||||||
|
- Runtime screenshot/keyboard verification was not claimed because the required
|
||||||
|
in-app browser was unavailable in this session.
|
||||||
|
|
||||||
## Open Questions
|
## Open Questions
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user