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
@@ -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
|
||||
? "반영 중..."
|
||||
|
||||
Reference in new issue
Block a user