This commit is contained in:
dahyeon committed 2026-05-02 14:46:59 -07:00
1 parent 905e72fbed
commit 86d6767eba
16 files changed
+440 -184

No files matched your search

@@ -0,0 +1,6 @@
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M42 41H72V71H42V41Z" fill="white" fill-opacity="0.15"/>
<path d="M12.9448 112H114V10.9448L92 32.9448V91H33.9448L12.9448 112Z" fill="white" fill-opacity="0.15"/>
<path d="M78.4888 21H22V77.4888L0 99.4888V0H99.4888L78.4888 21Z" fill="white" fill-opacity="0.15"/>
<path d="M12.9448 112H114V10.9448L92 32.9448V91H33.9448L12.9448 112Z" fill="#C89B3C"/>
</svg>

After

Width:  |  Height:  |  Size: 464 B

@@ -0,0 +1,6 @@
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M42 41H72V71H42V41Z" fill="white" fill-opacity="0.15"/>
<path d="M12.9448 112H114V10.9448L92 32.9448V91H33.9448L12.9448 112Z" fill="white" fill-opacity="0.15"/>
<path d="M78.4888 21H22V77.4888L0 99.4888V0H99.4888L78.4888 21Z" fill="white" fill-opacity="0.15"/>
<path d="M12.9448 112H114V10.9448L92 32.9448V91H33.9448L12.9448 112Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 462 B

@@ -0,0 +1,5 @@
<svg width="112" height="125" viewBox="0 0 112 125" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M64.5 60C66.9 64.8 68.1667 71.3333 68.5 74L74 61C73.6667 60 73.2 56 74 48C74.8 40 84.6667 13.3333 89.5 1C85.3333 6.66667 76 19.5 72 25.5C68 31.5 61.3333 44 58.5 49.5C59.5 51 62.1 55.2 64.5 60Z" fill="#C89B3C"/>
<path d="M81 97.5C78.2 99.9 74.5 104.167 73 106L72.5 91.5C73 89.5 74.3 84.5 75.5 80.5C76.7 76.5 80 68 86.5 56.5C88.1667 54 92.9 47.7 96.5 44.5C100.1 41.3 106 37.5 111.5 34.5C104 43 105 42 98 54.5C92.302 64.6751 91.3333 80.6667 91.5 90C89.1667 91.5 83.8 95.1 81 97.5Z" fill="#C89B3C"/>
<path d="M61 89C61 108.2 57.6667 121 56 125C43.2 105.8 26.6667 93 20 89C19.5 83 18 69.1 16 61.5C14 53.9 4.5 40.3333 0 34.5C4.5 36.5 15.4 42.2 23 49C30.6 55.8 35.8333 66.5 37.5 71C37.5 66.3333 37.2 54.4 36 44C34.8 33.6 25.8333 10.3333 21.5 0C25.3333 5.83333 33 15 39 25.5C43.1287 32.7252 61 65 61 89Z" fill="#C89B3C"/>
</svg>

After

Width:  |  Height:  |  Size: 930 B

@@ -0,0 +1,5 @@
<svg width="112" height="125" viewBox="0 0 112 125" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M64.5 60C66.9 64.8 68.1667 71.3333 68.5 74L74 61C73.6667 60 73.2 56 74 48C74.8 40 84.6667 13.3333 89.5 1C85.3333 6.66667 76 19.5 72 25.5C68 31.5 61.3333 44 58.5 49.5C59.5 51 62.1 55.2 64.5 60Z" fill="white"/>
<path d="M81 97.5C78.2 99.9 74.5 104.167 73 106L72.5 91.5C73 89.5 74.3 84.5 75.5 80.5C76.7 76.5 80 68 86.5 56.5C88.1667 54 92.9 47.7 96.5 44.5C100.1 41.3 106 37.5 111.5 34.5C104 43 105 42 98 54.5C92.302 64.6751 91.3333 80.6667 91.5 90C89.1667 91.5 83.8 95.1 81 97.5Z" fill="white"/>
<path d="M61 89C61 108.2 57.6667 121 56 125C43.2 105.8 26.6667 93 20 89C19.5 83 18 69.1 16 61.5C14 53.9 4.5 40.3333 0 34.5C4.5 36.5 15.4 42.2 23 49C30.6 55.8 35.8333 66.5 37.5 71C37.5 66.3333 37.2 54.4 36 44C34.8 33.6 25.8333 10.3333 21.5 0C25.3333 5.83333 33 15 39 25.5C43.1287 32.7252 61 65 61 89Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 924 B

@@ -0,0 +1,5 @@
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H84.7495L63.7495 21H22V62.7495L0 84.7495V0Z" fill="white" fill-opacity="0.15"/>
<path d="M29.312 112H114V27.3118L92 49.3118V91H50.312L29.312 112Z" fill="white" fill-opacity="0.15"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M114 18.2323L20.2323 112H0V93.8289L93.8289 0H114V18.2323Z" fill="#C89B3C"/>
</svg>

After

Width:  |  Height:  |  Size: 427 B

@@ -0,0 +1,5 @@
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 0H84.7495L63.7495 21H22V62.7495L0 84.7495V0Z" fill="white" fill-opacity="0.15"/>
<path d="M29.312 112H114V27.3118L92 49.3118V91H50.312L29.312 112Z" fill="white" fill-opacity="0.15"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M114 18.2323L20.2323 112H0V93.8289L93.8289 0H114V18.2323Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 425 B

@@ -0,0 +1,6 @@
<svg width="136" height="114" viewBox="0 0 136 114" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M63 39.5L67.5 45.5L72.5 39.5L84.5 100.5L67.5 114L51.5 100.5L63 39.5Z" fill="#C89B3C"/>
<path d="M87.5 65L78.5 36L92 22.5L136 24C134 26.1667 128.9 30.7 124.5 33.5C120.1 36.3 114 39.5 108.5 40H97L108.5 56.5L87.5 65Z" fill="#C89B3C"/>
<path d="M67.5 32.5L47 9L51.5 0H84.5L88.5 9L67.5 32.5Z" fill="#C89B3C"/>
<path d="M56 36L44 24H0C1.66667 25.3333 3 29.5 13 34.5C20.7398 38.3699 27.1667 40.1667 28.5 40H38.5L27 56.5L48.5 65L56 36Z" fill="#C89B3C"/>
</svg>

After

Width:  |  Height:  |  Size: 562 B

@@ -0,0 +1,6 @@
<svg width="136" height="114" viewBox="0 0 136 114" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M63 39.5L67.5 45.5L72.5 39.5L84.5 100.5L67.5 114L51.5 100.5L63 39.5Z" fill="white"/>
<path d="M87.5 65L78.5 36L92 22.5L136 24C134 26.1667 128.9 30.7 124.5 33.5C120.1 36.3 114 39.5 108.5 40H97L108.5 56.5L87.5 65Z" fill="white"/>
<path d="M67.5 32.5L47 9L51.5 0H84.5L88.5 9L67.5 32.5Z" fill="white"/>
<path d="M56 36L44 24H0C1.66667 25.3333 3 29.5 13 34.5C20.7398 38.3699 27.1667 40.1667 28.5 40H38.5L27 56.5L48.5 65L56 36Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 554 B

