chore: reflect observability updates in release 83

This commit is contained in:
dahyeon committed 2026-06-25 23:57:51 -07:00
1 parent ab721873f3
commit d2fc126fed
13 files changed
+636 -33

No files matched your search

+100 -4
View File
@@ -50,10 +50,11 @@ import {
teamIndexColorClasses,
teamIndexLabel,
} from "../lib/league";
import { RankBadge, ResponsiveTierLabel } from "../components/RankBadge";
import { formatRankDetail, RankBadge } from "../components/RankBadge";
import type {
ApiAuction,
ApiAuctionChatMessage,
ApiTierInfo,
ApiRecentMatchView,
ApiTierHistoryEntry,
ApiRiotLaneStats,
@@ -167,6 +168,25 @@ const POSITION_TO_RIOT_LANE = {
SUP: "UTILITY",
} as const;
const LIVE_TIMER_TICK_MS = 100;
const PROFILE_TIER_ORDER = [
"IRON",
"BRONZE",
"SILVER",
"GOLD",
"PLATINUM",
"EMERALD",
"DIAMOND",
"MASTER",
"GRANDMASTER",
"CHALLENGER",
];
const PROFILE_APEX_TIERS = new Set(["MASTER", "GRANDMASTER", "CHALLENGER"]);
const PROFILE_RANK_INDEX: Record<string, number> = {
IV: 0,
III: 1,
II: 2,
I: 3,
};
function getAuctionTeamSize(team: AuctionStateView["teams"][number]) {
return team.members.length + 1;
@@ -238,6 +258,47 @@ function getSoloTierHistory(entries: ApiTierHistoryEntry[]) {
return entries.filter((entry) => entry.queueType === "RANKED_SOLO_5x5");
}
function getProfileTierValue(
tier: Pick<ApiTierInfo, "tier" | "rank" | "leaguePoints">,
) {
const tierIndex = PROFILE_TIER_ORDER.indexOf(tier.tier);
const base = Math.max(0, tierIndex) * 400;
if (PROFILE_APEX_TIERS.has(tier.tier)) {
return base + (tier.leaguePoints ?? 0);
}
return (
base +
(PROFILE_RANK_INDEX[tier.rank ?? "IV"] ?? 0) * 100 +
(tier.leaguePoints ?? 0)
);
}
function tierHistoryEntryToTierInfo(entry: ApiTierHistoryEntry): ApiTierInfo {
return {
queueType: entry.queueType,
tier: entry.tier,
rank: entry.rank ?? "",
leaguePoints: entry.leaguePoints ?? 0,
wins: entry.wins ?? 0,
losses: entry.losses ?? 0,
fetchedAt: entry.recordedAt,
};
}
function getPeakSoloTier(
currentTier: ApiTierInfo | undefined,
tierHistory: ApiTierHistoryEntry[],
) {
const candidates = tierHistory.map(tierHistoryEntryToTierInfo);
if (currentTier?.queueType === "RANKED_SOLO_5x5") {
candidates.push(currentTier);
}
return candidates.reduce<ApiTierInfo | undefined>((peak, tier) => {
if (!peak) return tier;
return getProfileTierValue(tier) > getProfileTierValue(peak) ? tier : peak;
}, undefined);
}
type PlayerProfileTab = "internal" | "solo";
const INTERNAL_PROFILE_TOP_CHAMPION_LIMIT = 6;
const INTERNAL_PROFILE_RECENT_MATCH_LIMIT = 5;
@@ -643,6 +704,24 @@ function AuctionProfileMetric({
);
}
function ProfileTierSummary({
label,
tier,
}: {
label: string;
tier: ApiTierInfo | undefined;
}) {
return (
<div className="flex min-w-0 items-center gap-1.5">
<RankBadge tier={tier} size="sm" />
<span className="truncate text-xs font-semibold text-base-content/55">
{formatRankDetail(tier)}{" "}
<span className="font-normal text-base-content/35">({label})</span>
</span>
</div>
);
}
function InternalChampionSummary({
champion,
ddragon,
@@ -689,9 +768,11 @@ function InternalChampionSummary({
function InternalRecentMatchRow({
match,
ddragon,
historyBackTo,
}: {
match: ApiRecentMatchView;
ddragon: ReturnType<typeof useDdragonManifest>["data"];
historyBackTo: string;
}) {
const iconUrl = championIconUrl(ddragon, match.championId);
const championName =
@@ -743,6 +824,7 @@ function InternalRecentMatchRow({
return (
<Link
to={detailPath}
state={{ backTo: historyBackTo, backLabel: "경매로 돌아가기" }}
className={`${className} transition-colors hover:border-primary/40 hover:bg-primary/[0.04] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary`}
aria-label={`${championName} ${match.remake ? "다시하기" : match.win ? "승리" : "패배"} 내전 상세 보기`}
>
@@ -897,6 +979,7 @@ function InternalHistorySnapshot({
key={`${match.matchId}-${match.gameNumber ?? match.gameCreation}`}
match={match}
ddragon={ddragon}
historyBackTo={historyBackTo}
/>
))
) : (
@@ -1176,6 +1259,7 @@ function PlayerProfileDetails({
snapshotSoloTierHistory.length > 0
? snapshotSoloTierHistory
: getSoloTierHistory(historyProfileQuery.data?.tierHistory ?? []);
const peakSoloTier = getPeakSoloTier(player.tier, tierHistory);
return (
<>
@@ -1205,8 +1289,9 @@ function PlayerProfileDetails({
#{player.tag}
</span>
</div>
<div className="mb-2 text-xs">
<ResponsiveTierLabel tier={player.tier} />
<div className="mb-2 min-w-0 space-y-1">
<ProfileTierSummary label="현재" tier={player.tier} />
<ProfileTierSummary label="최고" tier={peakSoloTier} />
</div>
<div className="flex items-center gap-1.5">
<PosBadge pos={player.mainPosition} />
@@ -2240,7 +2325,18 @@ export default function AuctionPage() {
type="button"
className="btn btn-primary btn-sm px-5 text-xs"
onClick={() => socket.markSold(assignedPosition)}
disabled={socket.isAuctionActionPending}
disabled={
socket.isAuctionActionPending ||
!(
auctionState.currentBid > 0 &&
auctionState.currentBidder != null
)
}
title={
auctionState.currentBid > 0
? undefined
: "입찰이 있어야 낙찰할 수 있습니다."
}
>
{socket.isAuctionActionPending
? "반영 중..."
+76 -8
View File
@@ -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}