diff --git a/apps/web/src/assets/position/bot-gold.svg b/apps/web/src/assets/position/bot-gold.svg new file mode 100644 index 00000000..caafb7ba --- /dev/null +++ b/apps/web/src/assets/position/bot-gold.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web/src/assets/position/bot-white.svg b/apps/web/src/assets/position/bot-white.svg new file mode 100644 index 00000000..2c4fcc73 --- /dev/null +++ b/apps/web/src/assets/position/bot-white.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web/src/assets/position/jungle-gold.svg b/apps/web/src/assets/position/jungle-gold.svg new file mode 100644 index 00000000..759c655f --- /dev/null +++ b/apps/web/src/assets/position/jungle-gold.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/assets/position/jungle-white.svg b/apps/web/src/assets/position/jungle-white.svg new file mode 100644 index 00000000..3d04f51c --- /dev/null +++ b/apps/web/src/assets/position/jungle-white.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/assets/position/mid-gold.svg b/apps/web/src/assets/position/mid-gold.svg new file mode 100644 index 00000000..e1bfff78 --- /dev/null +++ b/apps/web/src/assets/position/mid-gold.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/assets/position/mid-white.svg b/apps/web/src/assets/position/mid-white.svg new file mode 100644 index 00000000..fef3b83f --- /dev/null +++ b/apps/web/src/assets/position/mid-white.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/apps/web/src/assets/position/support-gold.svg b/apps/web/src/assets/position/support-gold.svg new file mode 100644 index 00000000..a89d6a15 --- /dev/null +++ b/apps/web/src/assets/position/support-gold.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web/src/assets/position/support-white.svg b/apps/web/src/assets/position/support-white.svg new file mode 100644 index 00000000..18f6851c --- /dev/null +++ b/apps/web/src/assets/position/support-white.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web/src/assets/position/top-gold.svg b/apps/web/src/assets/position/top-gold.svg new file mode 100644 index 00000000..442f48da --- /dev/null +++ b/apps/web/src/assets/position/top-gold.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web/src/assets/position/top-white.svg b/apps/web/src/assets/position/top-white.svg new file mode 100644 index 00000000..fa3e1b6d --- /dev/null +++ b/apps/web/src/assets/position/top-white.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/apps/web/src/pages/AuctionPage.tsx b/apps/web/src/pages/AuctionPage.tsx index 81885208..0478e23f 100644 --- a/apps/web/src/pages/AuctionPage.tsx +++ b/apps/web/src/pages/AuctionPage.tsx @@ -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 = { + 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 ( + + + {formatRankBadge(tier)} + + + ); +} + +function ResponsiveTierLabel({ tier }: { tier?: ApiTierInfo }) { + return ( + + + + {formatRankDetail(tier)} + + + ); +} + function isCurrentBidder( currentBidder: AuctionStateView['currentBidder'], team: Pick, @@ -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({ ) : ( team.members.map((member) => ( -
+
+
{member.summonerName}
- + + {positionLabel[member.assignedPosition]} + {member.cost} @@ -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({
{player.summonerName} @@ -365,8 +474,8 @@ function PlayerSpotlight({ #{player.tag}
-
- {formatTierLabel(player.tier)} +
+
@@ -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('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} /> ))}
@@ -877,7 +989,10 @@ export default function AuctionPage() { ) : ( <> - + {auctionState.phase === 'sold' && auctionState.currentBidder && (
['data']; }) { + const location = useLocation(); + const historyBackTo = `${location.pathname}${location.search}${location.hash}`; + return (
@@ -224,6 +227,7 @@ function LeaderboardTable({ diff --git a/apps/web/src/pages/InternalMatchDetailPage.tsx b/apps/web/src/pages/InternalMatchDetailPage.tsx index 562770f6..7797796b 100644 --- a/apps/web/src/pages/InternalMatchDetailPage.tsx +++ b/apps/web/src/pages/InternalMatchDetailPage.tsx @@ -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['data']; }) { + const location = useLocation(); + const historyBackTo = `${location.pathname}${location.search}${location.hash}`; + return (
@@ -139,6 +142,7 @@ function GamePanel({ {participant.userId ? ( {participant.summonerName} diff --git a/apps/web/src/pages/MatchDetailPage.tsx b/apps/web/src/pages/MatchDetailPage.tsx index 5a9bf411..3937377d 100644 --- a/apps/web/src/pages/MatchDetailPage.tsx +++ b/apps/web/src/pages/MatchDetailPage.tsx @@ -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 }) { @@ -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 ( @@ -257,6 +262,7 @@ function ParticipantRow({
@@ -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 ? "신청 중..." : "참가 신청"}
@@ -378,13 +384,17 @@ function TeamCard({ const tone = teamIndexColorClasses(team.teamIndex); return ( -
+
- + {team.name} {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 }) {
- {expired ? '코드 만료' : slot.code} + {expired ? "코드 만료" : slot.code} {slot.code && !expired && ( )}
{used - ? '사용됨' + ? "사용됨" : expired - ? '운영자에게 새 코드를 요청해주세요.' + ? "운영자에게 새 코드를 요청해주세요." : `만료: ${formatTournamentCodeExpiry(slot.expiresAt)}`}
@@ -520,7 +530,8 @@ function TournamentCodeList({ slots }: { slots: TournamentCodeSlotView[] }) { {slot.gameNumber}경기 {(slot.teamAIndex > 1 || slot.teamBIndex > 2) && ( - {teamIndexLabel(slot.teamAIndex)} vs {teamIndexLabel(slot.teamBIndex)} + {teamIndexLabel(slot.teamAIndex)} vs{" "} + {teamIndexLabel(slot.teamBIndex)} )} @@ -545,9 +556,9 @@ function PoolStatsHint({ enabled }: { enabled: boolean }) { return (
-
+
풀 잔여 {available}개 - {expiringSoon > 0 ? ` · 만료 임박 ${expiringSoon}개` : ''} + {expiringSoon > 0 ? ` · 만료 임박 ${expiringSoon}개` : ""}
0 ? 'Perfect' : '-'; + return standing.kills + standing.assists > 0 ? "Perfect" : "-"; } return formatRecordRate(standing.kdaScore); } @@ -760,7 +771,7 @@ function RoundRobinStandingsTable({ match }: { match: MatchDetailView }) { return (
@@ -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 (
@@ -839,7 +850,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) { {primarySeries && (
{primarySeries.teamAWins} @@ -852,7 +863,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) { VS
{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" >
- {resolveMatchTeamName(match, series.teamAIndex)} vs{' '} + {resolveMatchTeamName(match, series.teamAIndex)} vs{" "} {resolveMatchTeamName(match, series.teamBIndex)}
@@ -927,7 +938,7 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) { 대기 중 )} - {game ? formatGameDuration(game.gameDuration) : '-'} + {game ? formatGameDuration(game.gameDuration) : "-"}
); @@ -954,30 +965,33 @@ export default function MatchDetailPage() { Record >({}); const [topTierThreshold, setTopTierThreshold] = - useState('NONE'); - const [manualTopTierUserIds, setManualTopTierUserIds] = useState([]); - const pollTournamentResultMutation = usePollTournamentResult( - DEFAULT_COMMUNITY_ID, + useState("NONE"); + const [manualTopTierUserIds, setManualTopTierUserIds] = useState( + [], ); + 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 (
- 매치 정보를 불러오는 중... + + 매치 정보를 불러오는 중... +
); } @@ -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}
-

{match.description}

+

+ {match.description} +

- {match.date} {match.time} + + {match.date} {match.time} + | {match.participants.length}/{match.maxParticipants}명 @@ -1219,7 +1241,7 @@ export default function MatchDetailPage() {
- {match.status === 'recruiting' ? ( + {match.status === "recruiting" ? ( <>

- 참가 신청 순서 기준 5명당 1개 팀이 만들어지고, 각 팀의 팀장을 지정합니다. + 참가 신청 순서 기준 5명당 1개 팀이 만들어지고, 각 팀의 + 팀장을 지정합니다.

{waitingParticipantCount > 0 && (

- {waitingParticipantCount}명은 10명 단위에 맞지 않아 이번 경매에서 제외됩니다. + {waitingParticipantCount}명은 10명 단위에 맞지 않아 이번 + 경매에서 제외됩니다.

)}
{showAuctionLink ? ( - + 경매 페이지 열기 ) : ( @@ -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 ( - {topTierThreshold === 'MANUAL' && ( + {topTierThreshold === "MANUAL" && (
우선 등장 선수
{manualPriorityCandidates.map((participant) => { - const checked = selectedManualTopTierUserIds.includes( - participant.userId, - ); + const checked = + selectedManualTopTierUserIds.includes( + participant.userId, + ); return (
@@ -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 && (
- + 경매 페이지 열기
@@ -1463,7 +1513,10 @@ export default function MatchDetailPage() {
    {match.schedule.map((item, index) => ( -
  • +
  • {item.time} @@ -1474,7 +1527,8 @@ export default function MatchDetailPage() { )} - {(match.status === 'team-built' || match.status === 'in-progress') && ( + {(match.status === "team-built" || + match.status === "in-progress") && ( @@ -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") && (

    Riot match-v5에서 토너먼트 코드가 붙은 경기를 다시 찾습니다. @@ -1494,8 +1549,8 @@ export default function MatchDetailPage() { onClick={handlePollTournamentResult} > {pollTournamentResultMutation.isPending - ? '등록 중...' - : '결과 다시 수집'} + ? "등록 중..." + : "결과 다시 수집"} )} diff --git a/apps/web/src/pages/MatchTeamProgressPage.tsx b/apps/web/src/pages/MatchTeamProgressPage.tsx index fd1d176f..8e122332 100644 --- a/apps/web/src/pages/MatchTeamProgressPage.tsx +++ b/apps/web/src/pages/MatchTeamProgressPage.tsx @@ -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 ( {content} diff --git a/apps/web/src/pages/UserHistoryPage.tsx b/apps/web/src/pages/UserHistoryPage.tsx index af740b9c..58f8a033 100644 --- a/apps/web/src/pages/UserHistoryPage.tsx +++ b/apps/web/src/pages/UserHistoryPage.tsx @@ -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 = { games: "게임 수", winRate: "승률", @@ -60,6 +64,19 @@ const TIER_NAMES: Record = { 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("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 (

    - ← 목록으로 + ← 이전으로