@@ -0,0 +1,6 @@
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M72 71L42 71L42 41L72 41L72 71Z" fill="white" fill-opacity="0.15"/>
<path d="M101.055 1.13167e-06L-9.79135e-06 9.9662e-06L-9.56827e-07 101.055L22 79.0552L22 21L80.0552 21L101.055 1.13167e-06Z" fill="white" fill-opacity="0.15"/>
<path d="M35.5112 91L92 91L92 34.5112L114 12.5112L114 112L14.5112 112L35.5112 91Z" fill="white" fill-opacity="0.15"/>
<path d="M101.055 1.13167e-06L-9.79135e-06 9.9662e-06L-9.56827e-07 101.055L22 79.0552L22 21L80.0552 21L101.055 1.13167e-06Z" fill="#C89B3C"/>
</svg>

After

Width:  |  Height:  |  Size: 604 B

@@ -0,0 +1,6 @@
<svg width="114" height="112" viewBox="0 0 114 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M72 71L42 71L42 41L72 41L72 71Z" fill="white" fill-opacity="0.15"/>
<path d="M101.055 1.13167e-06L-9.79135e-06 9.9662e-06L-9.56827e-07 101.055L22 79.0552L22 21L80.0552 21L101.055 1.13167e-06Z" fill="white" fill-opacity="0.15"/>
<path d="M35.5112 91L92 91L92 34.5112L114 12.5112L114 112L14.5112 112L35.5112 91Z" fill="white" fill-opacity="0.15"/>
<path d="M101.055 1.13167e-06L-9.79135e-06 9.9662e-06L-9.56827e-07 101.055L22 79.0552L22 21L80.0552 21L101.055 1.13167e-06Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 602 B

