Release 77 #1
@@ -52,6 +52,19 @@ const QUEUE_LABELS: Record<string, string> = {
|
||||
RANKED_FLEX_SR: "자유랭크",
|
||||
};
|
||||
|
||||
const TIER_COMPACT_NAMES: Record<string, string> = {
|
||||
IRON: "I",
|
||||
BRONZE: "B",
|
||||
SILVER: "S",
|
||||
GOLD: "G",
|
||||
PLATINUM: "P",
|
||||
EMERALD: "E",
|
||||
DIAMOND: "D",
|
||||
MASTER: "M",
|
||||
GRANDMASTER: "GM",
|
||||
CHALLENGER: "C",
|
||||
};
|
||||
|
||||
type PeriodKey = "30" | "90" | "all";
|
||||
type SummaryVariant = "footer" | "inline";
|
||||
type SummaryDirection = "up" | "down" | "flat";
|
||||
@@ -111,6 +124,20 @@ function formatTierLabel(entry: {
|
||||
return `${name}${rank ? ` ${rank}` : ""} · ${entry.leaguePoints ?? 0}LP`;
|
||||
}
|
||||
|
||||
function formatTierCompactLabel(entry: {
|
||||
tier: string;
|
||||
rank?: string;
|
||||
leaguePoints?: number;
|
||||
}) {
|
||||
const tier = TIER_COMPACT_NAMES[entry.tier] ?? entry.tier;
|
||||
const lp = entry.leaguePoints ?? 0;
|
||||
if (APEX_TIERS.has(entry.tier)) {
|
||||
return `${tier} ${lp}LP`;
|
||||
}
|
||||
const rank = normalizeRank(entry.rank);
|
||||
return `${tier}${rank} ${lp}LP`;
|
||||
}
|
||||
|
||||
function formatTierShort(tier: string) {
|
||||
return TIER_NAMES[tier] ?? tier;
|
||||
}
|
||||
@@ -146,6 +173,10 @@ type ChartPoint = {
|
||||
losses?: number;
|
||||
};
|
||||
|
||||
function isSamePoint(left: ChartPoint, right: ChartPoint) {
|
||||
return left.ts === right.ts && left.value === right.value;
|
||||
}
|
||||
|
||||
function TierTooltip({
|
||||
active,
|
||||
payload,
|
||||
@@ -252,6 +283,18 @@ export default function TierHistoryChart({
|
||||
return { first, last, peak, direction };
|
||||
}, [points]);
|
||||
|
||||
const xDomain = useMemo(() => {
|
||||
if (summaryVariant !== "inline" || points.length < 2) {
|
||||
return ["dataMin", "dataMax"] as const;
|
||||
}
|
||||
|
||||
const min = points[0].ts;
|
||||
const max = points[points.length - 1].ts;
|
||||
const span = Math.max(1, max - min);
|
||||
const padding = Math.max(span * 0.08, 12 * 60 * 60 * 1000);
|
||||
return [min - padding, max + padding] as const;
|
||||
}, [points, summaryVariant]);
|
||||
|
||||
const header = (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 border-b border-base-content/10 bg-base-200/40 px-4 py-2.5">
|
||||
<h2 className="text-[11px] font-bold uppercase tracking-wider text-base-content/40">
|
||||
@@ -336,7 +379,7 @@ export default function TierHistoryChart({
|
||||
dataKey="ts"
|
||||
type="number"
|
||||
scale="time"
|
||||
domain={["dataMin", "dataMax"]}
|
||||
domain={xDomain}
|
||||
tickFormatter={formatDate}
|
||||
tick={{ fontSize: 10, fill: "currentColor" }}
|
||||
className="text-base-content/40"
|
||||
@@ -358,36 +401,23 @@ export default function TierHistoryChart({
|
||||
/>
|
||||
{summaryVariant === "inline" && summary && (
|
||||
<>
|
||||
<ReferenceLine
|
||||
y={summary.peak.value}
|
||||
stroke="transparent"
|
||||
label={{
|
||||
value: `최고 ${formatTierLabel(summary.peak)}`,
|
||||
position: "insideLeft",
|
||||
fill: "currentColor",
|
||||
fontSize: 10,
|
||||
className: "text-amber-400",
|
||||
}}
|
||||
/>
|
||||
<ReferenceLine
|
||||
y={summary.last.value}
|
||||
stroke="transparent"
|
||||
label={{
|
||||
value: `현재 ${formatTierLabel(summary.last)}`,
|
||||
position: "insideRight",
|
||||
fill: "currentColor",
|
||||
fontSize: 10,
|
||||
className: "text-primary",
|
||||
}}
|
||||
/>
|
||||
<ReferenceDot
|
||||
x={summary.peak.ts}
|
||||
y={summary.peak.value}
|
||||
r={3}
|
||||
stroke="currentColor"
|
||||
fill="currentColor"
|
||||
className="text-amber-400"
|
||||
/>
|
||||
{!isSamePoint(summary.peak, summary.last) && (
|
||||
<ReferenceDot
|
||||
x={summary.peak.ts}
|
||||
y={summary.peak.value}
|
||||
r={3}
|
||||
stroke="currentColor"
|
||||
fill="currentColor"
|
||||
className="text-amber-400"
|
||||
label={{
|
||||
value: formatTierCompactLabel(summary.peak),
|
||||
position: "top",
|
||||
fill: "currentColor",
|
||||
fontSize: 10,
|
||||
className: "text-amber-400",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<ReferenceDot
|
||||
x={summary.last.ts}
|
||||
y={summary.last.value}
|
||||
@@ -395,6 +425,13 @@ export default function TierHistoryChart({
|
||||
stroke="currentColor"
|
||||
fill="currentColor"
|
||||
className="text-primary"
|
||||
label={{
|
||||
value: formatTierCompactLabel(summary.last),
|
||||
position: "top",
|
||||
fill: "currentColor",
|
||||
fontSize: 10,
|
||||
className: "text-primary",
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user