Release 77 #1
No files matched your search
@@ -3,6 +3,7 @@ import {
|
||||
CartesianGrid,
|
||||
Line,
|
||||
LineChart,
|
||||
ReferenceDot,
|
||||
ReferenceLine,
|
||||
ResponsiveContainer,
|
||||
Tooltip,
|
||||
@@ -52,6 +53,8 @@ const QUEUE_LABELS: Record<string, string> = {
|
||||
};
|
||||
|
||||
type PeriodKey = "30" | "90" | "all";
|
||||
type SummaryVariant = "footer" | "inline";
|
||||
type SummaryDirection = "up" | "down" | "flat";
|
||||
|
||||
const PERIOD_OPTIONS: { key: PeriodKey; label: string; days: number | null }[] =
|
||||
[
|
||||
@@ -112,6 +115,20 @@ function formatTierShort(tier: string) {
|
||||
return TIER_NAMES[tier] ?? tier;
|
||||
}
|
||||
|
||||
function formatPeriodChange(summary: {
|
||||
first: ChartPoint;
|
||||
last: ChartPoint;
|
||||
direction: SummaryDirection;
|
||||
}) {
|
||||
const marker =
|
||||
summary.direction === "up"
|
||||
? "▲"
|
||||
: summary.direction === "down"
|
||||
? "▼"
|
||||
: "·";
|
||||
return `${formatTierShort(summary.first.tier)} ${marker} ${formatTierShort(summary.last.tier)}`;
|
||||
}
|
||||
|
||||
function formatDate(ms: number) {
|
||||
return new Intl.DateTimeFormat("ko-KR", {
|
||||
month: "numeric",
|
||||
@@ -160,9 +177,13 @@ function TierTooltip({
|
||||
export default function TierHistoryChart({
|
||||
entries,
|
||||
className = "border border-base-content/10 bg-base-100 mb-5 overflow-hidden",
|
||||
summaryVariant = "footer",
|
||||
height = 220,
|
||||
}: {
|
||||
entries: ApiTierHistoryEntry[];
|
||||
className?: string;
|
||||
summaryVariant?: SummaryVariant;
|
||||
height?: number;
|
||||
}) {
|
||||
// 데이터에 존재하는 큐 목록 (솔로 우선)
|
||||
const availableQueues = useMemo(() => {
|
||||
@@ -220,7 +241,7 @@ export default function TierHistoryChart({
|
||||
const peak = points.reduce((best, point) =>
|
||||
point.value > best.value ? point : best,
|
||||
);
|
||||
const direction =
|
||||
const direction: SummaryDirection =
|
||||
last.value > first.value
|
||||
? "up"
|
||||
: last.value < first.value
|
||||
@@ -276,11 +297,29 @@ export default function TierHistoryChart({
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="px-2 pt-4 pb-1">
|
||||
<ResponsiveContainer width="100%" height={220}>
|
||||
<div className="relative px-2 pt-4 pb-1">
|
||||
{summaryVariant === "inline" && summary && (
|
||||
<div
|
||||
className={`pointer-events-none absolute right-3 top-3 z-10 border border-base-content/10 bg-base-100/90 px-2 py-1 text-[10px] font-bold shadow-sm ${
|
||||
summary.direction === "up"
|
||||
? "text-green-500"
|
||||
: summary.direction === "down"
|
||||
? "text-red-400"
|
||||
: "text-base-content/50"
|
||||
}`}
|
||||
>
|
||||
기간 {formatPeriodChange(summary)}
|
||||
</div>
|
||||
)}
|
||||
<ResponsiveContainer width="100%" height={height}>
|
||||
<LineChart
|
||||
data={points}
|
||||
margin={{ top: 8, right: 16, bottom: 4, left: 4 }}
|
||||
margin={{
|
||||
top: summaryVariant === "inline" ? 26 : 8,
|
||||
right: summaryVariant === "inline" ? 48 : 16,
|
||||
bottom: 4,
|
||||
left: 4,
|
||||
}}
|
||||
>
|
||||
<CartesianGrid
|
||||
strokeDasharray="3 3"
|
||||
@@ -328,6 +367,40 @@ export default function TierHistoryChart({
|
||||
className: "text-base-content/20",
|
||||
}}
|
||||
/>
|
||||
{summaryVariant === "inline" && summary && (
|
||||
<>
|
||||
<ReferenceDot
|
||||
x={summary.peak.ts}
|
||||
y={summary.peak.value}
|
||||
r={3}
|
||||
stroke="currentColor"
|
||||
fill="currentColor"
|
||||
className="text-amber-400"
|
||||
label={{
|
||||
value: `최고 ${formatTierLabel(summary.peak)}`,
|
||||
position: "top",
|
||||
fill: "currentColor",
|
||||
fontSize: 10,
|
||||
className: "text-amber-400",
|
||||
}}
|
||||
/>
|
||||
<ReferenceDot
|
||||
x={summary.last.ts}
|
||||
y={summary.last.value}
|
||||
r={3}
|
||||
stroke="currentColor"
|
||||
fill="currentColor"
|
||||
className="text-primary"
|
||||
label={{
|
||||
value: `현재 ${formatTierLabel(summary.last)}`,
|
||||
position: "right",
|
||||
fill: "currentColor",
|
||||
fontSize: 10,
|
||||
className: "text-primary",
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<Line
|
||||
type="monotone"
|
||||
dataKey="value"
|
||||
@@ -341,7 +414,7 @@ export default function TierHistoryChart({
|
||||
</LineChart>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
{summary && (
|
||||
{summary && summaryVariant === "footer" && (
|
||||
<div className="flex flex-wrap items-center gap-x-5 gap-y-1 border-t border-base-content/8 px-4 py-2.5 text-[11px]">
|
||||
<span className="text-base-content/45">
|
||||
현재{" "}
|
||||
@@ -366,13 +439,7 @@ export default function TierHistoryChart({
|
||||
: "text-base-content/55"
|
||||
}`}
|
||||
>
|
||||
{formatTierShort(summary.first.tier)}
|
||||
{summary.direction === "up"
|
||||
? " ▲ "
|
||||
: summary.direction === "down"
|
||||
? " ▼ "
|
||||
: " · "}
|
||||
{formatTierShort(summary.last.tier)}
|
||||
{formatPeriodChange(summary)}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -543,6 +543,21 @@ function PlayerSpotlight({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{tierHistory.length > 0 && (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="h-[180px] border-b border-base-content/8 bg-base-100" />
|
||||
}
|
||||
>
|
||||
<TierHistoryChart
|
||||
entries={tierHistory}
|
||||
className="border-b border-base-content/8 bg-base-100 overflow-hidden"
|
||||
summaryVariant="inline"
|
||||
height={180}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
<div className="grid grid-cols-2 divide-x divide-base-content/5">
|
||||
<div className="p-4">
|
||||
<h4 className="text-[10px] font-bold uppercase tracking-wider text-base-content/30 mb-2.5">
|
||||
@@ -589,19 +604,6 @@ function PlayerSpotlight({
|
||||
<RecentSoloStats player={player} />
|
||||
</div>
|
||||
|
||||
{tierHistory.length > 0 && (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="h-[180px] border-t border-base-content/8 bg-base-100" />
|
||||
}
|
||||
>
|
||||
<TierHistoryChart
|
||||
entries={tierHistory}
|
||||
className="border-t border-base-content/8 bg-base-100 overflow-hidden"
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
{(state.phase === 'bidding' || state.phase === 'sold') && (
|
||||
<div className="border-t border-base-content/8 px-4 py-3 bg-base-content/[0.02]">
|
||||
<div className="flex items-center justify-between">
|
||||
|
||||
Reference in new issue
Block a user