+124 -9
View File
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import { Link, useParams } from 'react-router';
import { Link, useLocation, useParams } from 'react-router';
import {
useAuction,
useAuctionHistory,
@@ -10,8 +10,6 @@ import {
useUndoAuction,
} from '../api/hooks';
import {
formatTierLabel,
getTierColorToken,
mapApiAuctionToAuctionState,
type AuctionStateView,
} from '../api/mappers';
@@ -36,6 +34,7 @@ import {
import type {
ApiAuction,
ApiRiotLaneStats,
ApiTierInfo,
Position,
} from '../api/types';
@@ -43,6 +42,19 @@ type CaptainRole = {
teamIndex: number;
};
const TIER_NAMES: Record<string, string> = {
IRON: '아이언',
BRONZE: '브론즈',
SILVER: '실버',
GOLD: '골드',
PLATINUM: '플래티넘',
EMERALD: '에메랄드',
DIAMOND: '다이아몬드',
MASTER: '마스터',
GRANDMASTER: '그랜드마스터',
CHALLENGER: '챌린저',
};
function formatPoints(value: number) {
return value.toLocaleString();
}
@@ -60,6 +72,90 @@ function relativeTime(dateLike: string) {
return `${Math.floor(hours / 24)}일 전`;
}
function normalizeRank(rank: string | undefined) {
switch (rank) {
case 'I':
return '1';
case 'II':
return '2';
case 'III':
return '3';
case 'IV':
return '4';
default:
return rank;
}
}
function formatRankBadge(tier: ApiTierInfo | undefined) {
if (!tier) return 'U';
const tierInitial =
tier.tier === 'GRANDMASTER' ? 'GM' : tier.tier.slice(0, 1);
const rank = normalizeRank(tier.rank);
return rank ? `${tierInitial}${rank}` : tierInitial;
}
function formatRankDetail(tier: ApiTierInfo | undefined) {
if (!tier) return '랭크 정보 없음';
const tierName = TIER_NAMES[tier.tier] ?? tier.tier;
const rank = normalizeRank(tier.rank);
const label = rank ? `${tierName} ${rank}` : tierName;
return `${label} - ${tier.leaguePoints} LP`;
}
function rankBadgeClass(tier: ApiTierInfo | undefined) {
switch (tier?.tier) {
case 'CHALLENGER':
return 'border-amber-500/60 bg-amber-100 text-amber-900 dark:border-amber-400/40 dark:bg-amber-400/20 dark:text-amber-200';
case 'GRANDMASTER':
return 'border-red-500/60 bg-red-100 text-red-800 dark:border-red-400/40 dark:bg-red-400/20 dark:text-red-200';
case 'MASTER':
return 'border-fuchsia-500/60 bg-fuchsia-100 text-fuchsia-800 dark:border-fuchsia-400/40 dark:bg-fuchsia-400/20 dark:text-fuchsia-200';
case 'DIAMOND':
return 'border-cyan-500/60 bg-cyan-100 text-cyan-800 dark:border-cyan-400/40 dark:bg-cyan-400/20 dark:text-cyan-200';
case 'EMERALD':
return 'border-emerald-500/60 bg-emerald-100 text-emerald-800 dark:border-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-200';
case 'PLATINUM':
return 'border-teal-500/60 bg-teal-100 text-teal-800 dark:border-teal-400/40 dark:bg-teal-400/20 dark:text-teal-200';
case 'GOLD':
return 'border-amber-500/70 bg-amber-100 text-amber-900 dark:border-yellow-400/40 dark:bg-yellow-400/20 dark:text-yellow-200';
case 'SILVER':
return 'border-slate-400/60 bg-slate-100 text-slate-700 dark:border-slate-300/40 dark:bg-slate-300/15 dark:text-slate-200';
case 'BRONZE':
return 'border-orange-600/60 bg-orange-100 text-orange-800 dark:border-orange-500/40 dark:bg-orange-500/20 dark:text-orange-200';
case 'IRON':
return 'border-stone-500/60 bg-stone-100 text-stone-700 dark:border-stone-400/40 dark:bg-stone-400/15 dark:text-stone-300';
default:
return 'border-base-content/30 bg-transparent text-base-content/50';
}
}
function RankBadge({ tier }: { tier?: ApiTierInfo }) {
const tooltip = formatRankDetail(tier);
return (
<span className="tooltip tooltip-bottom" data-tip={tooltip}>
<span
className={`inline-flex h-[18px] min-w-[20px] shrink-0 items-center justify-center whitespace-nowrap rounded-[3px] border px-1 text-[10px] font-black leading-none ${rankBadgeClass(tier)}`}
aria-label={tooltip}
>
{formatRankBadge(tier)}
</span>
</span>
);
}
function ResponsiveTierLabel({ tier }: { tier?: ApiTierInfo }) {
return (
<span className="inline-flex items-center gap-1.5 whitespace-nowrap">
<RankBadge tier={tier} />
<span className="hidden font-bold text-base-content/55 sm:inline">
{formatRankDetail(tier)}
</span>
</span>
);
}
function isCurrentBidder(
currentBidder: AuctionStateView['currentBidder'],
team: Pick<AuctionStateView['teams'][number], 'teamIndex'>,
@@ -241,10 +337,12 @@ function TeamPanel({
team,
isActive,
isLeft,
historyBackTo,
}: {
team: AuctionStateView['teams'][number];
isActive: boolean;
isLeft: boolean;
historyBackTo: string;
}) {
const { data: ddragon } = useDdragonManifest();
const tone = teamIndexColorClasses(team.teamIndex);
@@ -287,10 +385,14 @@ function TeamPanel({
</div>
) : (
team.members.map((member) => (
<div key={`${member.userId}-${member.assignedPosition}`} className="px-3 py-1.5 flex items-center gap-2">
<div
key={`${member.userId}-${member.assignedPosition}`}
className="px-3 py-1.5 flex items-center gap-2"
>
<Link
to={`/users/${member.userId}/history`}
className="flex flex-1 min-w-0 items-center gap-2 group"
state={{ backTo: historyBackTo }}
className="flex flex-1 min-w-0 items-center gap-1.5 group"
>
<div className="w-6 h-6 bg-base-content/10 overflow-hidden shrink-0">
<img
@@ -300,13 +402,16 @@ function TeamPanel({
loading="lazy"
/>
</div>
<RankBadge tier={member.tier} />
<div className="flex-1 min-w-0">
<span className="text-[12px] font-medium text-base-content truncate block leading-tight group-hover:text-primary transition-colors">
{member.summonerName}
</span>
</div>
</Link>
<PosBadge pos={member.assignedPosition} />
<span className="shrink-0 text-[11px] font-semibold text-base-content/45">
{positionLabel[member.assignedPosition]}
</span>
<span className="text-[10px] text-amber-400/60 tabular-nums w-8 text-right">
{member.cost}
</span>
@@ -332,8 +437,10 @@ function TeamPanel({
function PlayerSpotlight({
state,
historyBackTo,
}: {
state: AuctionStateView;
historyBackTo: string;
}) {
const { data: ddragon } = useDdragonManifest();
const player = state.currentPlayer;
@@ -345,6 +452,7 @@ function PlayerSpotlight({
<div className="flex items-start gap-4">
<Link
to={`/users/${player.userId}/history`}
state={{ backTo: historyBackTo }}
className="w-16 h-16 bg-base-content/10 overflow-hidden shrink-0"
>
<img
@@ -357,6 +465,7 @@ function PlayerSpotlight({
<div className="flex items-center gap-2 mb-1">
<Link
to={`/users/${player.userId}/history`}
state={{ backTo: historyBackTo }}
className="text-lg font-bold text-base-content leading-tight hover:text-primary transition-colors"
>
{player.summonerName}
@@ -365,8 +474,8 @@ function PlayerSpotlight({
#{player.tag}
</span>
</div>
<div className={`text-[11px] mb-2 font-bold ${getTierColorToken(player.tier)}`}>
{formatTierLabel(player.tier)}
<div className="mb-2 text-[11px]">
<ResponsiveTierLabel tier={player.tier} />
</div>
<div className="flex items-center gap-1.5">
<PosBadge pos={player.mainPosition} />
@@ -582,6 +691,7 @@ function BidLog({ bids }: { bids: AuctionStateView['bids'] }) {
export default function AuctionPage() {
const { id } = useParams();
const location = useLocation();
const queryClient = useQueryClient();
const meQuery = useMe();
const currentUser =
@@ -605,6 +715,7 @@ export default function AuctionPage() {
const captainTeamIndex = useDevCaptainTeamIndex();
const [now, setNow] = useState(() => Date.now());
const [assignedPosition, setAssignedPosition] = useState<Position>('MID');
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
useEffect(() => {
const timer = window.setInterval(() => setNow(Date.now()), 1000);
@@ -852,6 +963,7 @@ export default function AuctionPage() {
team={team}
isActive={isCurrentBidder(auctionState.currentBidder, team)}
isLeft={team.teamIndex % 2 === 1}
historyBackTo={historyBackTo}
/>
))}
</div>
@@ -877,7 +989,10 @@ export default function AuctionPage() {
</>
) : (
<>
<PlayerSpotlight state={auctionState} />
<PlayerSpotlight
state={auctionState}
historyBackTo={historyBackTo}
/>
{auctionState.phase === 'sold' && auctionState.currentBidder && (
<div
@@ -1,4 +1,4 @@
import { Link, useSearchParams } from 'react-router';
import { Link, useLocation, useSearchParams } from 'react-router';
import {
useCommunity,
useCommunityInternalStatsMatches,
@@ -198,6 +198,9 @@ function LeaderboardTable({
rows: ApiLeaderboardRow[];
manifest: ReturnType<typeof useDdragonManifest>['data'];
}) {
const location = useLocation();
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
return (
<div className="border border-base-content/10 bg-base-100 overflow-hidden">
<div className="overflow-x-auto">
@@ -224,6 +227,7 @@ function LeaderboardTable({
<td className="px-3 py-2.5">
<Link
to={`/users/${row.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="flex items-center gap-2 group"
>
<span className="w-7 h-7 bg-base-content/10 overflow-hidden">
@@ -1,4 +1,4 @@
import { Link, useParams } from 'react-router';
import { Link, useLocation, useParams } from 'react-router';
import { useDdragonManifest, useInternalMatchDetail } from '../api/hooks';
import type { ApiInternalMatchDetailResponse, TeamSide } from '../api/types';
import { DEFAULT_COMMUNITY_ID } from '../config';
@@ -81,6 +81,9 @@ function GamePanel({
game: ApiInternalMatchDetailResponse['games'][number];
manifest: ReturnType<typeof useDdragonManifest>['data'];
}) {
const location = useLocation();
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
return (
<section className="border border-base-content/10 bg-base-100 overflow-hidden">
<div className="px-4 py-3 border-b border-base-content/10 bg-base-200/40 flex flex-wrap items-center justify-between gap-3">
@@ -139,6 +142,7 @@ function GamePanel({
{participant.userId ? (
<Link
to={`/users/${participant.userId}/history?queueGroup=internal`}
state={{ backTo: historyBackTo }}
className="font-bold text-[13px] hover:text-primary"
>
{participant.summonerName}
+223 -168
View File
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { useMutation, useQueryClient } from '@tanstack/react-query';
import { Link, useNavigate, useParams } from 'react-router';
import { useEffect, useState } from "react";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { Link, useLocation, useNavigate, useParams } from "react-router";
import {
useAuction,
useDdragonManifest,
@@ -9,7 +9,7 @@ import {
usePollTournamentResult,
useTournamentCodeStats,
useUserHistoryProfile,
} from '../api/hooks';
} from "../api/hooks";
import {
buildDefaultPreferredPositions,
formatTierLabel,
@@ -17,17 +17,17 @@ import {
type MatchDetailView,
type ParticipantView,
type TeamView,
} from '../api/mappers';
import { DEFAULT_COMMUNITY_ID, useAuthUserId } from '../config';
import { apiFetch, ApiError } from '../lib/api';
import { profileIconUrl } from '../lib/ddragon';
} from "../api/mappers";
import { DEFAULT_COMMUNITY_ID, useAuthUserId } from "../config";
import { apiFetch, ApiError } from "../lib/api";
import { profileIconUrl } from "../lib/ddragon";
import {
positionIcon,
positionLabel,
sideShortLabel,
teamIndexColorClasses,
teamIndexLabel,
} from '../lib/league';
} from "../lib/league";
import type {
AuctionTopTierThreshold,
ApiMatchParticipant,
@@ -35,7 +35,7 @@ import type {
Position,
TeamSide,
TournamentCodeSlotView,
} from '../api/types';
} from "../api/types";
type CaptainSelectionSlot = {
teamIndex: number;
@@ -71,7 +71,9 @@ function buildAuctionParticipantPool(participants: ApiMatchParticipant[]) {
function buildCaptainSlots(
participants: ApiMatchParticipant[],
): CaptainSelectionSlot[] {
const teamCount = Math.floor(buildAuctionParticipantPool(participants).length / 5);
const teamCount = Math.floor(
buildAuctionParticipantPool(participants).length / 5,
);
return Array.from({ length: teamCount }, (_, index) => ({
teamIndex: index + 1,
}));
@@ -82,8 +84,8 @@ function PosBadge({ pos, sub }: { pos: Position; sub?: boolean }) {
<span
className={`inline-flex items-center gap-1.5 text-[11px] font-medium px-1.5 py-0.5 border ${
sub
? 'border-base-content/8 text-base-content/35 bg-transparent'
: 'border-primary/20 text-primary bg-primary/5'
? "border-base-content/8 text-base-content/35 bg-transparent"
: "border-primary/20 text-primary bg-primary/5"
}`}
>
<img
@@ -102,22 +104,22 @@ function tierByQueue(tiers: ApiTierInfo[], queueType: string) {
function normalizeRank(rank: string | undefined) {
switch (rank) {
case 'I':
return '1';
case 'II':
return '2';
case 'III':
return '3';
case 'IV':
return '4';
case "I":
return "1";
case "II":
return "2";
case "III":
return "3";
case "IV":
return "4";
default:
return rank;
}
}
function formatRankTooltip(tier: ApiTierInfo | undefined) {
if (!tier) return '언랭크';
const highTier = ['MASTER', 'GRANDMASTER', 'CHALLENGER'].includes(tier.tier);
if (!tier) return "언랭크";
const highTier = ["MASTER", "GRANDMASTER", "CHALLENGER"].includes(tier.tier);
const normalizedTier = {
...tier,
rank: normalizeRank(tier.rank) ?? tier.rank,
@@ -129,37 +131,37 @@ function formatRankTooltip(tier: ApiTierInfo | undefined) {
}
function formatRankBadge(tier: ApiTierInfo | undefined) {
if (!tier) return 'U';
if (!tier) return "U";
const tierInitial =
tier.tier === 'GRANDMASTER' ? 'GM' : tier.tier.slice(0, 1);
tier.tier === "GRANDMASTER" ? "GM" : tier.tier.slice(0, 1);
const rank = normalizeRank(tier.rank);
return rank ? `${tierInitial}${rank}` : tierInitial;
}
function rankBadgeClass(tier: ApiTierInfo | undefined) {
switch (tier?.tier) {
case 'CHALLENGER':
return 'border-amber-500/60 bg-amber-100 text-amber-900 dark:border-amber-400/40 dark:bg-amber-400/20 dark:text-amber-200';
case 'GRANDMASTER':
return 'border-red-500/60 bg-red-100 text-red-800 dark:border-red-400/40 dark:bg-red-400/20 dark:text-red-200';
case 'MASTER':
return 'border-fuchsia-500/60 bg-fuchsia-100 text-fuchsia-800 dark:border-fuchsia-400/40 dark:bg-fuchsia-400/20 dark:text-fuchsia-200';
case 'DIAMOND':
return 'border-cyan-500/60 bg-cyan-100 text-cyan-800 dark:border-cyan-400/40 dark:bg-cyan-400/20 dark:text-cyan-200';
case 'EMERALD':
return 'border-emerald-500/60 bg-emerald-100 text-emerald-800 dark:border-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-200';
case 'PLATINUM':
return 'border-teal-500/60 bg-teal-100 text-teal-800 dark:border-teal-400/40 dark:bg-teal-400/20 dark:text-teal-200';
case 'GOLD':
return 'border-amber-500/70 bg-amber-100 text-amber-900 dark:border-yellow-400/40 dark:bg-yellow-400/20 dark:text-yellow-200';
case 'SILVER':
return 'border-slate-400/60 bg-slate-100 text-slate-700 dark:border-slate-300/40 dark:bg-slate-300/15 dark:text-slate-200';
case 'BRONZE':
return 'border-orange-600/60 bg-orange-100 text-orange-800 dark:border-orange-500/40 dark:bg-orange-500/20 dark:text-orange-200';
case 'IRON':
return 'border-stone-500/60 bg-stone-100 text-stone-700 dark:border-stone-400/40 dark:bg-stone-400/15 dark:text-stone-300';
case "CHALLENGER":
return "border-amber-500/60 bg-amber-100 text-amber-900 dark:border-amber-400/40 dark:bg-amber-400/20 dark:text-amber-200";
case "GRANDMASTER":
return "border-red-500/60 bg-red-100 text-red-800 dark:border-red-400/40 dark:bg-red-400/20 dark:text-red-200";
case "MASTER":
return "border-fuchsia-500/60 bg-fuchsia-100 text-fuchsia-800 dark:border-fuchsia-400/40 dark:bg-fuchsia-400/20 dark:text-fuchsia-200";
case "DIAMOND":
return "border-cyan-500/60 bg-cyan-100 text-cyan-800 dark:border-cyan-400/40 dark:bg-cyan-400/20 dark:text-cyan-200";
case "EMERALD":
return "border-emerald-500/60 bg-emerald-100 text-emerald-800 dark:border-emerald-400/40 dark:bg-emerald-400/20 dark:text-emerald-200";
case "PLATINUM":
return "border-teal-500/60 bg-teal-100 text-teal-800 dark:border-teal-400/40 dark:bg-teal-400/20 dark:text-teal-200";
case "GOLD":
return "border-amber-500/70 bg-amber-100 text-amber-900 dark:border-yellow-400/40 dark:bg-yellow-400/20 dark:text-yellow-200";
case "SILVER":
return "border-slate-400/60 bg-slate-100 text-slate-700 dark:border-slate-300/40 dark:bg-slate-300/15 dark:text-slate-200";
case "BRONZE":
return "border-orange-600/60 bg-orange-100 text-orange-800 dark:border-orange-500/40 dark:bg-orange-500/20 dark:text-orange-200";
case "IRON":
return "border-stone-500/60 bg-stone-100 text-stone-700 dark:border-stone-400/40 dark:bg-stone-400/15 dark:text-stone-300";
default:
return 'border-base-content/30 bg-transparent text-base-content/50';
return "border-base-content/30 bg-transparent text-base-content/50";
}
}
@@ -182,7 +184,7 @@ function QueueRankCell({
label,
tier,
}: {
label: 'SOLO' | 'FLEX';
label: "SOLO" | "FLEX";
tier?: ApiTierInfo;
}) {
return (
@@ -200,11 +202,11 @@ function TierCell({ participant }: { participant: ParticipantView }) {
);
const tiers = profileQuery.data?.tiers ?? [];
const soloTier =
tierByQueue(tiers, 'RANKED_SOLO_5x5') ??
(participant.tier?.queueType === 'RANKED_SOLO_5x5'
tierByQueue(tiers, "RANKED_SOLO_5x5") ??
(participant.tier?.queueType === "RANKED_SOLO_5x5"
? participant.tier
: undefined);
const flexTier = tierByQueue(tiers, 'RANKED_FLEX_SR');
const flexTier = tierByQueue(tiers, "RANKED_FLEX_SR");
return (
<div className="flex items-center gap-2 text-[10px] font-black text-base-content/35 whitespace-nowrap">
@@ -214,27 +216,27 @@ function TierCell({ participant }: { participant: ParticipantView }) {
);
}
function statusBadge(status: MatchDetailView['status']) {
function statusBadge(status: MatchDetailView["status"]) {
switch (status) {
case 'recruiting':
case "recruiting":
return {
label: '모집 중',
cls: 'bg-green-500/15 text-green-500 border-green-500/20',
label: "모집 중",
cls: "bg-green-500/15 text-green-500 border-green-500/20",
};
case 'team-built':
case "team-built":
return {
label: '팀빌딩 완료',
cls: 'bg-amber-500/15 text-amber-500 border-amber-500/20',
label: "팀빌딩 완료",
cls: "bg-amber-500/15 text-amber-500 border-amber-500/20",
};
case 'in-progress':
case "in-progress":
return {
label: '진행 중',
cls: 'bg-blue-500/15 text-blue-400 border-blue-500/20',
label: "진행 중",
cls: "bg-blue-500/15 text-blue-400 border-blue-500/20",
};
case 'finished':
case "finished":
return {
label: '종료',
cls: 'bg-base-content/8 text-base-content/40 border-base-content/10',
label: "종료",
cls: "bg-base-content/8 text-base-content/40 border-base-content/10",
};
}
}
@@ -249,6 +251,9 @@ function ParticipantRow({
assignedPos?: Position;
}) {
const { data: ddragon } = useDdragonManifest();
const location = useLocation();
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
return (
<tr className="border-b border-base-content/5 last:border-b-0 hover:bg-base-content/[0.02] transition-colors">
<td className="py-2 px-3 text-center text-[11px] text-base-content/30 w-8">
@@ -257,6 +262,7 @@ function ParticipantRow({
<td className="py-2 px-3">
<Link
to={`/users/${participant.userId}/history`}
state={{ backTo: historyBackTo }}
className="flex items-center gap-2 group"
>
<div className="w-7 h-7 bg-base-content/10 overflow-hidden shrink-0">
@@ -330,7 +336,7 @@ function ParticipantTable({
disabled={!canJoin || joined || isJoining}
className="btn btn-primary btn-xs px-4 text-[11px] font-semibold disabled:opacity-40"
>
{joined ? '참가 완료' : isJoining ? '신청 중...' : '참가 신청'}
{joined ? "참가 완료" : isJoining ? "신청 중..." : "참가 신청"}
</button>
</div>
<div className="overflow-x-auto">
@@ -378,13 +384,17 @@ function TeamCard({
const tone = teamIndexColorClasses(team.teamIndex);
return (
<div className={`border ${tone.border} overflow-hidden bg-base-100 relative`}>
<div
className={`border ${tone.border} overflow-hidden bg-base-100 relative`}
>
<div className={`absolute left-0 top-0 bottom-0 w-0.5 ${tone.bar}`} />
<div
className={`${tone.bg} px-4 py-2 flex items-center justify-between border-b ${tone.border}`}
>
<div className="flex items-center gap-2">
<span className={`text-xs font-bold uppercase tracking-wide ${tone.text}`}>
<span
className={`text-xs font-bold uppercase tracking-wide ${tone.text}`}
>
{team.name}
</span>
{isWinner && (
@@ -445,11 +455,11 @@ function SideCard({
function formatTournamentCodeExpiry(value: string | null) {
if (!value) return null;
return new Intl.DateTimeFormat('ko-KR', {
month: 'long',
day: 'numeric',
hour: '2-digit',
minute: '2-digit',
return new Intl.DateTimeFormat("ko-KR", {
month: "long",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
}).format(new Date(value));
}
@@ -461,8 +471,8 @@ function isExpiringSoon(value: string | null) {
function TournamentCodeDisplay({ slot }: { slot: TournamentCodeSlotView }) {
const [copied, setCopied] = useState(false);
const expired = slot.state === 'expired';
const used = slot.state === 'used';
const expired = slot.state === "expired";
const used = slot.state === "used";
const expiringSoon = isExpiringSoon(slot.expiresAt);
async function copyCode() {
@@ -477,14 +487,14 @@ function TournamentCodeDisplay({ slot }: { slot: TournamentCodeSlotView }) {
<div
className={`flex items-center gap-2 border px-2 py-1.5 ${
expired
? 'border-red-500/20 bg-red-500/8 text-red-400'
? "border-red-500/20 bg-red-500/8 text-red-400"
: used
? 'border-base-content/8 bg-base-content/5 text-base-content/35'
: 'border-primary/20 bg-primary/5 text-base-content'
? "border-base-content/8 bg-base-content/5 text-base-content/35"
: "border-primary/20 bg-primary/5 text-base-content"
}`}
>
<code className="font-mono text-[12px] font-bold truncate">
{expired ? '코드 만료' : slot.code}
{expired ? "코드 만료" : slot.code}
</code>
{slot.code && !expired && (
<button
@@ -492,19 +502,19 @@ function TournamentCodeDisplay({ slot }: { slot: TournamentCodeSlotView }) {
className="ml-auto text-[10px] px-1.5 py-0.5 border border-base-content/10 text-base-content/45 hover:text-primary"
onClick={copyCode}
>
{copied ? '복사됨' : '복사'}
{copied ? "복사됨" : "복사"}
</button>
)}
</div>
<div
className={`mt-1 text-[10px] ${
expired || expiringSoon ? 'text-amber-500' : 'text-base-content/30'
expired || expiringSoon ? "text-amber-500" : "text-base-content/30"
}`}
>
{used
? '사용됨'
? "사용됨"
: expired
? '운영자에게 새 코드를 요청해주세요.'
? "운영자에게 새 코드를 요청해주세요."
: `만료: ${formatTournamentCodeExpiry(slot.expiresAt)}`}
</div>
</div>
@@ -520,7 +530,8 @@ function TournamentCodeList({ slots }: { slots: TournamentCodeSlotView[] }) {
{slot.gameNumber}경기
{(slot.teamAIndex > 1 || slot.teamBIndex > 2) && (
<span className="block text-[10px] font-normal text-base-content/25">
{teamIndexLabel(slot.teamAIndex)} vs {teamIndexLabel(slot.teamBIndex)}
{teamIndexLabel(slot.teamAIndex)} vs{" "}
{teamIndexLabel(slot.teamBIndex)}
</span>
)}
</span>
@@ -545,9 +556,9 @@ function PoolStatsHint({ enabled }: { enabled: boolean }) {
return (
<div className="mt-3 border-t border-base-content/8 pt-3 text-[11px]">
<div className={available < 5 ? 'text-red-400' : 'text-base-content/35'}>
<div className={available < 5 ? "text-red-400" : "text-base-content/35"}>
풀 잔여 {available}개
{expiringSoon > 0 ? ` · 만료 임박 ${expiringSoon}개` : ''}
{expiringSoon > 0 ? ` · 만료 임박 ${expiringSoon}개` : ""}
</div>
<Link
to={`/admin/communities/${DEFAULT_COMMUNITY_ID}/tournament-codes`}
@@ -562,11 +573,11 @@ function PoolStatsHint({ enabled }: { enabled: boolean }) {
function formatGameDuration(seconds: number) {
const minutes = Math.floor(seconds / 60);
const rest = seconds % 60;
return `${minutes}:${String(rest).padStart(2, '0')}`;
return `${minutes}:${String(rest).padStart(2, "0")}`;
}
function resultSideClass(side: 'blue' | 'red') {
return side === 'blue' ? 'text-blue-400' : 'text-red-400';
function resultSideClass(side: "blue" | "red") {
return side === "blue" ? "text-blue-400" : "text-red-400";
}
function resultSideLabel(side: TeamSide) {
@@ -594,8 +605,8 @@ type RoundRobinStanding = {
};
function formatRecordRate(value: number) {
if (!Number.isFinite(value)) return '-';
return value.toFixed(2).replace(/\.?0+$/, '');
if (!Number.isFinite(value)) return "-";
return value.toFixed(2).replace(/\.?0+$/, "");
}
function formatSignedNumber(value: number) {
@@ -604,7 +615,7 @@ function formatSignedNumber(value: number) {
function formatKda(standing: RoundRobinStanding) {
if (standing.deaths === 0) {
return standing.kills + standing.assists > 0 ? 'Perfect' : '-';
return standing.kills + standing.assists > 0 ? "Perfect" : "-";
}
return formatRecordRate(standing.kdaScore);
}
@@ -760,7 +771,7 @@ function RoundRobinStandingsTable({ match }: { match: MatchDetailView }) {
return (
<tr
key={standing.teamIndex}
className={isWinner ? 'bg-amber-400/5' : undefined}
className={isWinner ? "bg-amber-400/5" : undefined}
>
<td className="h-14 px-3">
<div className="flex items-center gap-3 min-w-0">
@@ -828,7 +839,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
const seriesResults = match.result.seriesResults ?? [];
const primarySeries = seriesResults[0];
const showRoundRobinStandings =
match.gameMode === 'round-robin' && match.teams.length > 2;
match.gameMode === "round-robin" && match.teams.length > 2;
return (
<div className="mb-6 border border-base-content/10 bg-base-content/[0.02] p-5">
@@ -839,7 +850,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
{primarySeries && (
<div className="flex items-center justify-center gap-8">
<div
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : 'text-base-content/30'}`}
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : "text-base-content/30"}`}
>
<div className="text-3xl font-black tabular-nums">
{primarySeries.teamAWins}
@@ -852,7 +863,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
VS
</div>
<div
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : 'text-base-content/30'}`}
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : "text-base-content/30"}`}
>
<div className="text-3xl font-black tabular-nums">
{primarySeries.teamBWins}
@@ -876,7 +887,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
className="border border-base-content/8 bg-base-100 px-3 py-2 text-xs"
>
<div className="font-bold text-base-content/55">
{resolveMatchTeamName(match, series.teamAIndex)} vs{' '}
{resolveMatchTeamName(match, series.teamAIndex)} vs{" "}
{resolveMatchTeamName(match, series.teamBIndex)}
</div>
<div className="mt-1 flex items-center justify-between">
@@ -927,7 +938,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
<span className="text-base-content/25">대기 중</span>
)}
<span className="text-base-content/35 font-mono">
{game ? formatGameDuration(game.gameDuration) : '-'}
{game ? formatGameDuration(game.gameDuration) : "-"}
</span>
</div>
);
@@ -954,30 +965,33 @@ export default function MatchDetailPage() {
Record<string, CaptainSelection>
>({});
const [topTierThreshold, setTopTierThreshold] =
useState<AuctionTopTierThreshold>('NONE');
const [manualTopTierUserIds, setManualTopTierUserIds] = useState<string[]>([]);
const pollTournamentResultMutation = usePollTournamentResult(
DEFAULT_COMMUNITY_ID,
useState<AuctionTopTierThreshold>("NONE");
const [manualTopTierUserIds, setManualTopTierUserIds] = useState<string[]>(
[],
);
const pollTournamentResultMutation =
usePollTournamentResult(DEFAULT_COMMUNITY_ID);
const joinMatchMutation = useMutation({
mutationFn: () =>
apiFetch(`/communities/${DEFAULT_COMMUNITY_ID}/matches/${id}/participants`, {
method: 'POST',
body: JSON.stringify({
preferredPositions:
currentUser?.preferredPositions.length
apiFetch(
`/communities/${DEFAULT_COMMUNITY_ID}/matches/${id}/participants`,
{
method: "POST",
body: JSON.stringify({
preferredPositions: currentUser?.preferredPositions.length
? currentUser.preferredPositions.slice(0, 5)
: buildDefaultPreferredPositions(),
}),
}),
}),
},
),
onSuccess: async () => {
await Promise.all([
queryClient.invalidateQueries({
queryKey: ['match', DEFAULT_COMMUNITY_ID, id ?? null],
queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null],
}),
queryClient.invalidateQueries({
queryKey: ['matches', DEFAULT_COMMUNITY_ID],
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
}),
]);
},
@@ -986,7 +1000,7 @@ export default function MatchDetailPage() {
const startAuctionMutation = useMutation({
mutationFn: () =>
apiFetch(`/communities/${DEFAULT_COMMUNITY_ID}/matches/${id}/auction`, {
method: 'POST',
method: "POST",
body: JSON.stringify({
captains: buildCaptainSlots(matchQuery.data?.participants ?? []).map(
(slot) => ({
@@ -994,24 +1008,24 @@ export default function MatchDetailPage() {
userId: captainSelections[captainSlotKey(slot)]?.userId,
initialPoints:
parseInitialPointsInput(
captainSelections[captainSlotKey(slot)]?.initialPoints ?? '',
captainSelections[captainSlotKey(slot)]?.initialPoints ?? "",
) ?? 1000,
}),
),
initialPoints: 1000,
topTierThreshold,
manualTopTierUserIds:
topTierThreshold === 'MANUAL' ? selectedManualTopTierUserIds : [],
topTierThreshold === "MANUAL" ? selectedManualTopTierUserIds : [],
maxTimerSeconds: 30,
}),
}),
onSuccess: async () => {
await Promise.all([
queryClient.invalidateQueries({
queryKey: ['match', DEFAULT_COMMUNITY_ID, id ?? null],
queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null],
}),
queryClient.invalidateQueries({
queryKey: ['auction', DEFAULT_COMMUNITY_ID, id ?? null],
queryKey: ["auction", DEFAULT_COMMUNITY_ID, id ?? null],
}),
]);
navigate(`/match/${id}/auction`);
@@ -1023,7 +1037,7 @@ export default function MatchDetailPage() {
pollTournamentResultMutation.mutate(id, {
onSuccess: async () => {
await queryClient.invalidateQueries({
queryKey: ['match', DEFAULT_COMMUNITY_ID, id ?? null],
queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null],
});
},
});
@@ -1049,13 +1063,15 @@ export default function MatchDetailPage() {
const currentUserId = currentSelection?.userId;
const currentIsValid =
currentUserId &&
participants.some((participant) => participant.userId === currentUserId) &&
participants.some(
(participant) => participant.userId === currentUserId,
) &&
!usedUserIds.has(currentUserId);
if (currentIsValid) {
next[key] = {
userId: currentUserId,
initialPoints: currentSelection?.initialPoints ?? '1000',
initialPoints: currentSelection?.initialPoints ?? "1000",
};
usedUserIds.add(currentUserId);
continue;
@@ -1065,8 +1081,8 @@ export default function MatchDetailPage() {
(participant) => !usedUserIds.has(participant.userId),
);
next[key] = {
userId: fallback?.userId ?? '',
initialPoints: currentSelection?.initialPoints ?? '1000',
userId: fallback?.userId ?? "",
initialPoints: currentSelection?.initialPoints ?? "1000",
};
if (fallback) usedUserIds.add(fallback.userId);
}
@@ -1088,7 +1104,9 @@ export default function MatchDetailPage() {
if (matchQuery.isLoading) {
return (
<main className="max-w-5xl mx-auto px-4 py-20 text-center">
<span className="text-sm text-base-content/40">매치 정보를 불러오는 중...</span>
<span className="text-sm text-base-content/40">
매치 정보를 불러오는 중...
</span>
</main>
);
}
@@ -1107,7 +1125,7 @@ export default function MatchDetailPage() {
const match = mapApiMatchToMatchDetail(matchQuery.data);
const si = statusBadge(match.status);
const canManageAuction =
currentUser?.role === 'owner' || currentUser?.role === 'admin';
currentUser?.role === "owner" || currentUser?.role === "admin";
const isCheckingPermissions =
meQuery.isLoading || (meQuery.isFetching && !meQuery.data);
const auctionNotStarted =
@@ -1126,7 +1144,7 @@ export default function MatchDetailPage() {
const hasValidCaptainInitialPoints = captainSlots.every((slot) =>
Boolean(
parseInitialPointsInput(
captainSelections[captainSlotKey(slot)]?.initialPoints ?? '',
captainSelections[captainSlotKey(slot)]?.initialPoints ?? "",
),
),
);
@@ -1143,7 +1161,7 @@ export default function MatchDetailPage() {
matchQuery.data.participants.length - auctionParticipantPool.length;
const canStartAuction =
canManageAuction &&
match.status === 'recruiting' &&
match.status === "recruiting" &&
auctionParticipantPool.length >= 10 &&
auctionNotStarted &&
hasUniqueCaptainSelections &&
@@ -1183,9 +1201,13 @@ export default function MatchDetailPage() {
{si.label}
</span>
</div>
<p className="text-sm text-base-content/50 mb-2.5">{match.description}</p>
<p className="text-sm text-base-content/50 mb-2.5">
{match.description}
</p>
<div className="flex items-center gap-3 text-xs text-base-content/40 flex-wrap">
<span>{match.date} {match.time}</span>
<span>
{match.date} {match.time}
</span>
<span className="text-base-content/15">|</span>
<span>
{match.participants.length}/{match.maxParticipants}명
@@ -1219,7 +1241,7 @@ export default function MatchDetailPage() {
<div className="flex flex-col lg:flex-row gap-5">
<div className="flex-1 min-w-0 space-y-4">
{match.status === 'recruiting' ? (
{match.status === "recruiting" ? (
<>
<ParticipantTable
participants={match.participants}
@@ -1246,17 +1268,22 @@ export default function MatchDetailPage() {
경매 시작
</h3>
<p className="mt-1 text-xs text-base-content/40">
참가 신청 순서 기준 5명당 1개 팀이 만들어지고, 각 팀의 팀장을 지정합니다.
참가 신청 순서 기준 5명당 1개 팀이 만들어지고, 각 팀의
팀장을 지정합니다.
</p>
{waitingParticipantCount > 0 && (
<p className="mt-1 text-[11px] text-amber-500">
{waitingParticipantCount}명은 10명 단위에 맞지 않아 이번 경매에서 제외됩니다.
{waitingParticipantCount}명은 10명 단위에 맞지 않아 이번
경매에서 제외됩니다.
</p>
)}
</div>
{showAuctionLink ? (
<Link to={`/match/${match.id}/auction`} className="btn btn-primary btn-sm px-5 text-xs">
<Link
to={`/match/${match.id}/auction`}
className="btn btn-primary btn-sm px-5 text-xs"
>
경매 페이지 열기
</Link>
) : (
@@ -1266,7 +1293,7 @@ export default function MatchDetailPage() {
{captainSlots.map((slot) => {
const key = captainSlotKey(slot);
const currentSelection = captainSelections[key];
const currentValue = currentSelection?.userId ?? '';
const currentValue = currentSelection?.userId ?? "";
return (
<label
key={key}
@@ -1283,28 +1310,35 @@ export default function MatchDetailPage() {
[key]: {
userId: event.target.value,
initialPoints:
current[key]?.initialPoints ?? '1000',
current[key]?.initialPoints ??
"1000",
},
}))
}
>
<option value="">선택하세요</option>
{auctionParticipantPool.map((participant) => {
const selectedByOtherSlot =
selectedCaptainIds.includes(
participant.userId,
) && currentValue !== participant.userId;
return (
<option
key={`${key}-${participant.userId}`}
value={participant.userId}
disabled={selectedByOtherSlot}
>
{participant.gameName ?? participant.userId}
{selectedByOtherSlot ? ' (선택됨)' : ''}
</option>
);
})}
{auctionParticipantPool.map(
(participant) => {
const selectedByOtherSlot =
selectedCaptainIds.includes(
participant.userId,
) &&
currentValue !== participant.userId;
return (
<option
key={`${key}-${participant.userId}`}
value={participant.userId}
disabled={selectedByOtherSlot}
>
{participant.gameName ??
participant.userId}
{selectedByOtherSlot
? " (선택됨)"
: ""}
</option>
);
},
)}
</select>
<input
type="number"
@@ -1312,12 +1346,14 @@ export default function MatchDetailPage() {
max={100000}
step={50}
className="w-full border border-base-content/10 bg-transparent px-2 py-2 text-sm tabular-nums"
value={currentSelection?.initialPoints ?? '1000'}
value={
currentSelection?.initialPoints ?? "1000"
}
onChange={(event) =>
setCaptainSelections((current) => ({
...current,
[key]: {
userId: current[key]?.userId ?? '',
userId: current[key]?.userId ?? "",
initialPoints: event.target.value,
},
}))
@@ -1325,14 +1361,14 @@ export default function MatchDetailPage() {
onBlur={() =>
setCaptainSelections((current) => {
const points = parseInitialPointsInput(
current[key]?.initialPoints ?? '',
current[key]?.initialPoints ?? "",
);
if (points !== null) return current;
return {
...current,
[key]: {
userId: current[key]?.userId ?? '',
initialPoints: '1000',
userId: current[key]?.userId ?? "",
initialPoints: "1000",
},
};
})
@@ -1366,16 +1402,17 @@ export default function MatchDetailPage() {
<option value="MANUAL">수동 선택</option>
</select>
</label>
{topTierThreshold === 'MANUAL' && (
{topTierThreshold === "MANUAL" && (
<div className="border border-base-content/10 bg-base-200/20 p-3">
<div className="mb-2 text-[11px] font-bold uppercase tracking-wider text-base-content/35">
우선 등장 선수
</div>
<div className="max-h-48 overflow-y-auto space-y-1">
{manualPriorityCandidates.map((participant) => {
const checked = selectedManualTopTierUserIds.includes(
participant.userId,
);
const checked =
selectedManualTopTierUserIds.includes(
participant.userId,
);
return (
<label
key={participant.userId}
@@ -1384,7 +1421,7 @@ export default function MatchDetailPage() {
<span className="min-w-0 truncate">
{participant.gameName ?? participant.userId}
<span className="ml-1 text-base-content/25">
#{participant.tagLine ?? '----'}
#{participant.tagLine ?? "----"}
</span>
</span>
<input
@@ -1394,7 +1431,12 @@ export default function MatchDetailPage() {
onChange={(event) =>
setManualTopTierUserIds((current) =>
event.target.checked
? [...new Set([...current, participant.userId])]
? [
...new Set([
...current,
participant.userId,
]),
]
: current.filter(
(userId) =>
userId !== participant.userId,
@@ -1417,14 +1459,19 @@ export default function MatchDetailPage() {
<button
type="button"
className="btn btn-primary btn-sm px-5 text-xs"
disabled={!canStartAuction || startAuctionMutation.isPending}
disabled={
!canStartAuction || startAuctionMutation.isPending
}
onClick={() => startAuctionMutation.mutate()}
>
{startAuctionMutation.isPending ? '시작 중...' : '경매 시작'}
{startAuctionMutation.isPending
? "시작 중..."
: "경매 시작"}
</button>
{!canUseMemberActions && (
<span className="text-xs text-amber-600">
로그인 또는 Dev Auth에 owner/admin User ID를 먼저 입력해주세요.
로그인 또는 Dev Auth에 owner/admin User ID를 먼저
입력해주세요.
</span>
)}
</div>
@@ -1441,7 +1488,7 @@ export default function MatchDetailPage() {
team={team}
matchId={match.id}
isWinner={
match.status === 'finished'
match.status === "finished"
? match.result?.winnerTeamIndex === team.teamIndex
: undefined
}
@@ -1449,7 +1496,10 @@ export default function MatchDetailPage() {
))}
{showAuctionLink && (
<div className="flex justify-end">
<Link to={`/match/${match.id}/auction`} className="btn btn-primary btn-sm px-5 text-xs">
<Link
to={`/match/${match.id}/auction`}
className="btn btn-primary btn-sm px-5 text-xs"
>
경매 페이지 열기
</Link>
</div>
@@ -1463,7 +1513,10 @@ export default function MatchDetailPage() {
<SideCard title="일정">
<ul className="space-y-2">
{match.schedule.map((item, index) => (
<li key={index} className="flex items-start gap-2.5 text-[13px]">
<li
key={index}
className="flex items-start gap-2.5 text-[13px]"
>
<span className="font-mono text-[11px] text-base-content/30 w-11 shrink-0 pt-px">
{item.time}
</span>
@@ -1474,7 +1527,8 @@ export default function MatchDetailPage() {
</SideCard>
)}
{(match.status === 'team-built' || match.status === 'in-progress') && (
{(match.status === "team-built" ||
match.status === "in-progress") && (
<SideCard title="토너먼트 코드">
<TournamentCodeList slots={match.tournamentCodes} />
<PoolStatsHint enabled={canManageAuction} />
@@ -1482,7 +1536,8 @@ export default function MatchDetailPage() {
)}
{canManageAuction &&
(match.status === 'team-built' || match.status === 'in-progress') && (
(match.status === "team-built" ||
match.status === "in-progress") && (
<SideCard title="결과 수집">
<p className="text-[12px] text-base-content/45 mb-3">
Riot match-v5에서 토너먼트 코드가 붙은 경기를 다시 찾습니다.
@@ -1494,8 +1549,8 @@ export default function MatchDetailPage() {
onClick={handlePollTournamentResult}
>
{pollTournamentResultMutation.isPending
? '등록 중...'
: '결과 다시 수집'}
? "등록 중..."
: "결과 다시 수집"}
</button>
</SideCard>
)}
+4 -1
View File
@@ -1,6 +1,6 @@
import { useState } from "react";
import { ChevronDown, ChevronUp } from "lucide-react";
import { Link, useParams } from "react-router";
import { Link, useLocation, useParams } from "react-router";
import {
useDdragonManifest,
useMatch,
@@ -196,6 +196,8 @@ function ParticipantLine({
isCaptain?: boolean;
}) {
const { data: ddragon } = useDdragonManifest();
const location = useLocation();
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
const name = participant?.gameName ?? "알 수 없는 참가자";
const tag = participant?.tagLine ?? "----";
const content = (
@@ -236,6 +238,7 @@ function ParticipantLine({
return (
<Link
to={`/users/${participant.userId}/history`}
state={{ backTo: historyBackTo }}
className={`${className} hover:bg-base-content/[0.025]`}
>
{content}
+23 -4
View File
@@ -1,6 +1,6 @@
import { useMemo, useState } from "react";
import { useQueryClient } from "@tanstack/react-query";
import { Link, useParams, useSearchParams } from "react-router";
import { Link, useLocation, useParams, useSearchParams } from "react-router";
import {
useChampionStats,
useDdragonManifest,
@@ -40,6 +40,10 @@ import {
type ChampionSortKey = "games" | "winRate" | "kda" | "avgCsPerMin";
type HistoryLocationState = {
backTo?: unknown;
};
const SORT_LABELS: Record<ChampionSortKey, string> = {
games: "게임 수",
winRate: "승률",
@@ -60,6 +64,19 @@ const TIER_NAMES: Record<string, string> = {
CHALLENGER: "챌린저",
};
function resolveBackTo(state: unknown) {
if (!state || typeof state !== "object") return "/";
const backTo = (state as HistoryLocationState).backTo;
if (
typeof backTo !== "string" ||
!backTo.startsWith("/") ||
backTo.startsWith("//")
) {
return "/";
}
return backTo;
}
function normalizeRank(rank: string | undefined) {
switch (rank) {
case "I":
@@ -581,8 +598,10 @@ function RecentMatchCard({
export default function UserHistoryPage() {
const { userId } = useParams();
const location = useLocation();
const queryClient = useQueryClient();
const [searchParams, setSearchParams] = useSearchParams();
const [backTo] = useState(() => resolveBackTo(location.state));
const [championSearch, setChampionSearch] = useState("");
const [sortKey, setSortKey] = useState<ChampionSortKey>("games");
const [refreshResult, setRefreshResult] =
@@ -720,7 +739,7 @@ export default function UserHistoryPage() {
params.set(key, String(value));
}
}
setSearchParams(params);
setSearchParams(params, { state: { backTo } });
}
async function invalidateHistoryQueries() {
@@ -820,10 +839,10 @@ export default function UserHistoryPage() {
return (
<main className="max-w-6xl mx-auto px-4 sm:px-6 py-6">
<Link
to="/"
to={backTo}
className="inline-flex items-center gap-1 text-xs text-base-content/40 hover:text-base-content transition-colors mb-5"
>
← 목록으로
← 이전으로
</Link>
<section className="border border-base-content/10 bg-base-100 p-5 mb-5">