@@ -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 (
- ← 목록으로
+ ← 이전으로
| | |