chore: reflect observability updates in release 83
This commit is contained in:
1 parent
ab721873f3
commit
d2fc126fed
13 files changed
+636
-33
No files matched your search
@@ -37,6 +37,14 @@ type DdragonManifestData = ReturnType<typeof useDdragonManifest>["data"];
|
||||
type RuneStyleEntry = NonNullable<DdragonManifestData>["runesReforged"][number];
|
||||
type DetailTab = "scoreboard" | "matchup" | "build";
|
||||
type TimelineMetric = "gold" | "xp";
|
||||
type MatchGameBackTarget = {
|
||||
to: string;
|
||||
label: string;
|
||||
};
|
||||
type MatchGameNavigationState = {
|
||||
backTo: string;
|
||||
backLabel: string;
|
||||
};
|
||||
|
||||
const DETAIL_TABS: Array<{ id: DetailTab; label: string }> = [
|
||||
{ id: "scoreboard", label: "스코어보드" },
|
||||
@@ -49,6 +57,46 @@ const TIMELINE_METRICS: Array<{ id: TimelineMetric; label: string }> = [
|
||||
{ id: "xp", label: "경험치" },
|
||||
];
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === "object" && value !== null;
|
||||
}
|
||||
|
||||
function resolveBackTarget(
|
||||
state: unknown,
|
||||
fallbackTo: string,
|
||||
): MatchGameBackTarget {
|
||||
if (
|
||||
isRecord(state) &&
|
||||
typeof state.backTo === "string" &&
|
||||
state.backTo.startsWith("/") &&
|
||||
!state.backTo.startsWith("//")
|
||||
) {
|
||||
return {
|
||||
to: state.backTo,
|
||||
label:
|
||||
typeof state.backLabel === "string"
|
||||
? state.backLabel
|
||||
: "돌아가기",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
to: fallbackTo,
|
||||
label: "경기 결과로 돌아가기",
|
||||
};
|
||||
}
|
||||
|
||||
function createNavigationState(
|
||||
backTarget: MatchGameBackTarget,
|
||||
fallbackTo: string,
|
||||
): MatchGameNavigationState | undefined {
|
||||
if (backTarget.to === fallbackTo) return undefined;
|
||||
return {
|
||||
backTo: backTarget.to,
|
||||
backLabel: backTarget.label,
|
||||
};
|
||||
}
|
||||
|
||||
const SKILL_ROWS: Array<{
|
||||
slot: 1 | 2 | 3 | 4;
|
||||
label: string;
|
||||
@@ -1924,9 +1972,11 @@ function GameAnalysisPanel({
|
||||
function GameTabs({
|
||||
detail,
|
||||
currentGameNumber,
|
||||
navigationState,
|
||||
}: {
|
||||
detail: ApiInternalMatchDetailResponse;
|
||||
currentGameNumber: number;
|
||||
navigationState: MatchGameNavigationState | undefined;
|
||||
}) {
|
||||
return (
|
||||
<nav
|
||||
@@ -1940,6 +1990,7 @@ function GameTabs({
|
||||
<Link
|
||||
key={game.gameNumber}
|
||||
to={`/match/${detail.match.matchId}/game/${game.gameNumber}`}
|
||||
state={navigationState}
|
||||
className={`min-w-[8rem] border-r border-base-content/8 px-4 py-3 text-xs transition-colors last:border-r-0 ${
|
||||
active
|
||||
? "bg-primary/8 text-primary"
|
||||
@@ -1962,9 +2013,13 @@ function GameTabs({
|
||||
function MatchScoreHero({
|
||||
detail,
|
||||
selectedGame,
|
||||
backTarget,
|
||||
navigationState,
|
||||
}: {
|
||||
detail: ApiInternalMatchDetailResponse;
|
||||
selectedGame: MatchGameDetail;
|
||||
backTarget: MatchGameBackTarget;
|
||||
navigationState: MatchGameNavigationState | undefined;
|
||||
}) {
|
||||
const selectedSeries = resolveSelectedSeries(detail, selectedGame);
|
||||
const [leftTeam, rightTeam] = selectedGame.teams;
|
||||
@@ -1982,10 +2037,10 @@ function MatchScoreHero({
|
||||
<div className="flex flex-col gap-5 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div className="min-w-0">
|
||||
<Link
|
||||
to={`/match/${detail.match.matchId}`}
|
||||
to={backTarget.to}
|
||||
className="text-xs text-base-content/40 hover:text-base-content"
|
||||
>
|
||||
← 경기 결과로 돌아가기
|
||||
← {backTarget.label}
|
||||
</Link>
|
||||
<h1 className="mt-4 text-2xl font-black text-base-content">
|
||||
{detail.match.title} · {selectedGame.gameNumber}세트
|
||||
@@ -2040,18 +2095,26 @@ function MatchScoreHero({
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<GameTabs detail={detail} currentGameNumber={selectedGame.gameNumber} />
|
||||
<GameTabs
|
||||
detail={detail}
|
||||
currentGameNumber={selectedGame.gameNumber}
|
||||
navigationState={navigationState}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default function MatchGameDetailPage() {
|
||||
const { id, gameNumber } = useParams();
|
||||
const location = useLocation();
|
||||
const [activeTab, setActiveTab] = useState<DetailTab>("scoreboard");
|
||||
const requestedGameNumber = Number(gameNumber);
|
||||
const detailQuery = useInternalMatchDetail(id, DEFAULT_COMMUNITY_ID);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const detail = detailQuery.data;
|
||||
const fallbackBackTo = `/match/${id ?? ""}`;
|
||||
const backTarget = resolveBackTarget(location.state, fallbackBackTo);
|
||||
const navigationState = createNavigationState(backTarget, fallbackBackTo);
|
||||
|
||||
if (detailQuery.isLoading) {
|
||||
return (
|
||||
@@ -2065,8 +2128,8 @@ export default function MatchGameDetailPage() {
|
||||
return (
|
||||
<main className="mx-auto max-w-6xl px-4 py-20 text-center">
|
||||
<h1 className="text-lg font-bold">세트 기록을 찾을 수 없습니다</h1>
|
||||
<Link to={`/match/${id ?? ""}`} className="btn btn-ghost btn-sm mt-4">
|
||||
경기 결과로 돌아가기
|
||||
<Link to={backTarget.to} className="btn btn-ghost btn-sm mt-4">
|
||||
{backTarget.label}
|
||||
</Link>
|
||||
</main>
|
||||
);
|
||||
@@ -2081,10 +2144,10 @@ export default function MatchGameDetailPage() {
|
||||
<main className="mx-auto max-w-6xl px-4 py-20 text-center">
|
||||
<h1 className="text-lg font-bold">수집된 세트 기록이 없습니다</h1>
|
||||
<Link
|
||||
to={`/match/${detail.match.matchId}`}
|
||||
to={backTarget.to}
|
||||
className="btn btn-ghost btn-sm mt-4"
|
||||
>
|
||||
경기 결과로 돌아가기
|
||||
{backTarget.label}
|
||||
</Link>
|
||||
</main>
|
||||
);
|
||||
@@ -2092,7 +2155,12 @@ export default function MatchGameDetailPage() {
|
||||
|
||||
return (
|
||||
<main className="mx-auto max-w-6xl px-4 py-6 sm:px-6">
|
||||
<MatchScoreHero detail={detail} selectedGame={selectedGame} />
|
||||
<MatchScoreHero
|
||||
detail={detail}
|
||||
selectedGame={selectedGame}
|
||||
backTarget={backTarget}
|
||||
navigationState={navigationState}
|
||||
/>
|
||||
|
||||
<PostgameBreakdown
|
||||
selectedGame={selectedGame}
|
||||
|
||||
Reference in new issue
Block a user