feat: connect tournament views to APIs and recover archived stats
Remove development previews and complete hall of fame, match history, official results, and multi-kill API integration. Fix active match pagination and team-ready controls, preserve basic scoreboards, and recover statistics when Riot archives arrive. Use bounded in-process cache invalidation retries and add the Riot match lookup index migration with regression coverage.
This commit is contained in:
1 parent
20e1e6ec04
commit
0d7617e2d2
70 files changed
+3739
-1793
No files matched your search
+1
-27
@@ -8,7 +8,7 @@ import {
|
||||
useLocation,
|
||||
useNavigate,
|
||||
} from "react-router";
|
||||
import { lazy, Suspense, useState, type FormEvent, type ReactNode } from "react";
|
||||
import { useState, type FormEvent, type ReactNode } from "react";
|
||||
import { useMsal } from "@azure/msal-react";
|
||||
import { LogOut, Moon, Search, Sun } from "lucide-react";
|
||||
import DevAuthSwitcher from "./components/DevAuthSwitcher";
|
||||
@@ -31,12 +31,6 @@ import MatchAdminPage from "./pages/admin/MatchAdminPage";
|
||||
import TournamentCodesPage from "./pages/admin/TournamentCodesPage";
|
||||
import { PlainPage, Tooltip, pageWidthClass } from "./ui";
|
||||
|
||||
const InternalStatsPreview = import.meta.env.DEV
|
||||
? lazy(() => import("./preview/InternalStatsPreview"))
|
||||
: null;
|
||||
const MatchFlowsPreview = import.meta.env.DEV
|
||||
? lazy(() => import("./preview/MatchFlowsPreview"))
|
||||
: null;
|
||||
|
||||
const NAV_ICON_BUTTON_CLASS =
|
||||
"grid size-10 shrink-0 place-items-center rounded-field text-content-muted transition-colors hover:bg-sunken-strong hover:text-content md:size-11";
|
||||
@@ -367,26 +361,6 @@ function App() {
|
||||
path="/communities/:cid/internal-stats"
|
||||
element={<CommunityInternalStatsPage />}
|
||||
/>
|
||||
{InternalStatsPreview && (
|
||||
<Route
|
||||
path="/preview/internal-stats"
|
||||
element={
|
||||
<Suspense fallback={<PlainPage>전적 목업을 불러오는 중</PlainPage>}>
|
||||
<InternalStatsPreview />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{MatchFlowsPreview && (
|
||||
<Route
|
||||
path="/preview/match-flows"
|
||||
element={
|
||||
<Suspense fallback={<PlainPage>내전 목업을 불러오는 중</PlainPage>}>
|
||||
<MatchFlowsPreview />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<Route
|
||||
path="/communities/:cid/internal-stats/match/:matchId"
|
||||
element={<InternalMatchDetailPage />}
|
||||
|
||||
@@ -5,9 +5,11 @@ import type {
|
||||
CompetitionCommandResponse,
|
||||
CompetitionDetailResponse,
|
||||
CreateSeriesAdjudicationRequest,
|
||||
HallOfFameResponse,
|
||||
MatchDetailResponse,
|
||||
MatchEventType,
|
||||
MatchLifecycleStatus,
|
||||
MatchListView,
|
||||
MatchListResponse,
|
||||
ReverseSeriesResultRequest,
|
||||
SeriesId,
|
||||
@@ -33,6 +35,7 @@ import type {
|
||||
ApiCommunity,
|
||||
ApiCommunityUserSearchCandidate,
|
||||
ApiEnqueueRefreshResult,
|
||||
ApiHistorySeason,
|
||||
ApiInternalMatchDetailResponse,
|
||||
ApiInternalMatchListResponse,
|
||||
ApiLeaderboardResponse,
|
||||
@@ -72,6 +75,8 @@ interface MatchesQueryOptions {
|
||||
scheduledFrom?: string;
|
||||
scheduledTo?: string;
|
||||
sort?: 'asc' | 'desc';
|
||||
view?: MatchListView;
|
||||
asOf?: string;
|
||||
}
|
||||
|
||||
interface MatchesPageQueryOptions extends MatchesQueryOptions {
|
||||
@@ -91,6 +96,9 @@ export interface CommunityInternalStatsFilters {
|
||||
to?: string;
|
||||
championId?: number;
|
||||
limit?: number;
|
||||
query?: string;
|
||||
format?: 'pair' | 'tournament';
|
||||
playerId?: string;
|
||||
}
|
||||
|
||||
function createMatchesPath(
|
||||
@@ -108,6 +116,8 @@ function createMatchesPath(
|
||||
if (options.scheduledTo) searchParams.set('scheduledTo', options.scheduledTo);
|
||||
if (options.sort) searchParams.set('sort', options.sort);
|
||||
if (options.includeResults) searchParams.set('includeResults', 'true');
|
||||
if (options.view) searchParams.set('view', options.view);
|
||||
if (options.asOf) searchParams.set('asOf', options.asOf);
|
||||
|
||||
const queryString = searchParams.toString();
|
||||
return `/communities/${communityId}/matches${queryString ? `?${queryString}` : ''}`;
|
||||
@@ -161,6 +171,17 @@ export function useCommunity(communityId = DEFAULT_COMMUNITY_ID) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useHallOfFame(communityId = DEFAULT_COMMUNITY_ID) {
|
||||
return useQuery({
|
||||
queryKey: ['hall-of-fame', communityId],
|
||||
queryFn: () => apiFetch<HallOfFameResponse>(
|
||||
`/communities/${communityId}/matches/hall-of-fame`,
|
||||
{ auth: 'none' },
|
||||
),
|
||||
enabled: Boolean(communityId),
|
||||
});
|
||||
}
|
||||
|
||||
export function useMatches(
|
||||
options: MatchesQueryOptions,
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
@@ -180,6 +201,8 @@ export function useMatches(
|
||||
options.scheduledTo ?? null,
|
||||
options.sort ?? null,
|
||||
options.eventType ?? null,
|
||||
options.view ?? null,
|
||||
options.asOf ?? null,
|
||||
],
|
||||
queryFn: async () => {
|
||||
const response = await authScope.fetch<MatchListResponse>(
|
||||
@@ -211,6 +234,8 @@ export function useMatchesPage(
|
||||
options.sort ?? null,
|
||||
options.includeResults ?? false,
|
||||
options.eventType ?? null,
|
||||
options.view ?? null,
|
||||
options.asOf ?? null,
|
||||
],
|
||||
queryFn: () =>
|
||||
authScope.fetch<MatchListResponse>(
|
||||
@@ -676,6 +701,9 @@ function createCommunityInternalStatsPath(
|
||||
if (filters.championId)
|
||||
searchParams.set('championId', String(filters.championId));
|
||||
if (filters.limit) searchParams.set('limit', String(filters.limit));
|
||||
if (filters.query) searchParams.set('q', filters.query);
|
||||
if (filters.format) searchParams.set('format', filters.format);
|
||||
if (filters.playerId) searchParams.set('playerId', filters.playerId);
|
||||
for (const [key, value] of Object.entries(extra)) {
|
||||
if (value !== null && value !== undefined && value !== '') {
|
||||
searchParams.set(key, String(value));
|
||||
@@ -700,16 +728,22 @@ export function useCommunityInternalStatsMatches(
|
||||
filters.to ?? null,
|
||||
filters.championId ?? null,
|
||||
filters.limit ?? null,
|
||||
filters.query ?? null,
|
||||
filters.format ?? null,
|
||||
filters.playerId ?? null,
|
||||
],
|
||||
queryFn: ({ pageParam }) =>
|
||||
apiFetch<ApiInternalMatchListResponse>(
|
||||
createCommunityInternalStatsPath(communityId, 'matches', filters, {
|
||||
cursor: pageParam,
|
||||
cursor: pageParam?.cursor,
|
||||
cursorMatchId: pageParam?.matchId,
|
||||
}),
|
||||
{ auth: 'none' },
|
||||
),
|
||||
initialPageParam: null as number | null,
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor,
|
||||
initialPageParam: null as { cursor: number; matchId?: string } | null,
|
||||
getNextPageParam: (lastPage) => lastPage.nextCursor === null
|
||||
? null
|
||||
: { cursor: lastPage.nextCursor, matchId: lastPage.nextCursorMatchId },
|
||||
enabled: Boolean(communityId && enabled),
|
||||
});
|
||||
}
|
||||
@@ -727,6 +761,7 @@ export function useCommunityLeaderboard(
|
||||
filters.from ?? null,
|
||||
filters.to ?? null,
|
||||
filters.championId ?? null,
|
||||
filters.query ?? null,
|
||||
],
|
||||
queryFn: () =>
|
||||
apiFetch<ApiLeaderboardResponse>(
|
||||
@@ -739,6 +774,17 @@ export function useCommunityLeaderboard(
|
||||
});
|
||||
}
|
||||
|
||||
export function useCommunityStatsSeasons(communityId = DEFAULT_COMMUNITY_ID) {
|
||||
return useQuery({
|
||||
queryKey: ['community-stats-seasons', communityId],
|
||||
queryFn: () => apiFetch<{ seasons: ApiHistorySeason[] }>(
|
||||
`/communities/${communityId}/internal-stats/seasons`,
|
||||
{ auth: 'none' },
|
||||
),
|
||||
enabled: Boolean(communityId),
|
||||
});
|
||||
}
|
||||
|
||||
export function useTeamInsights(
|
||||
filters: CommunityInternalStatsFilters,
|
||||
communityId = DEFAULT_COMMUNITY_ID,
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
import type {
|
||||
GrandFinalGameCount,
|
||||
GameAnalysisAvailability,
|
||||
GameId,
|
||||
GameSlotId,
|
||||
InternalMatchCompetition,
|
||||
InternalMatchResultPresentation,
|
||||
SeriesId,
|
||||
MatchEventType,
|
||||
RecentMatchParticipantRank,
|
||||
MatchGameMode,
|
||||
MatchPosition,
|
||||
MatchPositionPreferenceView,
|
||||
@@ -530,6 +537,7 @@ export interface ApiRecentMatchTeamParticipant {
|
||||
championId: number;
|
||||
championLevel: number;
|
||||
teamPosition: string;
|
||||
tier?: RecentMatchParticipantRank;
|
||||
kills: number;
|
||||
deaths: number;
|
||||
assists: number;
|
||||
@@ -588,7 +596,7 @@ export interface ApiRecentMatchView {
|
||||
summonerSpells: [number, number];
|
||||
perks: ApiRunePerks;
|
||||
teams: ApiRecentMatchTeam[];
|
||||
/** 최대 연속 처치 수. API가 아직 내려주지 않아 화면은 없을 때를 견딘다. */
|
||||
/** 경기에서 기록한 최대 연속 처치 수. */
|
||||
largestMultiKill?: number;
|
||||
}
|
||||
|
||||
@@ -606,6 +614,7 @@ export interface ApiInternalMatchCard {
|
||||
status: 'finished' | 'in-progress';
|
||||
gameCount: number;
|
||||
winnerTeamIndex?: number;
|
||||
resultPresentation?: InternalMatchResultPresentation;
|
||||
seriesResults: Array<{
|
||||
teamAIndex: number;
|
||||
teamBIndex: number;
|
||||
@@ -636,6 +645,7 @@ export interface ApiInternalMatchCard {
|
||||
export interface ApiInternalMatchListResponse {
|
||||
matches: ApiInternalMatchCard[];
|
||||
nextCursor: number | null;
|
||||
nextCursorMatchId?: string;
|
||||
season: ApiHistorySeason;
|
||||
}
|
||||
|
||||
@@ -663,6 +673,7 @@ export interface ApiLeaderboardRow {
|
||||
export interface ApiLeaderboardResponse {
|
||||
rows: ApiLeaderboardRow[];
|
||||
season: ApiHistorySeason;
|
||||
matchedUserIds?: string[];
|
||||
}
|
||||
|
||||
export interface ApiLeaderHighlight {
|
||||
@@ -681,6 +692,7 @@ export interface ApiTeamInsightsResponse {
|
||||
red: number;
|
||||
bluePicks: number;
|
||||
redPicks: number;
|
||||
confirmed?: { sampleSize: number; blue: number; red: number };
|
||||
};
|
||||
topKda: ApiLeaderHighlight | null;
|
||||
mostKills: ApiLeaderHighlight | null;
|
||||
@@ -692,8 +704,14 @@ export interface ApiTeamInsightsResponse {
|
||||
|
||||
export interface ApiInternalMatchDetailResponse {
|
||||
match: ApiInternalMatchCard;
|
||||
competition?: InternalMatchCompetition;
|
||||
games: Array<{
|
||||
gameNumber: number;
|
||||
gameId?: GameId;
|
||||
analysisAvailability?: GameAnalysisAvailability;
|
||||
gameSlotId?: GameSlotId;
|
||||
seriesId?: SeriesId;
|
||||
ordinal?: number;
|
||||
riotMatchId: string;
|
||||
gameCreation: number;
|
||||
gameDuration: number;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { InteractionStatus } from '@azure/msal-browser';
|
||||
import { useMsal } from '@azure/msal-react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { io, type Socket } from 'socket.io-client';
|
||||
import { API_BASE_URL, useAuthUserId } from '../config';
|
||||
import { acquireAccessToken } from '../lib/auth/token-provider';
|
||||
import { isMsalConfigured } from '../lib/auth/msal.config';
|
||||
import type { ApiAuction, ApiAuctionChatMessage, Position } from './types';
|
||||
import {
|
||||
createAuctionResyncRequester,
|
||||
@@ -140,8 +143,14 @@ function mergeChatMessages(
|
||||
|
||||
export function useAuctionSocket(matchId: string | undefined) {
|
||||
const authUserId = useAuthUserId();
|
||||
const connectionKey = matchId
|
||||
? JSON.stringify([matchId, authUserId ?? null])
|
||||
const { accounts, inProgress, instance } = useMsal();
|
||||
const accountId = isMsalConfigured
|
||||
? (instance.getActiveAccount() ?? accounts[0])?.homeAccountId
|
||||
: undefined;
|
||||
const waitingForLogin = isMsalConfigured && !authUserId &&
|
||||
(inProgress === InteractionStatus.Startup || inProgress === InteractionStatus.HandleRedirect);
|
||||
const connectionKey = matchId && !waitingForLogin
|
||||
? JSON.stringify([matchId, authUserId ?? null, accountId ?? null])
|
||||
: null;
|
||||
const socketRef = useRef<Socket | null>(null);
|
||||
const resyncRequesterRef = useRef<ReturnType<
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
import { Link, useLocation } from "react-router";
|
||||
import type { ApiInternalMatchDetailResponse, DdragonManifest } from "../api/types";
|
||||
import { championDisplayName, championIconUrl } from "../lib/ddragon";
|
||||
import { teamIndexLabel } from "../lib/league";
|
||||
import { EmptyNote } from "../ui";
|
||||
|
||||
export function GameAnalysisNotice() {
|
||||
return (
|
||||
<EmptyNote
|
||||
size="sm"
|
||||
title="Riot 원본이 없는 경기 기록"
|
||||
description="저장된 경기 결과와 선수별 KDA를 볼 수 있습니다."
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function BasicGameScoreboard({
|
||||
game,
|
||||
teams,
|
||||
manifest,
|
||||
}: {
|
||||
game: ApiInternalMatchDetailResponse["games"][number];
|
||||
teams: ApiInternalMatchDetailResponse["match"]["teams"];
|
||||
manifest: DdragonManifest | null | undefined;
|
||||
}) {
|
||||
const location = useLocation();
|
||||
const backTo = `${location.pathname}${location.search}${location.hash}`;
|
||||
|
||||
return (
|
||||
<div className="space-y-3 p-4">
|
||||
{game.analysisAvailability && game.analysisAvailability !== "available" && (
|
||||
<GameAnalysisNotice />
|
||||
)}
|
||||
{game.teams.map((team) => (
|
||||
<section key={team.side} className="overflow-hidden rounded-lg border border-line bg-card">
|
||||
<h4 className="border-b border-line px-3 py-2 text-sm font-semibold">
|
||||
{teamIndexLabel(team.teamIndex, teams.find(({ teamIndex }) => teamIndex === team.teamIndex)?.name)}
|
||||
{" · "}{team.side === "blue" ? "블루" : "레드"}{" · "}{team.win ? "승리" : "패배"}
|
||||
</h4>
|
||||
{team.participants.length > 0 ? (
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="text-xs text-content-muted">
|
||||
<tr>
|
||||
<th scope="col" className="px-3 py-2">선수</th>
|
||||
<th scope="col" className="px-3 py-2">챔피언</th>
|
||||
<th scope="col" className="px-3 py-2 text-right">K/D/A</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-line">
|
||||
{team.participants.map((participant) => {
|
||||
const icon = championIconUrl(manifest, participant.championId);
|
||||
const champion = championDisplayName(manifest, participant.championId);
|
||||
return (
|
||||
<tr key={`${participant.userId}-${participant.championId}`}>
|
||||
<td className="px-3 py-2">
|
||||
{participant.userId ? (
|
||||
<Link
|
||||
to={`/users/${participant.userId}/history?queueGroup=internal`}
|
||||
state={{ backTo }}
|
||||
className="font-semibold hover:underline"
|
||||
>
|
||||
{participant.summonerName}
|
||||
</Link>
|
||||
) : participant.summonerName}
|
||||
</td>
|
||||
<td className="px-3 py-2">
|
||||
<span className="flex items-center gap-2">
|
||||
{icon && <img src={icon} alt="" className="size-6 rounded" />}
|
||||
{champion ?? "챔피언 미확인"}
|
||||
</span>
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-2 text-right tabular">
|
||||
{participant.kills}/{participant.deaths}/{participant.assists}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
<p className="px-3 py-2 text-sm text-content-muted">저장된 선수 기록이 없습니다.</p>
|
||||
)}
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { MatchPosition } from '@lolympus/contracts';
|
||||
import type { HallOfFameResponse, MatchPosition } from '@lolympus/contracts';
|
||||
import { ChevronRight, UserRound } from 'lucide-react';
|
||||
import { useEffect, useRef, useState, type CSSProperties } from 'react';
|
||||
import { Link } from 'react-router';
|
||||
import { useDdragonManifest } from '../api/hooks';
|
||||
import { useDdragonManifest, useHallOfFame } from '../api/hooks';
|
||||
import captainCrown from '../assets/captain-crown.svg';
|
||||
import pixelTrophy from '../assets/pixel-trophy.svg';
|
||||
import { profileIconUrl } from '../lib/ddragon';
|
||||
@@ -10,61 +10,14 @@ import { positionLabel } from '../lib/league';
|
||||
import { pageWidthClass } from '../ui/layout';
|
||||
import './HomeHallOfFame.css';
|
||||
|
||||
// The roster featured on the home page is curated independently of match results.
|
||||
const FEATURED_TEAM = {
|
||||
name: '똥칼라파워',
|
||||
captainUserId: '69f090029bf765ff8e54faae',
|
||||
members: [
|
||||
{
|
||||
userId: '6a36268cf3a6fd12921ca016',
|
||||
position: 'TOP',
|
||||
gameName: 'ALLM',
|
||||
tagLine: 'ALL',
|
||||
profileIconId: 6091,
|
||||
},
|
||||
{
|
||||
userId: '69f090029bf765ff8e54faae',
|
||||
position: 'JGL',
|
||||
gameName: 'OPIS',
|
||||
tagLine: '2283',
|
||||
profileIconId: 7146,
|
||||
},
|
||||
{
|
||||
userId: '69f090039bf765ff8e54facf',
|
||||
position: 'MID',
|
||||
gameName: '우 킨',
|
||||
tagLine: '안우킨',
|
||||
profileIconId: 6622,
|
||||
},
|
||||
{
|
||||
userId: '6a37c488f3a6fd12921cf2b4',
|
||||
position: 'ADC',
|
||||
gameName: '말 안해도 알잖아',
|
||||
tagLine: 'Ф x Ф',
|
||||
profileIconId: 6379,
|
||||
},
|
||||
{
|
||||
userId: '69f090069bf765ff8e54fb5a',
|
||||
position: 'SUP',
|
||||
gameName: '툭치면 크르릉',
|
||||
tagLine: 'KR1',
|
||||
profileIconId: 4020,
|
||||
},
|
||||
] satisfies Array<{
|
||||
userId: string;
|
||||
position: MatchPosition;
|
||||
gameName: string;
|
||||
tagLine: string;
|
||||
profileIconId: number;
|
||||
}>,
|
||||
};
|
||||
const POSITION_ORDER: MatchPosition[] = ['TOP', 'JGL', 'MID', 'ADC', 'SUP'];
|
||||
|
||||
export default function HomeHallOfFame({
|
||||
introReady,
|
||||
}: {
|
||||
introReady: boolean;
|
||||
}) {
|
||||
const { data: manifest } = useDdragonManifest();
|
||||
const hallOfFame = useHallOfFame();
|
||||
const sectionRef = useRef<HTMLElement>(null);
|
||||
const [playIntro, setPlayIntro] = useState(false);
|
||||
|
||||
@@ -89,95 +42,131 @@ export default function HomeHallOfFame({
|
||||
return () => observer.disconnect();
|
||||
}, [introReady]);
|
||||
|
||||
const featuredMatch = hallOfFame.data?.match;
|
||||
|
||||
return (
|
||||
// The second grid column is left empty on purpose: it reserves room for a
|
||||
// small companion card beside the hall of fame.
|
||||
<section
|
||||
ref={sectionRef}
|
||||
aria-labelledby="home-hall-of-fame"
|
||||
aria-label="명예의 전당"
|
||||
className={`${pageWidthClass()} lts-hall grid gap-8 py-6 md:py-8 lg:grid-cols-[minmax(0,1fr)_20rem]`}
|
||||
data-intro={playIntro ? '' : undefined}
|
||||
>
|
||||
<div className="lts-hall-card flex min-w-0 flex-col gap-4 bg-card p-5 sm:flex-row sm:gap-5">
|
||||
<h2 className="min-w-0 sm:w-36 sm:shrink-0">
|
||||
<span
|
||||
id="home-hall-of-fame"
|
||||
className="block text-sm font-semibold text-content-muted"
|
||||
>
|
||||
명예의 전당
|
||||
</span>
|
||||
<span className="mt-2 block text-2xl leading-tight font-extrabold tracking-tight [overflow-wrap:anywhere]">
|
||||
{FEATURED_TEAM.name}
|
||||
</span>
|
||||
<span className="mt-1 flex items-center gap-1 text-xs font-semibold text-content-muted">
|
||||
<img src={pixelTrophy} alt="" className="lts-hall-pixel size-4" />
|
||||
직전 멸망전 우승
|
||||
</span>
|
||||
</h2>
|
||||
<div className="h-px bg-line sm:h-auto sm:w-px" aria-hidden="true" />
|
||||
<ul
|
||||
className="grid min-w-0 flex-1 gap-1 sm:grid-cols-5 sm:content-center sm:items-start"
|
||||
aria-label="우승팀 선수"
|
||||
>
|
||||
{FEATURED_TEAM.members.map(
|
||||
({ userId, position, gameName, tagLine, profileIconId }, index) => {
|
||||
const icon = profileIconUrl(manifest, profileIconId);
|
||||
const isCaptain = userId === FEATURED_TEAM.captainUserId;
|
||||
|
||||
return (
|
||||
<li key={userId} className="min-w-0">
|
||||
<Link
|
||||
to={`/users/${userId}/history?queueGroup=internal`}
|
||||
className="lts-hall-player group flex h-full items-center gap-2.5 px-2 py-2 transition-colors hover:bg-sunken focus-visible:-outline-offset-2 sm:flex-col sm:gap-2 sm:py-3 sm:text-center"
|
||||
>
|
||||
<span className="relative shrink-0">
|
||||
{isCaptain && (
|
||||
<img
|
||||
src={captainCrown}
|
||||
alt="팀장"
|
||||
className="lts-hall-crown lts-hall-pixel absolute -top-2.5 -right-2.5 z-10 w-6"
|
||||
/>
|
||||
)}
|
||||
<span
|
||||
className="lts-hall-portrait relative grid size-10 place-items-center overflow-hidden bg-sunken-strong text-content-muted sm:size-13"
|
||||
style={{ '--lts-hall-order': index } as CSSProperties}
|
||||
>
|
||||
<UserRound className="size-5" aria-hidden="true" />
|
||||
<img
|
||||
key={icon}
|
||||
src={icon}
|
||||
alt=""
|
||||
className="absolute inset-0 size-full object-cover"
|
||||
onError={(event) => {
|
||||
event.currentTarget.hidden = true;
|
||||
}}
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
<span className="min-w-0 flex-1 sm:w-full sm:flex-none">
|
||||
<span className="block text-xs font-semibold text-content-muted">
|
||||
{positionLabel[position]}
|
||||
</span>
|
||||
<span className="flex flex-wrap items-baseline gap-x-1.5 sm:flex-col sm:items-center">
|
||||
<span className="text-sm font-bold [overflow-wrap:anywhere] group-hover:underline">
|
||||
{gameName}
|
||||
</span>
|
||||
<span className="text-xs text-content-muted [overflow-wrap:anywhere]">
|
||||
#{tagLine}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<ChevronRight
|
||||
className="size-4 shrink-0 text-content-muted sm:hidden"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
{hallOfFame.isPending ? (
|
||||
<p role="status">명예의 전당을 불러오는 중</p>
|
||||
) : hallOfFame.isError ? (
|
||||
<p role="status">
|
||||
명예의 전당을 불러오지 못했습니다.{' '}
|
||||
<button type="button" className="underline" onClick={() => void hallOfFame.refetch()}>
|
||||
다시 시도
|
||||
</button>
|
||||
</p>
|
||||
) : featuredMatch && hallOfFame.data.teams.length > 0 ? (
|
||||
<div className="space-y-3">
|
||||
{hallOfFame.data.teams.map((team, index) => (
|
||||
<FeaturedTeam key={index} team={team} match={featuredMatch} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-sm text-content-muted">확정된 멸망전 우승팀이 없습니다.</p>
|
||||
)}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function FeaturedTeam({
|
||||
team,
|
||||
match,
|
||||
}: {
|
||||
team: HallOfFameResponse['teams'][number];
|
||||
match: NonNullable<HallOfFameResponse['match']>;
|
||||
}) {
|
||||
const { data: manifest } = useDdragonManifest();
|
||||
const members = [...team.members].sort(
|
||||
(left, right) =>
|
||||
(left.position ? POSITION_ORDER.indexOf(left.position) : POSITION_ORDER.length) -
|
||||
(right.position ? POSITION_ORDER.indexOf(right.position) : POSITION_ORDER.length),
|
||||
);
|
||||
return (
|
||||
<div className="lts-hall-card flex min-w-0 flex-col gap-4 bg-card p-5 sm:flex-row sm:gap-5">
|
||||
<h2 className="min-w-0 sm:w-36 sm:shrink-0">
|
||||
<span
|
||||
className="block text-sm font-semibold text-content-muted"
|
||||
>
|
||||
명예의 전당
|
||||
</span>
|
||||
<span className="mt-2 block text-2xl leading-tight font-extrabold tracking-tight [overflow-wrap:anywhere]">
|
||||
{team.name}
|
||||
</span>
|
||||
<span className="mt-1 flex items-center gap-1 text-xs font-semibold text-content-muted">
|
||||
<img src={pixelTrophy} alt="" className="lts-hall-pixel size-4" />
|
||||
<Link to={`/match/${match.id}`} title={match.title} className="hover:underline">직전 멸망전 우승</Link>
|
||||
</span>
|
||||
</h2>
|
||||
<div className="h-px bg-line sm:h-auto sm:w-px" aria-hidden="true" />
|
||||
<ul
|
||||
className="grid min-w-0 flex-1 gap-1 sm:grid-cols-5 sm:content-center sm:items-start"
|
||||
aria-label="우승팀 선수"
|
||||
>
|
||||
{members.map(
|
||||
({ userId, position, gameName, tagLine, profileIconId }, index) => {
|
||||
const icon = profileIconId === undefined ? undefined : profileIconUrl(manifest, profileIconId);
|
||||
const isCaptain = userId === team.captainUserId;
|
||||
|
||||
return (
|
||||
<li key={userId} className="min-w-0">
|
||||
<Link
|
||||
to={`/users/${userId}/history?queueGroup=internal`}
|
||||
className="lts-hall-player group flex h-full items-center gap-2.5 px-2 py-2 transition-colors hover:bg-sunken focus-visible:-outline-offset-2 sm:flex-col sm:gap-2 sm:py-3 sm:text-center"
|
||||
>
|
||||
<span className="relative shrink-0">
|
||||
{isCaptain && (
|
||||
<img
|
||||
src={captainCrown}
|
||||
alt="팀장"
|
||||
className="lts-hall-crown lts-hall-pixel absolute -top-2.5 -right-2.5 z-10 w-6"
|
||||
/>
|
||||
)}
|
||||
<span
|
||||
className="lts-hall-portrait relative grid size-10 place-items-center overflow-hidden bg-sunken-strong text-content-muted sm:size-13"
|
||||
style={{ '--lts-hall-order': index } as CSSProperties}
|
||||
>
|
||||
<UserRound className="size-5" aria-hidden="true" />
|
||||
{icon && <img
|
||||
key={icon}
|
||||
src={icon}
|
||||
alt=""
|
||||
className="absolute inset-0 size-full object-cover"
|
||||
onError={(event) => {
|
||||
event.currentTarget.hidden = true;
|
||||
}}
|
||||
/>}
|
||||
</span>
|
||||
</span>
|
||||
<span className="min-w-0 flex-1 sm:w-full sm:flex-none">
|
||||
<span className="block text-xs font-semibold text-content-muted">
|
||||
{position ? positionLabel[position] : "포지션 미확인"}
|
||||
</span>
|
||||
<span className="flex flex-wrap items-baseline gap-x-1.5 sm:flex-col sm:items-center">
|
||||
<span className="text-sm font-bold [overflow-wrap:anywhere] group-hover:underline">
|
||||
{gameName ?? "선수 프로필"}
|
||||
</span>
|
||||
<span className="text-xs text-content-muted [overflow-wrap:anywhere]">
|
||||
{tagLine && `#${tagLine}`}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<ChevronRight
|
||||
className="size-4 shrink-0 text-content-muted sm:hidden"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Link>
|
||||
</li>
|
||||
);
|
||||
},
|
||||
)}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
type NormalizedLanePosition,
|
||||
} from "../lib/internal-game-matchups";
|
||||
import { ItemIcon, RuneIcon, RuneStyleIcon } from "./ItemTooltip";
|
||||
import { GameAnalysisNotice } from "./BasicGameScoreboard";
|
||||
|
||||
import { Tab, TabList } from "@astryxdesign/core/TabList";
|
||||
export type InternalGameDetailTab = "scoreboard" | "matchup" | "build";
|
||||
@@ -992,6 +993,9 @@ export function InternalGameAnalysisPanel({
|
||||
if (activeTab === "scoreboard") {
|
||||
return <>{scoreboard}</>;
|
||||
}
|
||||
if (selectedGame.analysisAvailability && selectedGame.analysisAvailability !== "available") {
|
||||
return <GameAnalysisNotice />;
|
||||
}
|
||||
|
||||
if (activeTab === "build") {
|
||||
return (
|
||||
|
||||
@@ -133,6 +133,15 @@ export function CompetitionAdminControls({
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["matches-page", communityId],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["community-internal-stats-matches", communityId],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["community-internal-stats-match", communityId, matchId],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["hall-of-fame", communityId],
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ export function TeamTournamentCodes({
|
||||
return (
|
||||
<div className="border-t border-base-content/10 px-4 py-5 sm:px-5">
|
||||
<p role="status" className="text-sm text-content-muted">
|
||||
이 경기에 배정된 토너먼트 코드가 없습니다.
|
||||
표시할 세트 정보가 아직 없습니다.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -36,10 +36,10 @@ export function formatRankBadge(tier: ApiTierInfo | undefined) {
|
||||
return rank ? `${tierInitial}${rank}` : tierInitial;
|
||||
}
|
||||
|
||||
export function formatRankDetail(tier: ApiTierInfo | undefined) {
|
||||
export function formatRankDetail(tier: Pick<ApiTierInfo, "tier"> & Partial<Pick<ApiTierInfo, "rank" | "leaguePoints">> | 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`;
|
||||
return tier.leaguePoints === undefined ? label : `${label} - ${tier.leaguePoints} LP`;
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
import { useSyncExternalStore } from 'react';
|
||||
|
||||
const AUTH_USER_ID_STORAGE_KEY = 'lolympus.authUserId';
|
||||
const DEV_CAPTAIN_TEAM_INDEX_STORAGE_KEY = 'lolympus.devCaptainTeamIndex';
|
||||
const LEGACY_DEV_CAPTAIN_SIDE_STORAGE_KEY = 'lolympus.devCaptainSide';
|
||||
const THEME_STORAGE_KEY = 'lolympus.theme';
|
||||
const AUTH_USER_CHANGED_EVENT = 'lolympus:auth-user-changed';
|
||||
const CAPTAIN_SIDE_CHANGED_EVENT = 'lolympus:captain-side-changed';
|
||||
const THEME_CHANGED_EVENT = 'lolympus:theme-changed';
|
||||
|
||||
export type AppTheme = 'light' | 'dark';
|
||||
@@ -58,32 +55,6 @@ export function setAuthUserId(userId: string | null) {
|
||||
dispatchWindowEvent(AUTH_USER_CHANGED_EVENT);
|
||||
}
|
||||
|
||||
export function getDevCaptainTeamIndex(): number | null {
|
||||
if (typeof window === 'undefined') return null;
|
||||
|
||||
const value = window.localStorage.getItem(DEV_CAPTAIN_TEAM_INDEX_STORAGE_KEY);
|
||||
const parsed = Number(value);
|
||||
if (Number.isInteger(parsed) && parsed > 0) return parsed;
|
||||
|
||||
const legacy = window.localStorage.getItem(LEGACY_DEV_CAPTAIN_SIDE_STORAGE_KEY);
|
||||
if (legacy === 'blue') return 1;
|
||||
if (legacy === 'red') return 2;
|
||||
return null;
|
||||
}
|
||||
|
||||
export function setDevCaptainTeamIndex(teamIndex: number | null) {
|
||||
if (typeof window === 'undefined') return;
|
||||
if (teamIndex && Number.isInteger(teamIndex) && teamIndex > 0) {
|
||||
window.localStorage.setItem(
|
||||
DEV_CAPTAIN_TEAM_INDEX_STORAGE_KEY,
|
||||
String(teamIndex),
|
||||
);
|
||||
} else {
|
||||
window.localStorage.removeItem(DEV_CAPTAIN_TEAM_INDEX_STORAGE_KEY);
|
||||
}
|
||||
dispatchWindowEvent(CAPTAIN_SIDE_CHANGED_EVENT);
|
||||
}
|
||||
|
||||
function normalizeTheme(value: string | null | undefined): AppTheme {
|
||||
return value === 'dark' ? 'dark' : 'light';
|
||||
}
|
||||
@@ -126,14 +97,6 @@ export function useAuthUserId(): string | null {
|
||||
);
|
||||
}
|
||||
|
||||
export function useDevCaptainTeamIndex(): number | null {
|
||||
return useSyncExternalStore<number | null>(
|
||||
(callback) => subscribeToWindowChanges(CAPTAIN_SIDE_CHANGED_EVENT, callback),
|
||||
getDevCaptainTeamIndex,
|
||||
() => null,
|
||||
);
|
||||
}
|
||||
|
||||
export function useTheme(): AppTheme {
|
||||
return useSyncExternalStore<AppTheme>(
|
||||
(callback) => subscribeToWindowChanges(THEME_CHANGED_EVENT, callback),
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { CompetitionGameView } from '@lolympus/contracts';
|
||||
|
||||
export function riotMatchIdForDisplay(
|
||||
game: { riotMatchId: string; gameId?: string },
|
||||
official?: CompetitionGameView,
|
||||
): string | null {
|
||||
if (official) {
|
||||
return official.evidence.type === 'riot'
|
||||
? official.evidence.riotMatchId
|
||||
: null;
|
||||
}
|
||||
// Unmigrated records have no official evidence. Only display real Riot IDs,
|
||||
// never synthetic legacy references stored in the same field.
|
||||
return !game.gameId && /^[A-Z0-9]+_\d+$/.test(game.riotMatchId)
|
||||
? game.riotMatchId
|
||||
: null;
|
||||
}
|
||||
@@ -1,8 +1,4 @@
|
||||
import type {
|
||||
CompetitionDetailResponse,
|
||||
CompetitionGameView,
|
||||
SeriesProjection,
|
||||
} from '@lolympus/contracts';
|
||||
import type { CompetitionGameView, SeriesProjection } from '@lolympus/contracts';
|
||||
import type { ApiInternalMatchDetailResponse } from '../api/types';
|
||||
import { bracketRoundAccessibleLabel } from '../components/competition/double-elimination-bracket-layout';
|
||||
import { teamIndexLabel } from './league';
|
||||
@@ -23,22 +19,17 @@ export interface RecordedSeries {
|
||||
|
||||
export function groupRecordedSets(
|
||||
detail: ApiInternalMatchDetailResponse,
|
||||
competition?: CompetitionDetailResponse,
|
||||
) {
|
||||
const projection = competition?.projection;
|
||||
const officialByMatchId = new Map<string, CompetitionGameView>();
|
||||
for (const game of projection?.games ?? []) {
|
||||
if (game.evidence.type === 'riot')
|
||||
officialByMatchId.set(game.evidence.riotMatchId, game);
|
||||
}
|
||||
const projection = detail.competition?.projection;
|
||||
const officialById = new Map(projection?.games.map((game) => [game.id, game]));
|
||||
const seriesById = new Map(
|
||||
projection?.series.map((series) => [series.seriesId, series]),
|
||||
);
|
||||
const groups = new Map<string, RecordedSeries>();
|
||||
|
||||
for (const game of detail.games) {
|
||||
const official = officialByMatchId.get(game.riotMatchId);
|
||||
const series = official && seriesById.get(official.seriesId);
|
||||
const official = game.gameId && officialById.get(game.gameId);
|
||||
const series = game.seriesId && seriesById.get(game.seriesId);
|
||||
const indexes = [
|
||||
...new Set(game.teams.map(({ teamIndex }) => teamIndex)),
|
||||
].sort((a, b) => a - b);
|
||||
@@ -48,11 +39,7 @@ export function groupRecordedSets(
|
||||
detail.match.teams.find((team) => team.teamIndex === index)?.name,
|
||||
),
|
||||
);
|
||||
const id =
|
||||
series?.seriesId ??
|
||||
(indexes.length === 2
|
||||
? `teams:${indexes.join('-')}`
|
||||
: `game:${game.gameNumber}`);
|
||||
const id = series?.seriesId ?? `game:${game.gameNumber}`;
|
||||
const matchup = names.join(' vs ') || `${game.gameNumber}세트`;
|
||||
const label =
|
||||
series && series.stage.type !== 'pair'
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
import type { ApiInternalMatchCard, ApiLeaderboardRow } from '../api/types';
|
||||
import type { InternalMatchResultPresentation } from '@lolympus/contracts';
|
||||
import type { ApiLeaderboardRow } from '../api/types';
|
||||
import {
|
||||
getSeriesHistoryResultLabel,
|
||||
shouldDisplaySeriesHistoryScore,
|
||||
} from '../components/competition/competition-series-history.ts';
|
||||
|
||||
export const LEADERBOARD_SORTS = [
|
||||
{ value: 'games', label: '경기 수' },
|
||||
@@ -71,46 +76,34 @@ export function getMainLane(byLane: ApiLeaderboardRow['byLane']) {
|
||||
return main?.lane;
|
||||
}
|
||||
|
||||
type MatchOutcomeSource = Pick<
|
||||
ApiInternalMatchCard,
|
||||
'winnerTeamIndex' | 'seriesResults' | 'teams'
|
||||
>;
|
||||
type MatchTeam = ApiInternalMatchCard['teams'][number];
|
||||
|
||||
export type InternalMatchOutcome =
|
||||
| {
|
||||
type: 'score';
|
||||
left: MatchTeam;
|
||||
right: MatchTeam;
|
||||
leftWins: number;
|
||||
rightWins: number;
|
||||
winner?: MatchTeam;
|
||||
}
|
||||
| { type: 'winner'; winner: MatchTeam };
|
||||
|
||||
/** 목록 행에서 바로 보여줄 결과. 두 팀 단일 시리즈는 스코어, 그 외는 우승팀. */
|
||||
export function getInternalMatchOutcome(
|
||||
match: MatchOutcomeSource,
|
||||
): InternalMatchOutcome | undefined {
|
||||
const team = (index: number | undefined) =>
|
||||
match.teams.find(({ teamIndex }) => teamIndex === index);
|
||||
const winner = team(match.winnerTeamIndex);
|
||||
|
||||
if (match.teams.length === 2 && match.seriesResults.length === 1) {
|
||||
const [series] = match.seriesResults;
|
||||
const left = team(series.teamAIndex);
|
||||
const right = team(series.teamBIndex);
|
||||
if (left && right) {
|
||||
return {
|
||||
type: 'score',
|
||||
left,
|
||||
right,
|
||||
leftWins: series.teamAWins,
|
||||
rightWins: series.teamBWins,
|
||||
winner: winner ?? team(series.winnerTeamIndex),
|
||||
};
|
||||
}
|
||||
export function formatOfficialMatchResult(
|
||||
result: InternalMatchResultPresentation | undefined,
|
||||
) {
|
||||
if (result?.type !== 'official') {
|
||||
return result?.type === 'legacy' ? '과거 기록' : '공식 결과 확인 불가';
|
||||
}
|
||||
const { phase, outcome, teams, singleSeries, completedSeriesCount } = result;
|
||||
const teamName = (id: string) =>
|
||||
teams.find(({ teamId }) => teamId === id)?.name ?? '팀 미확인';
|
||||
if (phase === 'cancelled') return '취소';
|
||||
if (phase !== 'completed' || !outcome) {
|
||||
return completedSeriesCount > 0 ? `시리즈 ${completedSeriesCount}개 확정` : '결과 확정 전';
|
||||
}
|
||||
|
||||
return winner ? { type: 'winner', winner } : undefined;
|
||||
switch (outcome.type) {
|
||||
case 'double-elimination':
|
||||
return `우승 · ${teamName(outcome.championTeamId)}`;
|
||||
case 'round-robin':
|
||||
return outcome.leaderTeamIds.length > 0
|
||||
? `${outcome.leaderTeamIds.length > 1 ? '공동 1위' : '우승'} · ${outcome.leaderTeamIds.map(teamName).join(', ')}`
|
||||
: '대회 종료';
|
||||
case 'paired-series': {
|
||||
if (!singleSeries) return '시리즈 종료';
|
||||
const series = singleSeries;
|
||||
if (!shouldDisplaySeriesHistoryScore(series))
|
||||
return getSeriesHistoryResultLabel(series) ?? '시리즈 종료';
|
||||
const [left, right] = series.entries;
|
||||
return `${teamName(left.teamId ?? '')} ${left.gameWins} : ${right.gameWins} ${teamName(right.teamId ?? '')}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,18 +11,6 @@ export function multiKillLabel(largestMultiKill: number | undefined) {
|
||||
return MULTI_KILL_LABELS[Math.min(5, Math.floor(largestMultiKill))];
|
||||
}
|
||||
|
||||
/**
|
||||
* 개발 화면 전용 목업. 최근 경기 응답에 `largestMultiKill`이 아직 없어서, 배지
|
||||
* 디자인을 확인할 수 있도록 킬 수로 값을 지어낸다. 실제 기록이 아니므로
|
||||
* 운영 빌드에서는 호출하지 않는다.
|
||||
*/
|
||||
export function mockLargestMultiKill(kills: number) {
|
||||
if (kills >= 15) return 4;
|
||||
if (kills >= 11) return 3;
|
||||
if (kills >= 7) return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** 요약의 포지션 비율을 높은 순으로 정리한다. */
|
||||
export function rankPositionRates(
|
||||
rates: Partial<Record<string, number>>,
|
||||
|
||||
@@ -35,11 +35,7 @@ import {
|
||||
useAuctionSocket,
|
||||
type BidLatencyDiagnostics,
|
||||
} from "../api/useAuctionSocket";
|
||||
import {
|
||||
DEFAULT_COMMUNITY_ID,
|
||||
setDevCaptainTeamIndex,
|
||||
useDevCaptainTeamIndex,
|
||||
} from "../config";
|
||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||
import { ApiError } from "../lib/api";
|
||||
import { mergeAuctionState } from "../api/auction-state";
|
||||
import {
|
||||
@@ -1929,7 +1925,6 @@ export default function AuctionPage() {
|
||||
const undoMutation = useUndoAuction(DEFAULT_COMMUNITY_ID);
|
||||
const resetAuctionMutation = useResetAuction(DEFAULT_COMMUNITY_ID);
|
||||
const socket = useAuctionSocket(id);
|
||||
const captainTeamIndex = useDevCaptainTeamIndex();
|
||||
const [assignedPositionDraft, setAssignedPositionDraft] = useState<{
|
||||
playerId: string | null;
|
||||
position: Position;
|
||||
@@ -1995,29 +1990,12 @@ export default function AuctionPage() {
|
||||
const setAssignedPosition = (position: Position) => {
|
||||
setAssignedPositionDraft({ playerId: currentPlayerId, position });
|
||||
};
|
||||
const availableTeamIndexes = useMemo(() => {
|
||||
const indexes = new Set(
|
||||
(auctionState?.teams ?? []).map((team) => team.teamIndex),
|
||||
);
|
||||
return [...indexes].sort((left, right) => left - right);
|
||||
}, [auctionState?.teams]);
|
||||
const captainRole: CaptainRole | null =
|
||||
captainTeamIndex === null
|
||||
? null
|
||||
: {
|
||||
teamIndex: captainTeamIndex,
|
||||
};
|
||||
const captainTeam = currentUser && auctionState?.teams.find(
|
||||
(team) => team.captainUserId === currentUser._id,
|
||||
);
|
||||
const captainRole: CaptainRole | null = captainTeam ? { teamIndex: captainTeam.teamIndex } : null;
|
||||
const chatSenderLabel = resolveChatSenderLabel(currentUser, captainRole);
|
||||
|
||||
useEffect(() => {
|
||||
if (availableTeamIndexes.length === 0) return;
|
||||
if (
|
||||
captainTeamIndex !== null &&
|
||||
!availableTeamIndexes.includes(captainTeamIndex)
|
||||
) {
|
||||
setDevCaptainTeamIndex(availableTeamIndexes[0]);
|
||||
}
|
||||
}, [availableTeamIndexes, captainTeamIndex]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!socket.resetAt || !id) return;
|
||||
@@ -2299,28 +2277,9 @@ export default function AuctionPage() {
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
<div className="w-40">
|
||||
{/* 임시 운영용: 로그인/권한 확인 없이 조작자 역할을 선택할 수 있게 열어둔다. */}
|
||||
<select
|
||||
aria-label="경매 참여 역할"
|
||||
value={captainTeamIndex ?? "spectator"}
|
||||
onChange={(event) =>
|
||||
setDevCaptainTeamIndex(
|
||||
event.target.value === "spectator"
|
||||
? null
|
||||
: Number(event.target.value),
|
||||
)
|
||||
}
|
||||
className="lts-select"
|
||||
>
|
||||
<option value="spectator">관전자</option>
|
||||
{availableTeamIndexes.map((teamIndex) => (
|
||||
<option key={teamIndex} value={teamIndex}>
|
||||
{teamIndexLabel(teamIndex)} 팀장
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<span className="text-sm font-semibold" aria-label="경매 참여 역할">
|
||||
{captainTeam ? teamIndexLabel(captainTeam.teamIndex, captainTeam.name) + " 팀장" : "관전자"}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
<main
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { useState } from 'react';
|
||||
import type { CompetitionDetailResponse } from '@lolympus/contracts';
|
||||
import { useDeferredValue, useState } from 'react';
|
||||
import { ChevronDown, Search, X } from 'lucide-react';
|
||||
import { Link, useLocation, useParams, useSearchParams } from 'react-router';
|
||||
import {
|
||||
useCommunity,
|
||||
useCompetition,
|
||||
useCommunityInternalStatsMatches,
|
||||
useCommunityLeaderboard,
|
||||
useCommunityStatsSeasons,
|
||||
useDdragonManifest,
|
||||
useTeamInsights,
|
||||
} from '../api/hooks';
|
||||
@@ -22,7 +21,7 @@ import {
|
||||
profileIconUrl,
|
||||
} from '../lib/ddragon';
|
||||
import {
|
||||
getInternalMatchOutcome,
|
||||
formatOfficialMatchResult,
|
||||
getMainLane,
|
||||
LEADERBOARD_MIN_GAMES,
|
||||
LEADERBOARD_SORTS,
|
||||
@@ -38,10 +37,6 @@ import {
|
||||
getHistoryMatchTitle,
|
||||
getHomeMatchSchedule,
|
||||
} from './home-match-presentation';
|
||||
import {
|
||||
getSeriesHistoryResultLabel,
|
||||
shouldDisplaySeriesHistoryScore,
|
||||
} from '../components/competition/competition-series-history';
|
||||
import {
|
||||
Btn,
|
||||
Chip,
|
||||
@@ -50,7 +45,6 @@ import {
|
||||
LoadingNote,
|
||||
Panel,
|
||||
PanelHeader,
|
||||
Pill,
|
||||
PlainPage,
|
||||
Skeleton,
|
||||
} from '../ui';
|
||||
@@ -95,122 +89,14 @@ function ChampionChip({
|
||||
);
|
||||
}
|
||||
|
||||
function OfficialMatchResult({
|
||||
competition,
|
||||
}: {
|
||||
competition: CompetitionDetailResponse;
|
||||
}) {
|
||||
const { projection, teams } = competition;
|
||||
const teamName = (id: string) =>
|
||||
teams.find(({ teamId }) => teamId === id)?.name ?? '팀 미확인';
|
||||
const outcome = projection.outcome;
|
||||
if (projection.phase === 'cancelled') return '취소';
|
||||
if (projection.phase !== 'completed' || !outcome) return '결과 확정 전';
|
||||
|
||||
switch (outcome.type) {
|
||||
case 'double-elimination':
|
||||
return `우승 · ${teamName(outcome.championTeamId)}`;
|
||||
case 'round-robin':
|
||||
return outcome.leaderTeamIds.length > 0
|
||||
? `${outcome.leaderTeamIds.length > 1 ? '공동 1위' : '우승'} · ${outcome.leaderTeamIds.map(teamName).join(', ')}`
|
||||
: '대회 종료';
|
||||
case 'paired-series': {
|
||||
if (projection.series.length !== 1) return '시리즈 종료';
|
||||
const series = projection.series[0];
|
||||
if (!shouldDisplaySeriesHistoryScore(series))
|
||||
return getSeriesHistoryResultLabel(series) ?? '시리즈 종료';
|
||||
const [left, right] = series.entries;
|
||||
return `${teamName(left.teamId ?? '')} ${left.gameWins} : ${right.gameWins} ${teamName(right.teamId ?? '')}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 팀원 프로필을 겹쳐 보여주는 작은 묶음. */
|
||||
function MemberStack({
|
||||
members,
|
||||
manifest,
|
||||
}: {
|
||||
members: ApiInternalMatchCard['teams'][number]['members'];
|
||||
manifest: Manifest;
|
||||
}) {
|
||||
if (members.length === 0) return null;
|
||||
return (
|
||||
<span className="flex shrink-0 -space-x-1.5" aria-hidden="true">
|
||||
{members.slice(0, 5).map((member) => (
|
||||
<img
|
||||
key={member.userId}
|
||||
src={profileIconUrl(manifest, member.profileIconId)}
|
||||
alt=""
|
||||
title={member.summonerName}
|
||||
className="size-6 rounded-full bg-sunken-strong object-cover ring-2 ring-card"
|
||||
loading="lazy"
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
/** 펼치지 않아도 보이는 결과 요약. 목록 응답에 담긴 값만 쓴다. */
|
||||
function MatchOutcomeSummary({
|
||||
match,
|
||||
recordedGameCount,
|
||||
manifest,
|
||||
}: {
|
||||
match: ApiInternalMatchCard;
|
||||
recordedGameCount: number;
|
||||
manifest: Manifest;
|
||||
}) {
|
||||
const outcome = getInternalMatchOutcome(match);
|
||||
if (!outcome) {
|
||||
return (
|
||||
<span className="flex items-center gap-2">
|
||||
{match.status === 'in-progress' && (
|
||||
<Pill tone="live" dot>
|
||||
진행 중
|
||||
</Pill>
|
||||
)}
|
||||
<span className="tabular">{recordedGameCount}세트 수집</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (outcome.type === 'score') {
|
||||
const { left, right, leftWins, rightWins, winner } = outcome;
|
||||
const nameClass = (team: typeof left) =>
|
||||
`min-w-0 truncate ${winner?.teamIndex === team.teamIndex ? 'font-bold text-content' : ''}`;
|
||||
return (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<span className={nameClass(left)}>{left.name}</span>
|
||||
<strong className="tabular shrink-0 rounded-full bg-sunken-strong px-2.5 py-0.5 text-content-strong">
|
||||
{leftWins} : {rightWins}
|
||||
</strong>
|
||||
<span className={nameClass(right)}>{right.name}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<span className="flex min-w-0 items-center gap-2">
|
||||
<Pill tone="gold">우승</Pill>
|
||||
<strong className="min-w-0 truncate font-bold text-content">
|
||||
{outcome.winner.name}
|
||||
</strong>
|
||||
<MemberStack members={outcome.winner.members} manifest={manifest} />
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
function MatchCard({
|
||||
match,
|
||||
communityId,
|
||||
manifest,
|
||||
}: {
|
||||
match: ApiInternalMatchCard;
|
||||
communityId: string;
|
||||
manifest: Manifest;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const competition = useCompetition(match.matchId, communityId, open);
|
||||
const result = match.resultPresentation;
|
||||
const location = useLocation();
|
||||
const backTo = `${location.pathname}${location.search}`;
|
||||
const recordedGames = match.games.filter(
|
||||
@@ -224,10 +110,7 @@ function MatchCard({
|
||||
|
||||
return (
|
||||
<li>
|
||||
<details
|
||||
className="group"
|
||||
onToggle={(event) => setOpen(event.currentTarget.open)}
|
||||
>
|
||||
<details className="group">
|
||||
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,18rem)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
|
||||
<span className="min-w-0">
|
||||
<span className="tabular block text-xs text-content-muted">
|
||||
@@ -243,76 +126,62 @@ function MatchCard({
|
||||
</strong>
|
||||
</span>
|
||||
<span className="col-start-1 row-start-2 flex min-w-0 text-sm text-content-muted sm:col-start-2 sm:row-start-1 sm:justify-end">
|
||||
{competition.data ? (
|
||||
<strong className="font-semibold text-content">
|
||||
<OfficialMatchResult competition={competition.data} />
|
||||
</strong>
|
||||
) : (
|
||||
<MatchOutcomeSummary
|
||||
match={match}
|
||||
recordedGameCount={recordedGames.length}
|
||||
manifest={manifest}
|
||||
/>
|
||||
)}
|
||||
<strong className="font-semibold text-content">
|
||||
{formatOfficialMatchResult(result)}
|
||||
</strong>
|
||||
</span>
|
||||
<ChevronDown
|
||||
className="col-start-2 row-span-2 row-start-1 size-4 text-content-muted transition-transform group-open:rotate-180 sm:col-start-3 sm:row-span-1"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</summary>
|
||||
{open && (
|
||||
<div className="border-t border-line bg-sunken px-4 py-3 sm:px-5">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-sm">
|
||||
<p className="text-content-muted">
|
||||
{competition.isLoading
|
||||
? '공식 결과를 확인하는 중'
|
||||
: competition.data
|
||||
? '수집된 세트 기록'
|
||||
: '공식 시리즈 정보를 확인할 수 없습니다'}
|
||||
</p>
|
||||
<Link
|
||||
className="font-semibold hover:underline"
|
||||
to={internalMatchDetailPath(communityId, match.matchId)}
|
||||
state={{ backTo }}
|
||||
>
|
||||
내전 기록 전체 보기 →
|
||||
</Link>
|
||||
</div>
|
||||
{recordedGames.length > 0 && (
|
||||
<ul className="mt-2 divide-y divide-line text-sm">
|
||||
{recordedGames.map((game) => {
|
||||
const winner = match.teams.find(
|
||||
({ teamIndex }) => teamIndex === game.winnerTeamIndex,
|
||||
);
|
||||
return (
|
||||
<li
|
||||
key={game.gameNumber}
|
||||
className="flex flex-wrap items-center justify-between gap-x-3 py-2"
|
||||
>
|
||||
<span className="tabular">
|
||||
전체 {game.gameNumber}세트 ·{' '}
|
||||
{winner ? `${winner.name} 승` : '팀 미확인'}
|
||||
</span>
|
||||
{game.riotMatchId && (
|
||||
<Link
|
||||
className="font-semibold hover:underline"
|
||||
to={internalMatchGamePath(
|
||||
communityId,
|
||||
match.matchId,
|
||||
game.gameNumber,
|
||||
)}
|
||||
state={{ backTo, backLabel: '내전 전적으로' }}
|
||||
>
|
||||
상세 분석
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
<div className="border-t border-line bg-sunken px-4 py-3 sm:px-5">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 text-sm">
|
||||
<p className="text-content-muted">
|
||||
{recordedGames.length > 0 ? '수집된 세트 기록' : '수집된 세트 기록 없음'}
|
||||
</p>
|
||||
<Link
|
||||
className="font-semibold hover:underline"
|
||||
to={internalMatchDetailPath(communityId, match.matchId)}
|
||||
state={{ backTo }}
|
||||
>
|
||||
내전 기록 전체 보기 →
|
||||
</Link>
|
||||
</div>
|
||||
)}
|
||||
{recordedGames.length > 0 && (
|
||||
<ul className="mt-2 divide-y divide-line text-sm">
|
||||
{recordedGames.map((game) => {
|
||||
const winner = match.teams.find(
|
||||
({ teamIndex }) => teamIndex === game.winnerTeamIndex,
|
||||
);
|
||||
return (
|
||||
<li
|
||||
key={game.gameNumber}
|
||||
className="flex flex-wrap items-center justify-between gap-x-3 py-2"
|
||||
>
|
||||
<span className="tabular">
|
||||
전체 {game.gameNumber}세트 ·{' '}
|
||||
{winner ? `${winner.name} 승` : '팀 미확인'}
|
||||
</span>
|
||||
{game.riotMatchId && (
|
||||
<Link
|
||||
className="font-semibold hover:underline"
|
||||
to={internalMatchGamePath(
|
||||
communityId,
|
||||
match.matchId,
|
||||
game.gameNumber,
|
||||
)}
|
||||
state={{ backTo, backLabel: '내전 전적으로' }}
|
||||
>
|
||||
상세 분석
|
||||
</Link>
|
||||
)}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
);
|
||||
@@ -567,7 +436,7 @@ export default function CommunityInternalStatsPage() {
|
||||
const isRanking = searchParams.get('view') === 'ranking';
|
||||
const seasonId = searchParams.get('seasonId') || 'current';
|
||||
const query = searchParams.get('q') ?? '';
|
||||
const keyword = query.trim().toLocaleLowerCase('ko-KR');
|
||||
const keyword = useDeferredValue(query.trim().slice(0, 100));
|
||||
const format = searchParams.get('format');
|
||||
const playerId = searchParams.get('player');
|
||||
const sort = parseLeaderboardSort(searchParams.get('sort'));
|
||||
@@ -579,12 +448,18 @@ export default function CommunityInternalStatsPage() {
|
||||
limit: 12,
|
||||
};
|
||||
const communityQuery = useCommunity(communityId);
|
||||
const seasonsQuery = useCommunityStatsSeasons(communityId);
|
||||
const matchesQuery = useCommunityInternalStatsMatches(
|
||||
filters,
|
||||
{
|
||||
...filters,
|
||||
query: isRanking ? undefined : keyword,
|
||||
format: format === 'pair' || format === 'tournament' ? format : undefined,
|
||||
playerId: playerId ?? undefined,
|
||||
},
|
||||
communityId,
|
||||
!isRanking,
|
||||
);
|
||||
const leaderboardQuery = useCommunityLeaderboard(filters, communityId);
|
||||
const leaderboardQuery = useCommunityLeaderboard({ ...filters, query: isRanking ? keyword : undefined }, communityId);
|
||||
const insightsQuery = useTeamInsights(filters, communityId);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const matches =
|
||||
@@ -599,24 +474,12 @@ export default function CommunityInternalStatsPage() {
|
||||
sort,
|
||||
);
|
||||
const player = leaderboardRows.find((row) => row.userId === playerId);
|
||||
const visibleMatches = matches.filter((match) => {
|
||||
const matchType = match.teams.length === 2 ? 'pair' : 'tournament';
|
||||
return (
|
||||
((format !== 'pair' && format !== 'tournament') ||
|
||||
matchType === format) &&
|
||||
(!playerId ||
|
||||
match.teams.some((team) =>
|
||||
team.members.some((member) => member.userId === playerId),
|
||||
)) &&
|
||||
match.title.toLocaleLowerCase('ko-KR').includes(keyword)
|
||||
);
|
||||
});
|
||||
const visiblePlayers = leaderboardRows.filter((row) =>
|
||||
row.summonerName.toLocaleLowerCase('ko-KR').includes(keyword),
|
||||
);
|
||||
const hasMatchFilters = Boolean(
|
||||
keyword || format === 'pair' || format === 'tournament' || playerId,
|
||||
);
|
||||
const matchedUsers = leaderboardQuery.data?.matchedUserIds;
|
||||
const visiblePlayers = isRanking && keyword
|
||||
? leaderboardRows.filter((row) => matchedUsers?.includes(row.userId))
|
||||
: leaderboardRows;
|
||||
const hasMatchFilters = Boolean(keyword || format || playerId);
|
||||
const confirmedSideWinRate = insights?.sideWinRate.confirmed;
|
||||
const title = isRanking ? '선수 순위' : '최근 내전';
|
||||
|
||||
if (!communityId) {
|
||||
@@ -673,7 +536,11 @@ export default function CommunityInternalStatsPage() {
|
||||
>
|
||||
<option value="current">현재 시즌</option>
|
||||
<option value="all">전체 시즌</option>
|
||||
{seasonId !== 'current' && seasonId !== 'all' && (
|
||||
{seasonsQuery.data?.seasons
|
||||
.filter(({ id }) => id !== 'current' && id !== 'all')
|
||||
.map(({ id, label }) => <option key={id} value={id}>{label}</option>)}
|
||||
{seasonId !== 'current' && seasonId !== 'all' &&
|
||||
!seasonsQuery.data?.seasons.some(({ id }) => id === seasonId) && (
|
||||
<option value={seasonId}>{season?.label ?? seasonId}</option>
|
||||
)}
|
||||
</select>
|
||||
@@ -703,6 +570,7 @@ export default function CommunityInternalStatsPage() {
|
||||
<input
|
||||
type="search"
|
||||
aria-label={isRanking ? '선수 검색' : '내전명 검색'}
|
||||
maxLength={100}
|
||||
placeholder={isRanking ? '선수 이름 검색' : '내전명 검색'}
|
||||
value={query}
|
||||
onChange={(event) => updateParam('q', event.target.value)}
|
||||
@@ -716,7 +584,7 @@ export default function CommunityInternalStatsPage() {
|
||||
<h2 id="internal-stats-heading" className="text-base font-bold">
|
||||
{title}{' '}
|
||||
<span className="tabular ml-1 text-sm font-medium text-content-muted">
|
||||
{isRanking ? visiblePlayers.length : visibleMatches.length}
|
||||
{isRanking ? visiblePlayers.length : matches.length}
|
||||
</span>
|
||||
</h2>
|
||||
{isRanking ? (
|
||||
@@ -841,34 +709,28 @@ export default function CommunityInternalStatsPage() {
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
) : visibleMatches.length === 0 ? (
|
||||
) : matches.length === 0 ? (
|
||||
<EmptyNote
|
||||
size="sm"
|
||||
title={
|
||||
hasMatchFilters
|
||||
? '불러온 기록에 일치하는 내전이 없습니다'
|
||||
? '조건에 일치하는 내전이 없습니다'
|
||||
: '아직 수집된 내전 결과가 없습니다'
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<ul className="divide-y divide-line">
|
||||
{visibleMatches.map((match) => (
|
||||
{matches.map((match) => (
|
||||
<MatchCard
|
||||
key={match.matchId}
|
||||
match={match}
|
||||
communityId={communityId}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
{matchesQuery.hasNextPage && (
|
||||
<div className="space-y-2 border-t border-line p-3">
|
||||
{hasMatchFilters && (
|
||||
<p className="text-center text-xs text-content-muted">
|
||||
필터는 불러온 {matches.length}건에 적용됩니다.
|
||||
</p>
|
||||
)}
|
||||
{matchesQuery.isFetchNextPageError && (
|
||||
<p
|
||||
role="status"
|
||||
@@ -901,12 +763,10 @@ export default function CommunityInternalStatsPage() {
|
||||
<div className="p-4">
|
||||
{insightsQuery.isLoading ? (
|
||||
<Skeleton width="100%" height={52} />
|
||||
) : confirmedSideWinRate ? (
|
||||
<SideWinRate {...confirmedSideWinRate} />
|
||||
) : insights ? (
|
||||
<SideWinRate
|
||||
blue={insights.sideWinRate.blue}
|
||||
red={insights.sideWinRate.red}
|
||||
sampleSize={insights.sideWinRate.bluePicks}
|
||||
/>
|
||||
<p className="text-sm text-content-muted">확정 세트 표본을 확인할 수 없습니다.</p>
|
||||
) : (
|
||||
<ErrorNote
|
||||
title="시즌 요약을 불러오지 못했습니다"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useState, type CSSProperties } from 'react';
|
||||
import { useEffect, useState, type CSSProperties, type ReactNode } from 'react';
|
||||
import type {
|
||||
MatchDetailResponse,
|
||||
MatchEventType,
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
Button,
|
||||
EmptyNote,
|
||||
ErrorNote,
|
||||
LoadingNote,
|
||||
Panel,
|
||||
PanelHeader,
|
||||
Pill,
|
||||
@@ -36,11 +37,11 @@ import {
|
||||
getHomeMatchEnrollment,
|
||||
getHomeMatchSchedule,
|
||||
getNextMatchBanner,
|
||||
HOME_MATCH_STATUS,
|
||||
getMatchStageLabel,
|
||||
} from './home-match-presentation';
|
||||
|
||||
const UPCOMING_MATCH_LIST_LIMIT = 4;
|
||||
const HISTORY_MATCH_PAGE_SIZE = 10;
|
||||
const MATCH_ARCHIVE_PAGE_SIZE = 10;
|
||||
const HOME_HISTORY_LIMIT = 4;
|
||||
const HOME_RANKING_LIMIT = 5;
|
||||
const DEFAULT_MAP_ID = 11;
|
||||
@@ -127,9 +128,11 @@ function NextMatch({ match }: { match: MatchDetailResponse }) {
|
||||
function UpcomingMatches({
|
||||
matches,
|
||||
title = '이어지는 내전',
|
||||
footer,
|
||||
}: {
|
||||
matches: MatchDetailResponse[];
|
||||
title?: string;
|
||||
footer?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<Panel>
|
||||
@@ -156,7 +159,7 @@ function UpcomingMatches({
|
||||
<p className="tabular col-start-1 mt-1 text-[13px] text-content-muted sm:col-start-3 sm:row-start-1 sm:mt-0">
|
||||
{match.status === 'recruiting'
|
||||
? label
|
||||
: HOME_MATCH_STATUS[match.status]}{' '}
|
||||
: getMatchStageLabel(match)}{' '}
|
||||
· {capacity}
|
||||
</p>
|
||||
<ChevronRight
|
||||
@@ -168,6 +171,10 @@ function UpcomingMatches({
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
{matches.length === 0 && (
|
||||
<EmptyNote size="sm" title="이 페이지에 표시할 일정이 없습니다." />
|
||||
)}
|
||||
{footer}
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -238,13 +245,13 @@ function HistoryResult({ match }: { match: MatchSummaryResponse }) {
|
||||
tone={match.status === 'in-progress' ? 'live' : 'neutral'}
|
||||
dot={match.status === 'in-progress'}
|
||||
>
|
||||
{HOME_MATCH_STATUS[match.status]}
|
||||
{getMatchStageLabel(match)}
|
||||
</Pill>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<span className="text-content-muted">
|
||||
{HOME_MATCH_STATUS[match.status]}
|
||||
{getMatchStageLabel(match)}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -764,7 +771,7 @@ function RankingPreview({ statsPath }: { statsPath: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
interface HistoryPaginationProps {
|
||||
interface MatchPaginationProps {
|
||||
page: number;
|
||||
pageCount: number;
|
||||
total: number;
|
||||
@@ -773,14 +780,14 @@ interface HistoryPaginationProps {
|
||||
onNext: () => void;
|
||||
}
|
||||
|
||||
function HistoryPagination({
|
||||
function MatchPagination({
|
||||
page,
|
||||
pageCount,
|
||||
total,
|
||||
isFetching,
|
||||
onPrevious,
|
||||
onNext,
|
||||
}: HistoryPaginationProps) {
|
||||
}: MatchPaginationProps) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-center justify-between gap-x-3 gap-y-1 border-t border-line px-4 py-2.5 sm:px-5">
|
||||
<span className="tabular text-xs text-content-muted">
|
||||
@@ -814,32 +821,43 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
|
||||
const eventLabel = MATCH_EVENT_LABEL[selectedEventType];
|
||||
const [timelineNow] = useState(() => new Date().toISOString());
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const requestedPage = Number(searchParams.get('page'));
|
||||
const historyPage =
|
||||
showArchive && Number.isSafeInteger(requestedPage) && requestedPage > 0
|
||||
? requestedPage
|
||||
: 1;
|
||||
const historyLimit = showArchive
|
||||
? HISTORY_MATCH_PAGE_SIZE
|
||||
: HOME_HISTORY_LIMIT;
|
||||
function setHistoryPage(page: number) {
|
||||
const params = new URLSearchParams(searchParams);
|
||||
if (page > 1) params.set('page', String(page));
|
||||
else params.delete('page');
|
||||
setSearchParams(params, { preventScrollReset: true });
|
||||
function getPage(key: 'page' | 'activePage') {
|
||||
const page = Number(searchParams.get(key));
|
||||
return showArchive && Number.isSafeInteger(page) && page > 0 ? page : 1;
|
||||
}
|
||||
const historyPage = getPage('page');
|
||||
const activePage = getPage('activePage');
|
||||
const historyLimit = showArchive ? MATCH_ARCHIVE_PAGE_SIZE : HOME_HISTORY_LIMIT;
|
||||
const activeLimit = showArchive ? MATCH_ARCHIVE_PAGE_SIZE : UPCOMING_MATCH_LIST_LIMIT;
|
||||
function setPage(key: 'page' | 'activePage', page: number) {
|
||||
setSearchParams((previous) => {
|
||||
const params = new URLSearchParams(previous);
|
||||
if (page > 1) params.set(key, String(page));
|
||||
else params.delete(key);
|
||||
return params;
|
||||
}, { preventScrollReset: true });
|
||||
}
|
||||
const upcomingMatchesQuery = useMatches({
|
||||
eventType: selectedEventType,
|
||||
view: 'upcoming',
|
||||
asOf: timelineNow,
|
||||
limit: UPCOMING_MATCH_LIST_LIMIT,
|
||||
scheduledFrom: timelineNow,
|
||||
sort: 'asc',
|
||||
});
|
||||
const activeMatchesQuery = useMatchesPage({
|
||||
eventType: selectedEventType,
|
||||
view: 'active',
|
||||
asOf: timelineNow,
|
||||
limit: activeLimit,
|
||||
page: activePage,
|
||||
sort: 'desc',
|
||||
});
|
||||
const historyMatchesQuery = useMatchesPage({
|
||||
eventType: selectedEventType,
|
||||
view: 'history',
|
||||
asOf: timelineNow,
|
||||
limit: historyLimit,
|
||||
page: historyPage,
|
||||
status: showArchive ? undefined : 'finished',
|
||||
scheduledTo: showArchive ? timelineNow : undefined,
|
||||
sort: 'desc',
|
||||
includeResults: true,
|
||||
});
|
||||
@@ -860,6 +878,11 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
|
||||
const bannerMatch = showArchive ? undefined : nextMatch;
|
||||
const visibleUpcomingMatches = showArchive ? allUpcomingMatches : upcomingMatches;
|
||||
const historyTotal = historyMatchesQuery.data?.total ?? 0;
|
||||
const activeTotal = activeMatchesQuery.data?.total ?? 0;
|
||||
const activePageCount = Math.max(
|
||||
1,
|
||||
Math.ceil(activeTotal / (activeMatchesQuery.data?.limit ?? activeLimit)),
|
||||
);
|
||||
const historyPageCount = Math.max(
|
||||
1,
|
||||
Math.ceil(historyTotal / (historyMatchesQuery.data?.limit ?? historyLimit)),
|
||||
@@ -882,6 +905,31 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
|
||||
<h1 className="text-2xl font-bold">{eventLabel} 일정</h1>
|
||||
</header>
|
||||
)}
|
||||
{activeMatchesQuery.isError && !activeMatchesQuery.data ? (
|
||||
<ErrorNote title="진행 중인 일정을 불러오지 못했습니다"
|
||||
action={<Button size="sm" label="다시 시도" onClick={() => void activeMatchesQuery.refetch()} />} />
|
||||
) : activeMatchesQuery.isPlaceholderData ? (
|
||||
<Panel aria-busy="true">
|
||||
<PanelHeader title="진행 중인 일정" />
|
||||
<LoadingNote label="일정을 불러오는 중" />
|
||||
</Panel>
|
||||
) : activeMatchesQuery.data &&
|
||||
(activeMatchesQuery.data.matches.length > 0 || activePage > 1) ? (
|
||||
<UpcomingMatches
|
||||
matches={activeMatchesQuery.data.matches}
|
||||
title="진행 중인 일정"
|
||||
footer={showArchive && (activePageCount > 1 || activePage > 1) && (
|
||||
<MatchPagination
|
||||
page={activePage}
|
||||
pageCount={activePageCount}
|
||||
total={activeTotal}
|
||||
isFetching={activeMatchesQuery.isFetching}
|
||||
onPrevious={() => setPage('activePage', Math.min(activePage - 1, activePageCount))}
|
||||
onNext={() => setPage('activePage', activePage + 1)}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
) : null}
|
||||
{upcomingMatchesQuery.isLoading ? (
|
||||
<UpcomingStatusHeading className="text-sm text-content-muted" aria-busy="true">
|
||||
{eventLabel} 일정을 불러오는 중
|
||||
@@ -921,7 +969,7 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
|
||||
>
|
||||
<HistorySection aria-busy={isHistoryPageLoading} aria-live="polite">
|
||||
<PanelHeader
|
||||
title={showArchive ? '지난 일정과 결과' : '최근 내전 결과'}
|
||||
title={showArchive ? '종료된 일정과 결과' : '최근 내전 결과'}
|
||||
variant={showArchive ? 'panel' : 'section'}
|
||||
actions={
|
||||
<Link
|
||||
@@ -961,14 +1009,14 @@ export default function HomePage({ eventType }: { eventType?: MatchEventType })
|
||||
) : (
|
||||
<RecentMatchResults matches={historyMatchesQuery.data?.matches ?? []} />
|
||||
)}
|
||||
{showArchive && !hasHistoryError && historyTotal > 0 && (
|
||||
<HistoryPagination
|
||||
{showArchive && !hasHistoryError && (historyTotal > 0 || historyPage > 1) && (
|
||||
<MatchPagination
|
||||
page={historyPage}
|
||||
pageCount={historyPageCount}
|
||||
total={historyTotal}
|
||||
isFetching={historyMatchesQuery.isFetching}
|
||||
onPrevious={() => setHistoryPage(Math.max(1, historyPage - 1))}
|
||||
onNext={() => setHistoryPage(historyPage + 1)}
|
||||
onPrevious={() => setPage('page', Math.min(historyPage - 1, historyPageCount))}
|
||||
onNext={() => setPage('page', historyPage + 1)}
|
||||
/>
|
||||
)}
|
||||
</HistorySection>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Link, useLocation, useParams } from "react-router";
|
||||
import { useCompetition, useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import { useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import type { ApiInternalMatchDetailResponse, TeamSide } from "../api/types";
|
||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||
import { ApiError } from "../lib/api";
|
||||
import {
|
||||
championDisplayName,
|
||||
championIconUrl,
|
||||
@@ -12,12 +13,16 @@ import {
|
||||
} from "../lib/league";
|
||||
import { internalMatchGamePath } from "../lib/internal-match-routes";
|
||||
import { groupRecordedSets } from "../lib/internal-match-series";
|
||||
import { riotMatchIdForDisplay } from "../lib/internal-game-evidence";
|
||||
import { formatOfficialMatchResult } from "../lib/internal-stats-presentation";
|
||||
import { LANE_LABELS } from "../lib/riot-history";
|
||||
import { ItemIcon } from "../components/ItemTooltip";
|
||||
import { BasicGameScoreboard } from "../components/BasicGameScoreboard";
|
||||
|
||||
import {
|
||||
Btn,
|
||||
EmptyNote,
|
||||
ErrorNote,
|
||||
LoadingNote,
|
||||
MetaDot,
|
||||
PageBody,
|
||||
@@ -101,17 +106,22 @@ function GamePanel({
|
||||
communityId,
|
||||
matchId,
|
||||
game,
|
||||
teams,
|
||||
ordinal,
|
||||
riotMatchId,
|
||||
manifest,
|
||||
}: {
|
||||
communityId: string;
|
||||
matchId: string;
|
||||
game: ApiInternalMatchDetailResponse["games"][number];
|
||||
teams: ApiInternalMatchDetailResponse["match"]["teams"];
|
||||
ordinal?: number;
|
||||
riotMatchId: string | null;
|
||||
manifest: ReturnType<typeof useDdragonManifest>["data"];
|
||||
}) {
|
||||
const location = useLocation();
|
||||
const historyBackTo = `${location.pathname}${location.search}${location.hash}`;
|
||||
const hasAnalysis = !game.analysisAvailability || game.analysisAvailability === "available";
|
||||
|
||||
return (
|
||||
<section className="lts-panel overflow-hidden">
|
||||
@@ -125,8 +135,10 @@ function GamePanel({
|
||||
</h3>
|
||||
<p className="mt-1 text-xs text-base-content/35">
|
||||
{formatDateTime(game.gameCreation)} ·{" "}
|
||||
{formatDuration(game.gameDuration)} ·{" "}
|
||||
<span className="font-mono">{game.riotMatchId}</span>
|
||||
{formatDuration(game.gameDuration)}
|
||||
{riotMatchId && (
|
||||
<> · <span className="font-mono">{riotMatchId}</span></>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
@@ -135,7 +147,7 @@ function GamePanel({
|
||||
state={{ backTo: historyBackTo }}
|
||||
className="inline-flex h-7 items-center rounded-full bg-primary-tint px-3 text-xs font-bold text-primary transition-colors hover:brightness-95"
|
||||
>
|
||||
상세 분석
|
||||
{hasAnalysis ? "상세 분석" : "경기 기록"}
|
||||
</Link>
|
||||
{game.teams.map((team) => (
|
||||
<span
|
||||
@@ -155,7 +167,7 @@ function GamePanel({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{game.teams.map((team) => (
|
||||
{hasAnalysis ? game.teams.map((team) => (
|
||||
<div
|
||||
key={team.side}
|
||||
className="border-b border-base-content/8 last:border-b-0"
|
||||
@@ -246,7 +258,7 @@ function GamePanel({
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
)) : <BasicGameScoreboard game={game} teams={teams} manifest={manifest} />}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -260,7 +272,6 @@ export default function InternalMatchDetailPage() {
|
||||
? requestedBack
|
||||
: `/communities/${communityId}/internal-stats`;
|
||||
const detailQuery = useInternalMatchDetail(matchId, communityId);
|
||||
const competition = useCompetition(matchId, communityId);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const detail = detailQuery.data;
|
||||
|
||||
@@ -272,7 +283,15 @@ export default function InternalMatchDetailPage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (detailQuery.error || !detail) {
|
||||
if (detailQuery.isError && !(detailQuery.error instanceof ApiError && detailQuery.error.status === 404)) {
|
||||
return (
|
||||
<PlainPage>
|
||||
<ErrorNote title="내전 기록을 불러오지 못했습니다"
|
||||
action={<Btn onClick={() => void detailQuery.refetch()}>다시 시도</Btn>} />
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
if (!detail) {
|
||||
return (
|
||||
<PlainPage>
|
||||
<EmptyNote
|
||||
@@ -287,7 +306,11 @@ export default function InternalMatchDetailPage() {
|
||||
);
|
||||
}
|
||||
|
||||
const groups = groupRecordedSets(detail, competition.data);
|
||||
const groups = groupRecordedSets(detail);
|
||||
const competition = detail.competition;
|
||||
const unanalysedGames = competition?.projection.games.filter(
|
||||
(game) => !detail.games.some((record) => record.gameId === game.id),
|
||||
) ?? [];
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -305,6 +328,12 @@ export default function InternalMatchDetailPage() {
|
||||
<span>{detail.match.teams.length}팀</span>
|
||||
<MetaDot />
|
||||
<span>{detail.games.length}세트 수집</span>
|
||||
{competition && (
|
||||
<>
|
||||
<MetaDot />
|
||||
<span>{formatOfficialMatchResult(detail.match.resultPresentation)}</span>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
@@ -314,7 +343,7 @@ export default function InternalMatchDetailPage() {
|
||||
}
|
||||
/>
|
||||
<PageBody width="xl" className="space-y-4">
|
||||
{detail.games.length === 0 && (
|
||||
{detail.games.length === 0 && unanalysedGames.length === 0 && (
|
||||
<Panel>
|
||||
<EmptyNote title="수집된 경기 기록이 없습니다" />
|
||||
</Panel>
|
||||
@@ -324,14 +353,27 @@ export default function InternalMatchDetailPage() {
|
||||
<h2 className="flex flex-wrap items-baseline gap-x-2 px-1 text-base font-bold">
|
||||
{group.label}
|
||||
<span className="text-xs font-medium text-content-muted">
|
||||
{group.series ? "시리즈" : "대진"} · {group.sets.length}세트 수집
|
||||
{group.series ? "시리즈" : "공식 시리즈 정보 없음"} · {group.sets.length}세트 수집
|
||||
</span>
|
||||
</h2>
|
||||
{group.sets.map(({ game, official }) => (
|
||||
<GamePanel key={game.riotMatchId} communityId={communityId} matchId={detail.match.matchId} game={game} ordinal={official?.ordinal} manifest={ddragon} />
|
||||
<GamePanel key={game.riotMatchId} communityId={communityId} matchId={detail.match.matchId} game={game} teams={detail.match.teams} ordinal={official?.ordinal} riotMatchId={riotMatchIdForDisplay(game, official)} manifest={ddragon} />
|
||||
))}
|
||||
</section>
|
||||
))}
|
||||
{unanalysedGames.length > 0 && (
|
||||
<Panel className="space-y-2 p-4">
|
||||
<h2 className="font-semibold">공식 세트 결과</h2>
|
||||
<ul className="space-y-1 text-sm">
|
||||
{unanalysedGames.map((game) => (
|
||||
<li key={game.id}>
|
||||
전체 {game.displayNumber}세트 · {competition?.teams.find((team) => team.teamId === game.winnerTeamId)?.name ?? "팀 미확인"} 승리
|
||||
{" · "}{game.evidence.type === "legacy" ? "Riot 원본 없음" : "상세 분석 준비 중"}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Panel>
|
||||
)}
|
||||
</PageBody>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -61,6 +61,7 @@ import {
|
||||
} from "../components/competition/match-detail-tabs";
|
||||
import { DEFAULT_COMMUNITY_ID, useAuthUserId } from "../config";
|
||||
import { apiFetch, ApiError } from "../lib/api";
|
||||
import { getMatchStageLabel } from "./home-match-presentation";
|
||||
import { profileIconUrl } from "../lib/ddragon";
|
||||
import {
|
||||
POSITION_ORDER,
|
||||
@@ -1000,6 +1001,9 @@ function MatchRegistration({
|
||||
joining,
|
||||
error,
|
||||
onJoin,
|
||||
cancelling,
|
||||
cancelError,
|
||||
onCancel,
|
||||
}: {
|
||||
match: MatchDetailView;
|
||||
canJoin: boolean;
|
||||
@@ -1008,6 +1012,9 @@ function MatchRegistration({
|
||||
joining: boolean;
|
||||
error: Error | null;
|
||||
onJoin: (position: Position) => void;
|
||||
cancelling: boolean;
|
||||
cancelError: Error | null;
|
||||
onCancel: () => void;
|
||||
}) {
|
||||
const [selectedPosition, setSelectedPosition] = useState<Position>();
|
||||
const position = selectedPosition ?? initialPosition;
|
||||
@@ -1059,6 +1066,13 @@ function MatchRegistration({
|
||||
)
|
||||
)}
|
||||
{error && <ErrorNote className="mt-4" title="참가 신청을 완료하지 못했습니다" description={error.message} />}
|
||||
{match.joined && canJoin && (
|
||||
<Btn className="mt-4" variant="secondary" loading={cancelling}
|
||||
disabled={cancelling} onClick={onCancel}>
|
||||
참가 신청 취소
|
||||
</Btn>
|
||||
)}
|
||||
{cancelError && <ErrorNote className="mt-4" title="참가 신청을 취소하지 못했습니다" description={cancelError.message} />}
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -1452,6 +1466,12 @@ export default function MatchDetailPage() {
|
||||
const navigate = useNavigate();
|
||||
const [searchParams, setSearchParams] = useSearchParams();
|
||||
const queryClient = useQueryClient();
|
||||
function invalidateMatchLists() {
|
||||
return Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ["matches", DEFAULT_COMMUNITY_ID] }),
|
||||
queryClient.invalidateQueries({ queryKey: ["matches-page", DEFAULT_COMMUNITY_ID] }),
|
||||
]);
|
||||
}
|
||||
const authUserId = useAuthUserId();
|
||||
const matchQuery = useMatch(id, DEFAULT_COMMUNITY_ID);
|
||||
const competitionEnabled = Boolean(
|
||||
@@ -1527,9 +1547,7 @@ export default function MatchDetailPage() {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null],
|
||||
}),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
|
||||
}),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
},
|
||||
onError: () => {
|
||||
@@ -1537,6 +1555,19 @@ export default function MatchDetailPage() {
|
||||
},
|
||||
});
|
||||
|
||||
const cancelJoinMutation = useMutation({
|
||||
mutationFn: () => apiFetch<MatchDetailResponse>(
|
||||
`/communities/${DEFAULT_COMMUNITY_ID}/matches/${id}/participants`,
|
||||
{ method: "DELETE" },
|
||||
),
|
||||
onSettled: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: ["match", DEFAULT_COMMUNITY_ID, id ?? null] }),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
const addParticipantMutation = useMutation({
|
||||
mutationFn: ({
|
||||
userId,
|
||||
@@ -1557,9 +1588,7 @@ export default function MatchDetailPage() {
|
||||
onSuccess: async () => {
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries({ queryKey: matchQueryKey }),
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
|
||||
}),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
},
|
||||
});
|
||||
@@ -1591,9 +1620,7 @@ export default function MatchDetailPage() {
|
||||
},
|
||||
onSettled: () => {
|
||||
void queryClient.invalidateQueries({ queryKey: matchQueryKey });
|
||||
void queryClient.invalidateQueries({
|
||||
queryKey: ["matches", DEFAULT_COMMUNITY_ID],
|
||||
});
|
||||
void invalidateMatchLists();
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1686,6 +1713,7 @@ export default function MatchDetailPage() {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ["auction", DEFAULT_COMMUNITY_ID, id ?? null],
|
||||
}),
|
||||
invalidateMatchLists(),
|
||||
]);
|
||||
navigate(`/match/${id}/auction`);
|
||||
},
|
||||
@@ -1845,13 +1873,15 @@ export default function MatchDetailPage() {
|
||||
}
|
||||
|
||||
const match = mapApiMatchToMatchDetail(matchQuery.data);
|
||||
const si = statusBadge(match.status);
|
||||
const si = { ...statusBadge(match.status), label: getMatchStageLabel(matchQuery.data) };
|
||||
const auctionNotStarted =
|
||||
auctionQuery.error instanceof ApiError && auctionQuery.error.status === 404;
|
||||
const activeAuction = auctionNotStarted ? null : auctionQuery.data;
|
||||
const showAuctionLink = Boolean(activeAuction);
|
||||
const hasTeamProgress = Boolean(competitionQuery.data?.teams.length) &&
|
||||
(match.status === "in-progress" || match.status === "finished");
|
||||
(matchQuery.data.eventProgress?.stage === "team-ready" ||
|
||||
match.status === "in-progress" ||
|
||||
match.status === "finished");
|
||||
const auctionParticipantPool = buildAuctionParticipantPool(
|
||||
matchQuery.data.participants,
|
||||
);
|
||||
@@ -2010,6 +2040,9 @@ export default function MatchDetailPage() {
|
||||
joining={joinMatchMutation.isPending}
|
||||
error={joinMatchMutation.error}
|
||||
onJoin={joinMatchMutation.mutate}
|
||||
cancelling={cancelJoinMutation.isPending}
|
||||
cancelError={cancelJoinMutation.error}
|
||||
onCancel={() => cancelJoinMutation.mutate()}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from "recharts";
|
||||
import { useCompetition, useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import { useDdragonManifest, useInternalMatchDetail } from "../api/hooks";
|
||||
import type { ApiInternalMatchDetailResponse, TeamSide } from "../api/types";
|
||||
import { DEFAULT_COMMUNITY_ID } from "../config";
|
||||
import {
|
||||
@@ -30,7 +30,10 @@ import {
|
||||
internalMatchGamePath,
|
||||
} from "../lib/internal-match-routes";
|
||||
import { selectInternalMatchGame } from "../lib/internal-match-game-selection";
|
||||
import { ApiError } from "../lib/api";
|
||||
import { BasicGameScoreboard } from "../components/BasicGameScoreboard";
|
||||
import { groupRecordedSets, type RecordedSeries } from "../lib/internal-match-series";
|
||||
import { riotMatchIdForDisplay } from "../lib/internal-game-evidence";
|
||||
import { getSeriesHistoryResultLabel, shouldDisplaySeriesHistoryScore } from "../components/competition/competition-series-history";
|
||||
import { LANE_LABELS } from "../lib/riot-history";
|
||||
import {
|
||||
@@ -58,6 +61,7 @@ import {
|
||||
import {
|
||||
Btn,
|
||||
EmptyNote,
|
||||
ErrorNote,
|
||||
LoadingNote,
|
||||
MetaDot,
|
||||
PageBody,
|
||||
@@ -1626,15 +1630,16 @@ function MatchScoreHero({
|
||||
}) {
|
||||
const selectedSeries = group.series;
|
||||
const officialGame = group.sets.find(({ game }) => game === selectedGame)?.official;
|
||||
const riotMatchId = riotMatchIdForDisplay(selectedGame, officialGame);
|
||||
const setLabel = officialGame ? `${officialGame.ordinal}세트` : `전체 ${selectedGame.gameNumber}세트`;
|
||||
const [leftTeam, rightTeam] = selectedGame.teams;
|
||||
const getScore = (side: TeamSide) => selectedSeries?.entries.find(
|
||||
(entry) => entry.teamId === officialGame?.teams[side].teamId,
|
||||
)?.gameWins;
|
||||
const leftScore = leftTeam && getScore(leftTeam.side);
|
||||
const rightScore = rightTeam && getScore(rightTeam.side);
|
||||
const showSeriesScore = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries) && leftScore !== undefined && rightScore !== undefined;
|
||||
const decision = selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
|
||||
const teamName = (teamId: string | null) =>
|
||||
detail.competition?.teams.find((team) => team.teamId === teamId)?.name ?? "팀 미확인";
|
||||
const seriesSummary = selectedSeries && shouldDisplaySeriesHistoryScore(selectedSeries)
|
||||
? `${selectedSeries.status === "in-progress" ? "시리즈 현재" : "시리즈 최종"} · ${selectedSeries.entries.map(
|
||||
({ teamId, gameWins }) => `${teamName(teamId)} ${gameWins}`,
|
||||
).join(" : ")}`
|
||||
: selectedSeries?.status === "completed" ? getSeriesHistoryResultLabel(selectedSeries) : null;
|
||||
const sideTone = (side: TeamSide) =>
|
||||
side === "blue" ? "text-win" : "text-loss";
|
||||
|
||||
@@ -1666,8 +1671,18 @@ function MatchScoreHero({
|
||||
<span className="tabular">
|
||||
{formatDuration(selectedGame.gameDuration)}
|
||||
</span>
|
||||
<MetaDot />
|
||||
<span className="font-mono text-xs">{selectedGame.riotMatchId}</span>
|
||||
{riotMatchId && (
|
||||
<>
|
||||
<MetaDot />
|
||||
<span className="font-mono text-xs">{riotMatchId}</span>
|
||||
</>
|
||||
)}
|
||||
{seriesSummary && (
|
||||
<>
|
||||
<MetaDot />
|
||||
<span>{seriesSummary}</span>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
actions={
|
||||
@@ -1687,16 +1702,7 @@ function MatchScoreHero({
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-center">
|
||||
{showSeriesScore ? (
|
||||
<>
|
||||
<div className="tabular text-4xl font-extrabold">{leftScore} : {rightScore}</div>
|
||||
<div className="mt-0.5 text-xs font-semibold text-on-ink-muted">
|
||||
{selectedSeries.status === "in-progress" ? "시리즈 진행 스코어" : "시리즈 스코어"}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<div className="text-sm font-semibold text-on-ink-muted">{decision ?? "세트 결과"}</div>
|
||||
)}
|
||||
<div className="text-sm font-semibold text-on-ink-muted">세트 결과</div>
|
||||
</div>
|
||||
<div className="min-w-0">
|
||||
<div
|
||||
@@ -1727,10 +1733,11 @@ export default function MatchGameDetailPage() {
|
||||
const resolvedMatchId = matchId ?? id;
|
||||
const requestedGameNumber = Number(gameNumber);
|
||||
const detailQuery = useInternalMatchDetail(resolvedMatchId, communityId);
|
||||
const competition = useCompetition(resolvedMatchId, communityId);
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const detail = detailQuery.data;
|
||||
const fallbackBackTo = resolvedMatchId
|
||||
const fallbackBackTo = id
|
||||
? `/match/${id}?tab=games`
|
||||
: resolvedMatchId
|
||||
? internalMatchDetailPath(communityId, resolvedMatchId)
|
||||
: `/communities/${communityId}/internal-stats`;
|
||||
const backTarget = resolveBackTarget(location.state, fallbackBackTo);
|
||||
@@ -1744,7 +1751,15 @@ export default function MatchGameDetailPage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (detailQuery.error || !detail) {
|
||||
if (detailQuery.isError && !(detailQuery.error instanceof ApiError && detailQuery.error.status === 404)) {
|
||||
return (
|
||||
<PlainPage>
|
||||
<ErrorNote title="세트 기록을 불러오지 못했습니다"
|
||||
action={<Btn onClick={() => void detailQuery.refetch()}>다시 시도</Btn>} />
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
if (!detail) {
|
||||
return (
|
||||
<PlainPage>
|
||||
<EmptyNote
|
||||
@@ -1760,9 +1775,24 @@ export default function MatchGameDetailPage() {
|
||||
requestedGameNumber,
|
||||
);
|
||||
|
||||
const groups = groupRecordedSets(detail, competition.data);
|
||||
const groups = groupRecordedSets(detail);
|
||||
const group = groups.find(({ sets }) => sets.some(({ game }) => game === selectedGame));
|
||||
if (!selectedGame || !group) {
|
||||
const officialGame = detail.competition?.projection.games.find(
|
||||
(game) => game.displayNumber === requestedGameNumber,
|
||||
);
|
||||
if (officialGame) {
|
||||
const winner = detail.competition?.teams.find((team) => team.teamId === officialGame.winnerTeamId);
|
||||
return (
|
||||
<PlainPage>
|
||||
<EmptyNote
|
||||
title={officialGame.evidence.type === "legacy" ? "Riot 원본이 없는 과거 기록" : "상세 분석 준비 중"}
|
||||
description={`${officialGame.ordinal}세트 · ${winner?.name ?? "팀 미확인"} 승리`}
|
||||
action={<Btn to={backTarget.to}>{backTarget.label}</Btn>}
|
||||
/>
|
||||
</PlainPage>
|
||||
);
|
||||
}
|
||||
const hasRecordedGames = detail.games.length > 0;
|
||||
const requestedGameLabel =
|
||||
Number.isSafeInteger(requestedGameNumber) && requestedGameNumber > 0
|
||||
@@ -1805,38 +1835,39 @@ export default function MatchGameDetailPage() {
|
||||
navigationState={navigationState}
|
||||
/>
|
||||
|
||||
<PostgameBreakdown
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
|
||||
<TimelineGraph
|
||||
key={selectedGame.riotMatchId}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
|
||||
<div className="mt-5 space-y-4">
|
||||
<InternalGameDetailTabBar
|
||||
activeTab={activeTab}
|
||||
onChange={setActiveTab}
|
||||
/>
|
||||
<InternalGameAnalysisPanel
|
||||
activeTab={activeTab}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
scoreboard={
|
||||
<ScoreboardTables
|
||||
{!selectedGame.analysisAvailability || selectedGame.analysisAvailability === "available" ? (
|
||||
<>
|
||||
<PostgameBreakdown
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<TimelineGraph
|
||||
key={selectedGame.riotMatchId}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
<div className="mt-5 space-y-4">
|
||||
<InternalGameDetailTabBar activeTab={activeTab} onChange={setActiveTab} />
|
||||
<InternalGameAnalysisPanel
|
||||
activeTab={activeTab}
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
scoreboard={
|
||||
<ScoreboardTables
|
||||
selectedGame={selectedGame}
|
||||
detail={detail}
|
||||
manifest={ddragon}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<BasicGameScoreboard game={selectedGame} teams={detail.match.teams} manifest={ddragon} />
|
||||
)}
|
||||
</PageBody>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -52,11 +52,11 @@ import {
|
||||
RANK_FILTER_TABS,
|
||||
} from "../lib/riot-history";
|
||||
import {
|
||||
mockLargestMultiKill,
|
||||
multiKillLabel,
|
||||
rankPositionRates,
|
||||
} from "../lib/multi-kill";
|
||||
import { ResponsiveTierLabel } from "../components/RankBadge";
|
||||
import { formatRankDetail } from "../components/rankBadgeUtils";
|
||||
import {
|
||||
InternalGameAnalysisPanel,
|
||||
InternalGameDetailTabBar,
|
||||
@@ -647,8 +647,12 @@ function ParticipantRow({
|
||||
>
|
||||
{participantName}
|
||||
</div>
|
||||
{/* 티어 (임시: 백엔드 연동 전까지 비움 — 라인은 행 순서로 식별) */}
|
||||
<div className="truncate text-xs text-base-content/30">—</div>
|
||||
{participant.tier && (
|
||||
<div className="truncate text-xs text-content-muted"
|
||||
title={`저장된 티어 · ${formatLastFetched(participant.tier.fetchedAt)}`}>
|
||||
{formatRankDetail(participant.tier)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -782,10 +786,9 @@ function resolveInternalDetailGame(
|
||||
match: ApiRecentMatchView,
|
||||
) {
|
||||
if (!detail) return undefined;
|
||||
return (
|
||||
detail.games.find((game) => game.gameNumber === match.gameNumber) ??
|
||||
detail.games.find((game) => game.riotMatchId === match.matchId) ??
|
||||
detail.games[0]
|
||||
return detail.games.find(
|
||||
(game) => game.riotMatchId === match.matchId &&
|
||||
(match.gameNumber === undefined || game.gameNumber === match.gameNumber),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -914,14 +917,7 @@ function RecentMatchCard({
|
||||
ownerParticipantId: string;
|
||||
}) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
// 응답에 값이 없을 때 개발 화면에서만 목업으로 배지 모양을 확인한다.
|
||||
const isMockMultiKill =
|
||||
match.largestMultiKill === undefined && import.meta.env.DEV;
|
||||
const multiKill = multiKillLabel(
|
||||
isMockMultiKill
|
||||
? mockLargestMultiKill(match.kills)
|
||||
: match.largestMultiKill,
|
||||
);
|
||||
const multiKill = multiKillLabel(match.largestMultiKill);
|
||||
const championName =
|
||||
championDisplayName(manifest, match.championId) ?? String(match.championId);
|
||||
const outcome = match.remake ? "remake" : match.win ? "win" : "loss";
|
||||
@@ -964,7 +960,6 @@ function RecentMatchCard({
|
||||
{multiKill && (
|
||||
<span
|
||||
className="mt-1 inline-flex h-5 items-center rounded-full border border-leaf px-2 text-[11px] font-semibold text-leaf"
|
||||
title={isMockMultiKill ? "목업 데이터 (API 미지원)" : undefined}
|
||||
>
|
||||
{multiKill}
|
||||
</span>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { MatchDetailResponse } from '@lolympus/contracts';
|
||||
import type { MatchDetailResponse, MatchEventStage } from '@lolympus/contracts';
|
||||
|
||||
const scheduleFormatter = new Intl.DateTimeFormat('ko-KR', {
|
||||
timeZone: 'Asia/Seoul',
|
||||
@@ -10,16 +10,25 @@ const scheduleFormatter = new Intl.DateTimeFormat('ko-KR', {
|
||||
hourCycle: 'h23',
|
||||
});
|
||||
|
||||
export const HOME_MATCH_STATUS = {
|
||||
const MATCH_STAGE_LABEL: Record<MatchEventStage, string> = {
|
||||
recruiting: '모집 중',
|
||||
'team-built': '팀빌딩',
|
||||
auction: '경매 중',
|
||||
'team-ready': '팀 편성 완료',
|
||||
'team-check': '팀빌딩 상태 확인 필요',
|
||||
'in-progress': '진행 중',
|
||||
finished: '종료',
|
||||
} as const;
|
||||
};
|
||||
|
||||
export function getMatchStageLabel(
|
||||
match: Pick<MatchDetailResponse, 'status' | 'eventProgress'>,
|
||||
) {
|
||||
return MATCH_STAGE_LABEL[match.eventProgress?.stage ??
|
||||
(match.status === 'team-built' ? 'team-check' : match.status)];
|
||||
}
|
||||
|
||||
type HomeMatchEnrollment = Pick<
|
||||
MatchDetailResponse,
|
||||
'status' | 'joined' | 'participants' | 'maxParticipants'
|
||||
'status' | 'eventProgress' | 'joined' | 'participants' | 'maxParticipants'
|
||||
>;
|
||||
|
||||
export function getHomeMatchSchedule(scheduledAt: string) {
|
||||
@@ -92,8 +101,7 @@ export function getNextMatchBanner(
|
||||
const regularTitle = /^(?:[월화수목금토일]요일\s*(?:정기\s*)?|정기\s*)내전$/u;
|
||||
const title = regularTitle.test(match.title.trim()) ? '정기 내전' : match.title;
|
||||
|
||||
let status: string = HOME_MATCH_STATUS[match.status];
|
||||
if (match.status === 'team-built') status = '팀 편성';
|
||||
let status = getMatchStageLabel(match);
|
||||
if (match.status === 'recruiting') {
|
||||
if (match.joined) status = '신청 완료';
|
||||
else if (!canApply) status = match.maxParticipants > 0 ? '정원 마감' : '모집 마감';
|
||||
|
||||
@@ -1,416 +0,0 @@
|
||||
import { ChevronDown, Search, X } from 'lucide-react';
|
||||
import { Link, useSearchParams } from 'react-router';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import { getHomeMatchSchedule } from '../pages/home-match-presentation';
|
||||
import { Chip, EmptyNote, pageWidthClass } from '../ui';
|
||||
import {
|
||||
previewSeasons,
|
||||
type PreviewMatch,
|
||||
type PreviewPlayer,
|
||||
} from './internal-stats-fixtures';
|
||||
|
||||
const formats = [
|
||||
{ value: '', label: '전체' },
|
||||
{ value: 'pair', label: '두 팀 내전' },
|
||||
{ value: 'tournament', label: '대회' },
|
||||
] as const;
|
||||
|
||||
function MatchResult({ result }: { result: PreviewMatch['result'] }) {
|
||||
switch (result.kind) {
|
||||
case 'series':
|
||||
return (
|
||||
<span className="flex flex-wrap items-center gap-x-2 text-sm">
|
||||
{result.series.teams[0]}
|
||||
<strong className="tabular rounded-field bg-sunken px-2 py-0.5 text-base">
|
||||
{result.series.score.join(' : ')}
|
||||
</strong>
|
||||
{result.series.teams[1]}
|
||||
</span>
|
||||
);
|
||||
case 'tournament':
|
||||
return (
|
||||
<span className="text-sm font-semibold">
|
||||
<span className="mr-2 text-xs font-medium text-content-muted">
|
||||
우승
|
||||
</span>
|
||||
{result.champion}
|
||||
</span>
|
||||
);
|
||||
case 'collecting':
|
||||
return (
|
||||
<span className="text-sm font-semibold text-content">
|
||||
결과 수집 중{' '}
|
||||
<span className="ml-1 font-normal text-content-muted">
|
||||
{result.recordedGames}세트
|
||||
</span>
|
||||
</span>
|
||||
);
|
||||
case 'unavailable':
|
||||
return <span className="text-sm text-content-muted">공식 결과 없음</span>;
|
||||
}
|
||||
}
|
||||
|
||||
function MatchDetails({ result }: { result: PreviewMatch['result'] }) {
|
||||
if (result.kind === 'collecting') {
|
||||
return (
|
||||
<p>
|
||||
수집된 {result.recordedGames}세트를 확인 중입니다. 순위와 우승팀은 대회
|
||||
결과가 확정되면 표시됩니다.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
if (result.kind === 'unavailable') {
|
||||
return <p>내전 일정은 종료됐고 공식 결과가 등록되지 않았습니다.</p>;
|
||||
}
|
||||
|
||||
const series = result.kind === 'tournament' ? result.final : result.series;
|
||||
return (
|
||||
<>
|
||||
<p className="font-semibold text-content">
|
||||
{result.kind === 'tournament' ? '결승 시리즈' : '시리즈 결과'}
|
||||
<span className="tabular ml-2">
|
||||
{series.teams[0]} {series.score.join(' : ')} {series.teams[1]}
|
||||
</span>
|
||||
</p>
|
||||
<ol className="mt-2 divide-y divide-line">
|
||||
{series.games.map((game, index) => (
|
||||
<li
|
||||
key={index}
|
||||
className="tabular flex flex-wrap justify-between gap-x-4 py-2"
|
||||
>
|
||||
<span>
|
||||
{index + 1}세트 ·{' '}
|
||||
<strong className="font-semibold text-content">
|
||||
{game.winner} 승리
|
||||
</strong>
|
||||
</span>
|
||||
<span>{game.duration}</span>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function MatchRow({ match }: { match: PreviewMatch }) {
|
||||
const schedule = getHomeMatchSchedule(match.scheduledAt);
|
||||
return (
|
||||
<li>
|
||||
<details className="group">
|
||||
<summary className="grid cursor-pointer list-none grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-2 px-4 py-3.5 hover:bg-sunken focus-visible:-outline-offset-2 sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto] sm:px-5 [&::-webkit-details-marker]:hidden">
|
||||
<span className="min-w-0">
|
||||
<span className="tabular block text-xs text-content-muted">
|
||||
<time dateTime={match.scheduledAt}>{schedule?.compact}</time> ·{' '}
|
||||
{match.teamCount}팀
|
||||
</span>
|
||||
<strong className="mt-1 block break-words text-base font-semibold leading-snug">
|
||||
{match.title}
|
||||
</strong>
|
||||
</span>
|
||||
<span className="col-start-1 row-start-2 min-w-0 sm:col-start-2 sm:row-start-1">
|
||||
<MatchResult result={match.result} />
|
||||
</span>
|
||||
<ChevronDown
|
||||
className="col-start-2 row-span-2 row-start-1 size-4 text-content-muted transition-transform group-open:rotate-180 sm:col-start-3 sm:row-span-1"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</summary>
|
||||
<div className="border-t border-line bg-sunken px-4 py-3 text-sm text-content-muted sm:px-5">
|
||||
<MatchDetails result={match.result} />
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function Ranking({
|
||||
players,
|
||||
season,
|
||||
}: {
|
||||
players: (PreviewPlayer & { rank: number })[];
|
||||
season: string;
|
||||
}) {
|
||||
return (
|
||||
<table className="w-full table-fixed text-left text-sm">
|
||||
<colgroup>
|
||||
<col className="w-12" />
|
||||
<col />
|
||||
<col className="w-14" />
|
||||
<col className="w-18" />
|
||||
</colgroup>
|
||||
<thead className="bg-sunken text-xs text-content-muted">
|
||||
<tr>
|
||||
<th scope="col" className="py-2 pl-4 font-semibold">
|
||||
순위
|
||||
</th>
|
||||
<th scope="col" className="px-2 py-2 font-semibold">
|
||||
선수
|
||||
</th>
|
||||
<th scope="col" className="py-2 text-right font-semibold">
|
||||
세트
|
||||
</th>
|
||||
<th scope="col" className="py-2 pr-4 text-right font-semibold">
|
||||
승률
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-line">
|
||||
{players.map((player) => {
|
||||
const total = player.wins + player.losses;
|
||||
const search = new URLSearchParams({ season, player: player.id });
|
||||
return (
|
||||
<tr key={player.id} className="hover:bg-sunken">
|
||||
<td className="tabular py-3 pl-4 text-content-muted">
|
||||
{player.rank}
|
||||
</td>
|
||||
<td className="px-2 py-3">
|
||||
<Link
|
||||
to={`?${search}`}
|
||||
className="break-words font-semibold hover:underline"
|
||||
aria-label={`${player.name}#${player.tag} 참가 내전 보기`}
|
||||
>
|
||||
{player.name}
|
||||
<span className="font-normal text-content-muted">
|
||||
#{player.tag}
|
||||
</span>
|
||||
</Link>
|
||||
<p className="text-xs text-content-muted">{player.position}</p>
|
||||
</td>
|
||||
<td className="tabular py-3 text-right">{total}</td>
|
||||
<td className="tabular py-3 pr-4 text-right font-semibold">
|
||||
{Math.round((player.wins / total) * 100)}%
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
|
||||
function SeasonSummary({
|
||||
season,
|
||||
playerCount,
|
||||
sideWins,
|
||||
}: {
|
||||
season: string;
|
||||
playerCount: number;
|
||||
sideWins: [number, number];
|
||||
}) {
|
||||
const [blue, red] = sideWins;
|
||||
const total = blue + red;
|
||||
const blueShare = Math.round((blue / total) * 100);
|
||||
return (
|
||||
<aside
|
||||
className="self-start rounded-xl border border-line bg-card p-5"
|
||||
aria-labelledby="preview-season-heading"
|
||||
>
|
||||
<h2 id="preview-season-heading" className="text-base font-bold">
|
||||
시즌 요약
|
||||
</h2>
|
||||
<p className="mt-1 text-xs text-content-muted">{season} 시즌 전체</p>
|
||||
<dl className="tabular my-4 flex gap-6 border-b border-line pb-4 text-sm">
|
||||
<div>
|
||||
<dt className="text-xs text-content-muted">기록된 세트</dt>
|
||||
<dd className="text-xl font-bold">{total}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-xs text-content-muted">집계 선수</dt>
|
||||
<dd className="text-xl font-bold">{playerCount}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p className="text-sm font-semibold">진영 승률</p>
|
||||
<div className="tabular mt-2 flex justify-between gap-2 text-xs font-semibold">
|
||||
<span>블루 {blueShare}%</span>
|
||||
<span>레드 {100 - blueShare}%</span>
|
||||
</div>
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="mt-2 flex h-1.5 gap-0.5 overflow-hidden rounded-full"
|
||||
>
|
||||
<div className="bg-win" style={{ width: `${blueShare}%` }} />
|
||||
<div className="flex-1 bg-loss" />
|
||||
</div>
|
||||
<p className="tabular mt-2 text-xs text-content-muted">
|
||||
승패가 기록된 {total}세트 기준
|
||||
</p>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
||||
export default function InternalStatsPreview() {
|
||||
const [params, setParams] = useSearchParams();
|
||||
const season = params.get('season') === '2025' ? '2025' : '2026';
|
||||
const view = params.get('view') === 'ranking' ? 'ranking' : 'matches';
|
||||
const data = previewSeasons[season];
|
||||
const query = params.get('q') ?? '';
|
||||
const keyword = query.trim().toLocaleLowerCase('ko-KR');
|
||||
const format =
|
||||
formats.find(({ value }) => value === params.get('format'))?.value ?? '';
|
||||
const player = data.players.find(({ id }) => id === params.get('player'));
|
||||
const matches = data.matches.filter((match) => {
|
||||
const matchFormat = match.teamCount === 2 ? 'pair' : 'tournament';
|
||||
return (
|
||||
(!format || matchFormat === format) &&
|
||||
(!player || match.playerIds.includes(player.id)) &&
|
||||
match.title.toLocaleLowerCase('ko-KR').includes(keyword)
|
||||
);
|
||||
});
|
||||
const players = data.players
|
||||
.map((entry, index) => ({ ...entry, rank: index + 1 }))
|
||||
.filter(({ name, tag }) =>
|
||||
`${name}#${tag}`.toLocaleLowerCase('ko-KR').includes(keyword),
|
||||
);
|
||||
const isRanking = view === 'ranking';
|
||||
const sectionTitle = isRanking ? '선수 순위' : '최근 내전';
|
||||
const count = isRanking ? players.length : matches.length;
|
||||
|
||||
function updateParam(key: string, value: string) {
|
||||
const next = new URLSearchParams(params);
|
||||
if (value) next.set(key, value);
|
||||
else next.delete(key);
|
||||
if (key === 'view' || key === 'season') {
|
||||
next.delete('q');
|
||||
next.delete('format');
|
||||
next.delete('player');
|
||||
}
|
||||
setParams(next, { replace: key === 'q', preventScrollReset: true });
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-[calc(100vh-var(--app-header-height))] bg-body">
|
||||
<main className={`${pageWidthClass()} pb-12 pt-6 sm:pt-8`}>
|
||||
<header className="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<div className="flex flex-wrap items-center gap-2 text-xs font-semibold text-content-muted">
|
||||
<span className="rounded-full border border-line-strong bg-card px-2 py-0.5">
|
||||
목업 데이터
|
||||
</span>
|
||||
<Link
|
||||
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats`}
|
||||
className="hover:underline"
|
||||
>
|
||||
현재 전적 화면 보기
|
||||
</Link>
|
||||
</div>
|
||||
<h1 className="mt-2 text-2xl font-bold tracking-tight sm:text-[30px]">
|
||||
내전 전적
|
||||
</h1>
|
||||
<p className="mt-1 text-sm text-content-muted">
|
||||
최근 내전 결과와 시즌별 선수 순위
|
||||
</p>
|
||||
</div>
|
||||
<label className="flex items-center gap-2 text-sm font-semibold">
|
||||
시즌
|
||||
<select
|
||||
className="lts-select !w-auto"
|
||||
value={season}
|
||||
onChange={(event) => updateParam('season', event.target.value)}
|
||||
>
|
||||
<option value="2026">2026 시즌</option>
|
||||
<option value="2025">2025 시즌</option>
|
||||
</select>
|
||||
</label>
|
||||
</header>
|
||||
|
||||
<div className="mt-6 grid gap-5 lg:grid-cols-[minmax(0,1fr)_16rem]">
|
||||
<section
|
||||
aria-labelledby="preview-results-heading"
|
||||
className="min-w-0"
|
||||
>
|
||||
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="flex gap-1.5" role="group" aria-label="전적 보기">
|
||||
<Chip
|
||||
selected={!isRanking}
|
||||
onClick={() => updateParam('view', '')}
|
||||
>
|
||||
최근 내전
|
||||
</Chip>
|
||||
<Chip
|
||||
selected={isRanking}
|
||||
onClick={() => updateParam('view', 'ranking')}
|
||||
>
|
||||
선수 순위
|
||||
</Chip>
|
||||
</div>
|
||||
<label className="flex h-10 w-full items-center gap-2 rounded-full border border-line-strong bg-card px-3 text-content-muted focus-within:border-content-muted sm:w-60">
|
||||
<Search className="size-4 shrink-0" aria-hidden="true" />
|
||||
<input
|
||||
type="search"
|
||||
aria-label={isRanking ? '선수 검색' : '내전명 검색'}
|
||||
placeholder={
|
||||
isRanking ? '선수 이름 또는 이름#태그' : '내전명 검색'
|
||||
}
|
||||
value={query}
|
||||
onChange={(event) => updateParam('q', event.target.value)}
|
||||
className="min-w-0 flex-1 text-sm text-content focus-visible:outline-none"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 overflow-hidden rounded-xl border border-line bg-card">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2 border-b border-line px-4 py-3 sm:px-5">
|
||||
<h2
|
||||
id="preview-results-heading"
|
||||
className="text-base font-bold"
|
||||
>
|
||||
{sectionTitle}{' '}
|
||||
<span className="tabular ml-1 text-sm font-medium text-content-muted">
|
||||
{count}
|
||||
</span>
|
||||
</h2>
|
||||
{isRanking ? (
|
||||
<span className="text-xs text-content-muted">승률 순</span>
|
||||
) : (
|
||||
<div
|
||||
className="flex flex-wrap gap-1.5"
|
||||
role="group"
|
||||
aria-label="내전 유형"
|
||||
>
|
||||
{formats.map(({ value, label }) => (
|
||||
<Chip
|
||||
key={value}
|
||||
selected={format === value}
|
||||
onClick={() => updateParam('format', value)}
|
||||
>
|
||||
{label}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{!isRanking && player && (
|
||||
<div className="border-b border-line px-4 py-2 sm:px-5">
|
||||
<Chip
|
||||
selected
|
||||
onClick={() => updateParam('player', '')}
|
||||
aria-label={`${player.name} 참가 내전 필터 해제`}
|
||||
>
|
||||
{player.name} 참가 내전{' '}
|
||||
<X className="size-3.5" aria-hidden="true" />
|
||||
</Chip>
|
||||
</div>
|
||||
)}
|
||||
{count === 0 ? (
|
||||
<EmptyNote size="sm" title="조건에 맞는 기록이 없습니다" />
|
||||
) : isRanking ? (
|
||||
<Ranking players={players} season={season} />
|
||||
) : (
|
||||
<ul className="divide-y divide-line">
|
||||
{matches.map((match) => (
|
||||
<MatchRow key={match.id} match={match} />
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
<SeasonSummary
|
||||
season={season}
|
||||
playerCount={data.players.length}
|
||||
sideWins={data.sideWins}
|
||||
/>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,292 +0,0 @@
|
||||
import { useState, type ReactNode } from "react";
|
||||
import { Link, useSearchParams } from "react-router";
|
||||
import { Btn, Chip, Pill, pageWidthClass } from "../ui";
|
||||
import "./match-flows-preview.css";
|
||||
|
||||
const flows = [
|
||||
{ id: "signup", name: "참가 신청" },
|
||||
{ id: "auction", name: "경매" },
|
||||
{ id: "team", name: "팀 진행·대진" },
|
||||
{ id: "ops", name: "운영" },
|
||||
] as const;
|
||||
|
||||
const teams = [
|
||||
{ name: "별무리", points: 430, players: 3, open: "정글 · 서포터" },
|
||||
{ name: "여울", points: 520, players: 2, open: "탑 · 미드 · 원딜" },
|
||||
{ name: "밤편지", points: 370, players: 4, open: "원딜" },
|
||||
{ name: "서릿길", points: 480, players: 3, open: "탑 · 미드" },
|
||||
] as const;
|
||||
|
||||
const opsItems = [
|
||||
{ id: "code", type: "코드", title: "1세트 코드 발급 대기", context: "토요 내전 · 준결승 2경기", action: "예시 코드 발급", done: "발급됨", detail: "별무리와 여울의 1세트입니다. 발급되면 두 팀의 팀 진행 화면에 표시됩니다." },
|
||||
{ id: "result", type: "결과", title: "수집된 결과 확인", context: "수요 내전 · 결승 2세트", action: "예시 결과 확인 완료", done: "확인 완료", detail: "수집된 결과는 여울 승리입니다. 내전과 세트를 확인한 뒤 검토를 마칠 수 있습니다." },
|
||||
{ id: "import", type: "과거 기록", title: "중복 후보 2건 검토", context: "11월 1일~7일 · 수집 완료 18건", action: "예시 검토 완료", done: "검토 완료", detail: "같은 Riot 경기 ID가 이미 등록된 기록입니다. 두 기록을 비교한 뒤 정리하는 단계입니다." },
|
||||
] as const;
|
||||
|
||||
const headings = {
|
||||
signup: { label: "참가 신청", title: "토요 내전", detail: "11월 14일 (토) 21:00 · 소환사의 협곡 · 4팀" },
|
||||
auction: { label: "팀빌딩", title: "토요 내전 경매", detail: "현재 선수와 팀 포인트를 한 화면에서 확인하세요." },
|
||||
team: { label: "팀 진행", title: "별무리의 다음 경기", detail: "토요 내전 · 더블 엘리미네이션" },
|
||||
ops: { label: "운영", title: "확인할 작업", detail: "코드 발급, 결과 확인, 과거 기록 검토를 모았습니다." },
|
||||
} as const;
|
||||
|
||||
function Panel({ title, children }: { title: string; children: ReactNode }) {
|
||||
return (
|
||||
<section className="match-flows-panel min-w-0 border border-line bg-card">
|
||||
<h2 className="border-b border-line px-4 py-3.5 text-base font-bold sm:px-5">{title}</h2>
|
||||
<div className="px-4 py-4 sm:px-5">{children}</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
function PreviewControl({ label, children }: { label: string; children: ReactNode }) {
|
||||
return (
|
||||
<label className="flex flex-wrap items-center gap-2 text-sm font-medium text-content-muted">
|
||||
{label}
|
||||
{children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
|
||||
const selectClass = "min-h-10 max-w-full rounded-field border border-line-strong bg-card px-2.5 text-sm text-content";
|
||||
|
||||
function Signup() {
|
||||
const [full, setFull] = useState(false);
|
||||
const [position, setPosition] = useState("");
|
||||
const [entry, setEntry] = useState<"joined" | "waiting" | null>(null);
|
||||
const enrolled = full ? 20 : entry === "joined" ? 19 : 18;
|
||||
const positions = ["탑", "정글", "미드", "원딜", "서포터"];
|
||||
|
||||
return (
|
||||
<>
|
||||
<PreviewControl label="예시 모집 상태">
|
||||
<select className={selectClass} value={full ? "full" : "open"} onChange={(event) => {
|
||||
setFull(event.target.value === "full");
|
||||
setEntry(null);
|
||||
setPosition("");
|
||||
}}>
|
||||
<option value="open">자리 있음</option>
|
||||
<option value="full">정원 마감</option>
|
||||
</select>
|
||||
</PreviewControl>
|
||||
<div className="match-flows-grid grid gap-4">
|
||||
<Panel title="내 참가 상태">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<p role="status" className="text-lg font-bold">
|
||||
{entry === "joined" ? "참가 확정" : entry === "waiting" ? "대기 신청 완료" : full ? "현재 정원이 찼습니다" : "2자리 남았어요"}
|
||||
</p>
|
||||
<Pill tone={full ? "gold" : "live"}>{enrolled}/20명</Pill>
|
||||
</div>
|
||||
<progress className="match-flows-capacity mt-3 h-2 w-full" value={enrolled} max={20} aria-label="참가 정원" />
|
||||
{entry ? (
|
||||
<div className="mt-4 grid gap-3">
|
||||
<p className="text-sm text-content-muted">
|
||||
{entry === "joined" ? `희망 포지션은 ${position}입니다. 20:50까지 디스코드 대기실에 입장해 주세요.` : `희망 포지션은 ${position}입니다. 현재 대기 1번이며 빈자리가 생기면 순서대로 안내합니다.`}
|
||||
</p>
|
||||
<div><Btn variant="ghost" onClick={() => setEntry(null)}>신청 취소</Btn></div>
|
||||
</div>
|
||||
) : (
|
||||
<form className="mt-4 grid gap-4" onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
setEntry(full ? "waiting" : "joined");
|
||||
}}>
|
||||
<fieldset>
|
||||
<legend className="mb-2 text-sm font-semibold">희망 포지션</legend>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{positions.map((role) => (
|
||||
<label key={role} className="cursor-pointer">
|
||||
<input className="peer sr-only" type="radio" name="position" value={role} checked={position === role} onChange={() => setPosition(role)} />
|
||||
<span className="inline-flex min-h-9 items-center rounded-full border border-line-strong px-3 text-sm peer-checked:border-transparent peer-checked:bg-secondary peer-checked:text-secondary-content peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2">{role}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
<div><Btn type="submit" variant="primary" disabled={!position} className="min-h-11">{full ? "대기 신청" : "참가 신청"}</Btn></div>
|
||||
</form>
|
||||
)}
|
||||
</Panel>
|
||||
<Panel title="일정 안내">
|
||||
<dl className="space-y-3 text-sm">
|
||||
<div className="flex justify-between gap-4"><dt className="text-content-muted">신청 마감</dt><dd className="font-semibold">20:30</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-content-muted">디스코드 집결</dt><dd className="font-semibold">20:50</dd></div>
|
||||
<div className="flex justify-between gap-4"><dt className="text-content-muted">내전 시작</dt><dd className="font-semibold">21:00</dd></div>
|
||||
</dl>
|
||||
<details className="mt-4 border-t border-line pt-3 text-sm">
|
||||
<summary className="cursor-pointer font-semibold">참가 규칙</summary>
|
||||
<p className="mt-2 text-content-muted">희망 포지션과 실제 배정은 다를 수 있습니다. 불참 시 모집 마감 전 신청을 취소해 주세요.</p>
|
||||
</details>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Auction() {
|
||||
const [spectator, setSpectator] = useState(false);
|
||||
const [closed, setClosed] = useState(false);
|
||||
const [bids, setBids] = useState([{ team: "밤편지", points: 120 }, { team: "여울", points: 110 }]);
|
||||
const current = bids[0];
|
||||
const nextBid = current.points + 10;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-wrap items-center gap-x-4 gap-y-2">
|
||||
<PreviewControl label="예시 역할">
|
||||
<select className={selectClass} value={spectator ? "spectator" : "captain"} onChange={(event) => setSpectator(event.target.value === "spectator")}>
|
||||
<option value="captain">별무리 팀장</option>
|
||||
<option value="spectator">관전자</option>
|
||||
</select>
|
||||
</PreviewControl>
|
||||
<Chip selected={closed} onClick={() => setClosed(!closed)}>입찰 마감 상태</Chip>
|
||||
</div>
|
||||
<div className="match-flows-grid grid gap-4">
|
||||
<Panel title="현재 선수 · 7/16">
|
||||
<div className="flex flex-wrap items-start justify-between gap-3">
|
||||
<div><p className="text-xl font-bold">초승달 <span className="text-sm font-medium text-content-muted">#MOON</span></p><p className="mt-1 text-sm text-content-muted">다이아몬드 2 · 정글 / 서포터</p></div>
|
||||
<Pill tone={closed ? "neutral" : "live"}>{closed ? "입찰 마감" : "입찰 중"}</Pill>
|
||||
</div>
|
||||
<div className="mt-5 grid grid-cols-2 gap-3 rounded-lg bg-sunken px-3 py-3.5 sm:px-4" role="status">
|
||||
<div><p className="text-sm text-content-muted">{closed ? "최종 낙찰가" : "현재 최고가"}</p><p className="tabular text-xl font-bold">{current.points}P</p><p className="text-sm text-content-muted">{current.team}</p></div>
|
||||
{!spectator && <div><p className="text-sm text-content-muted">별무리 잔여</p><p className="tabular text-xl font-bold">{closed && current.team === "별무리" ? teams[0].points - current.points : teams[0].points}P</p></div>}
|
||||
</div>
|
||||
{!spectator && !closed && (
|
||||
<div className="mt-4 flex flex-wrap items-center gap-2">
|
||||
<Btn variant="primary" className="min-h-11" disabled={current.team === "별무리"} onClick={() => setBids([{ team: "별무리", points: nextBid }, ...bids])}>{current.team === "별무리" ? "현재 최고 입찰" : `${nextBid}P 입찰`}</Btn>
|
||||
<p className="text-sm text-content-muted">낙찰될 때 포인트가 차감됩니다.</p>
|
||||
</div>
|
||||
)}
|
||||
<div className="mt-5 space-y-3 border-t border-line pt-3 text-sm">
|
||||
<details><summary className="cursor-pointer font-semibold">최근 내전 전적</summary><p className="mt-2 text-content-muted">최근 8세트 · 5승 3패 · KDA 3.6</p></details>
|
||||
<details><summary className="cursor-pointer font-semibold">현재 선수 입찰 기록 · {bids.length}건</summary><ol className="mt-2 divide-y divide-line">{bids.map((bid) => <li key={bid.points} className="flex justify-between py-2"><span>{bid.team}</span><strong>{bid.points}P</strong></li>)}</ol></details>
|
||||
</div>
|
||||
</Panel>
|
||||
<Panel title="팀 현황">
|
||||
<ul className="divide-y divide-line">
|
||||
{teams.map((team) => {
|
||||
const won = closed && current.team === team.name;
|
||||
return (
|
||||
<li key={team.name} className="flex justify-between gap-3 py-3 first:pt-0 last:pb-0">
|
||||
<div><p className="font-semibold">{team.name}</p><p className="mt-1 text-xs text-content-muted">{won ? "선수 1명 낙찰" : `빈 포지션 · ${team.open}`}</p></div>
|
||||
<div className="tabular text-right"><p className="font-bold">{team.points - (won ? current.points : 0)}P</p><p className="mt-1 text-xs text-content-muted">{team.players + Number(won)}/5명</p></div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function TeamProgress() {
|
||||
const [issued, setIssued] = useState(false);
|
||||
const [codeStatus, setCodeStatus] = useState("");
|
||||
const code = "DEMO-ONLY-01";
|
||||
|
||||
async function copyCode() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(code);
|
||||
setCodeStatus("예시 코드를 복사했습니다.");
|
||||
} catch {
|
||||
setCodeStatus("복사할 수 없습니다. 코드를 직접 선택해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<div><Chip selected={issued} onClick={() => { setIssued(!issued); setCodeStatus(""); }}>코드 발급 상태</Chip></div>
|
||||
<div className="match-flows-grid grid gap-4">
|
||||
<Panel title="다음 경기">
|
||||
<p className="text-sm text-content-muted">준결승 · 3전 2선승 · 21:30</p>
|
||||
<p className="mt-2 text-xl font-bold">별무리 <span className="mx-1 text-sm font-medium text-content-muted">vs</span> 여울</p>
|
||||
<div className="mt-5 grid gap-3 rounded-lg bg-sunken p-3.5 sm:p-4">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2"><p className="text-sm font-semibold">1세트 토너먼트 코드</p><Pill tone={issued ? "live" : "gold"}>{issued ? "발급됨" : "발급 대기"}</Pill></div>
|
||||
{issued ? (
|
||||
<div className="flex flex-wrap items-center justify-between gap-2"><code className="text-sm font-semibold">{code}</code><Btn onClick={() => void copyCode()}>코드 복사</Btn></div>
|
||||
) : <p className="text-sm text-content-muted">운영자가 코드를 발급하면 이곳에서 복사할 수 있습니다.</p>}
|
||||
<p role="status" className={codeStatus ? "text-sm text-content-muted" : "sr-only"}>{codeStatus}</p>
|
||||
</div>
|
||||
<details className="mt-4 border-t border-line pt-3 text-sm">
|
||||
<summary className="cursor-pointer font-semibold">다른 세트 상태</summary>
|
||||
<p className="mt-2 text-content-muted">2세트 · 발급 대기</p><p className="mt-1 text-content-muted">3세트 · 필요 시 진행</p>
|
||||
</details>
|
||||
</Panel>
|
||||
<Panel title="라운드별 일정·결과">
|
||||
<ul className="space-y-3 text-sm">
|
||||
<li><details><summary className="cursor-pointer font-semibold">1라운드 · 종료</summary><p className="mt-2 text-content-muted">별무리 2 : 0 밤편지</p></details></li>
|
||||
<li className="border-t border-line pt-3"><details><summary className="cursor-pointer font-semibold">준결승 · 2대진</summary><p className="mt-2 text-content-muted">별무리 vs 여울 · 21:30</p><p className="mt-1 text-content-muted">서릿길 vs 파도 · 21:30</p></details></li>
|
||||
<li className="border-t border-line pt-3 text-content-muted">결승 · 대진 미정</li>
|
||||
</ul>
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Operations() {
|
||||
const [filter, setFilter] = useState("전체");
|
||||
const [done, setDone] = useState<string[]>([]);
|
||||
const [message, setMessage] = useState("");
|
||||
const shown = opsItems.filter((item) => filter === "전체" || filter === item.type);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="flex flex-wrap gap-2" role="group" aria-label="작업 유형">
|
||||
{["전체", ...opsItems.map((item) => item.type)].map((type) => (
|
||||
<Chip key={type} selected={type === filter} onClick={() => setFilter(type)}>{type}</Chip>
|
||||
))}
|
||||
</div>
|
||||
<Panel title={`남은 작업 ${opsItems.length - done.length}건`}>
|
||||
<ul className="divide-y divide-line">
|
||||
{shown.map((item) => {
|
||||
const completed = done.includes(item.id);
|
||||
return (
|
||||
<li key={item.id} className="py-3 first:pt-0 last:pb-0">
|
||||
<details>
|
||||
<summary className="cursor-pointer rounded-field py-1 focus-visible:outline-2 focus-visible:outline-offset-2">
|
||||
<span className="match-flows-task inline-flex flex-wrap items-center gap-x-3 gap-y-1 align-middle"><strong className="text-sm">{item.title}</strong><Pill tone={completed ? "live" : "gold"}>{completed ? item.done : "확인 필요"}</Pill><span className="match-flows-task-context text-sm text-content-muted">{item.context}</span></span>
|
||||
</summary>
|
||||
<div className="mt-2 space-y-3 rounded-lg bg-sunken p-3 text-sm text-content-muted">
|
||||
<p>{item.detail}</p>
|
||||
{!completed && <Btn onClick={() => { setDone([...done, item.id]); setMessage(`${item.title} · ${item.done}`); }}>{item.action}</Btn>}
|
||||
</div>
|
||||
</details>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
<p role="status" className="sr-only">{message}</p>
|
||||
</Panel>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default function MatchFlowsPreview() {
|
||||
const [params] = useSearchParams();
|
||||
const active = flows.find((flow) => flow.id === params.get("flow"))?.id ?? "signup";
|
||||
const heading = headings[active];
|
||||
|
||||
return (
|
||||
<main className={`${pageWidthClass("lg")} pb-12 pt-6 text-content sm:pt-9`}>
|
||||
<div className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-content-muted">
|
||||
<Pill>UX 목업</Pill><span>샘플 데이터로 보는 내전 흐름</span>
|
||||
</div>
|
||||
<nav aria-label="목업 흐름" className="mt-4 flex flex-wrap gap-2 border-b border-line pb-4">
|
||||
{flows.map((flow) => (
|
||||
<Link key={flow.id} to={`?flow=${flow.id}`} aria-current={active === flow.id ? "page" : undefined} className="match-flows-link inline-flex min-h-9 items-center rounded-full border border-line-strong bg-card px-3.5 text-sm font-semibold text-content-muted hover:text-content">{flow.name}</Link>
|
||||
))}
|
||||
</nav>
|
||||
<div className="pb-5 pt-5 sm:pt-7">
|
||||
<p className="text-sm font-semibold text-content-muted">{heading.label}</p>
|
||||
<h1 className="match-flows-title mt-1 font-bold leading-tight">{heading.title}</h1>
|
||||
<p className="mt-1.5 text-sm text-content-muted">{heading.detail}</p>
|
||||
</div>
|
||||
<div className="space-y-3">
|
||||
{active === "signup" && <Signup />}
|
||||
{active === "auction" && <Auction />}
|
||||
{active === "team" && <TeamProgress />}
|
||||
{active === "ops" && <Operations />}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
type Series = {
|
||||
teams: [string, string];
|
||||
score: [number, number];
|
||||
games: { winner: string; duration: string }[];
|
||||
};
|
||||
|
||||
type MatchResult =
|
||||
| { kind: 'series'; series: Series }
|
||||
| { kind: 'tournament'; champion: string; final: Series }
|
||||
| { kind: 'collecting'; recordedGames: number }
|
||||
| { kind: 'unavailable' };
|
||||
|
||||
export type PreviewMatch = {
|
||||
id: string;
|
||||
title: string;
|
||||
scheduledAt: string;
|
||||
teamCount: number;
|
||||
playerIds: string[];
|
||||
result: MatchResult;
|
||||
};
|
||||
|
||||
export type PreviewPlayer = {
|
||||
id: string;
|
||||
name: string;
|
||||
tag: string;
|
||||
position: string;
|
||||
wins: number;
|
||||
losses: number;
|
||||
};
|
||||
|
||||
type PreviewSeason = {
|
||||
matches: PreviewMatch[];
|
||||
players: PreviewPlayer[];
|
||||
sideWins: [blue: number, red: number];
|
||||
};
|
||||
|
||||
const final: Series = {
|
||||
teams: ['별빛', '바람'],
|
||||
score: [2, 1],
|
||||
games: [
|
||||
{ winner: '별빛', duration: '30:42' },
|
||||
{ winner: '바람', duration: '28:17' },
|
||||
{ winner: '별빛', duration: '34:11' },
|
||||
],
|
||||
};
|
||||
|
||||
export const previewSeasons: Record<'2026' | '2025', PreviewSeason> = {
|
||||
'2026': {
|
||||
sideWins: [24, 21],
|
||||
matches: [
|
||||
{
|
||||
id: 'autumn-league',
|
||||
title: '가을 내전 리그',
|
||||
scheduledAt: '2026-11-08T12:00:00+09:00',
|
||||
teamCount: 8,
|
||||
playerIds: ['star', 'wind', 'forest'],
|
||||
result: { kind: 'collecting', recordedGames: 16 },
|
||||
},
|
||||
{
|
||||
id: 'loly-cup',
|
||||
title: '롤림푸스 컵',
|
||||
scheduledAt: '2026-11-07T21:00:00+09:00',
|
||||
teamCount: 4,
|
||||
playerIds: ['star', 'wind', 'forest', 'dawn'],
|
||||
result: { kind: 'tournament', champion: '별빛', final },
|
||||
},
|
||||
{
|
||||
id: 'saturday',
|
||||
title: '토요일 정기 내전',
|
||||
scheduledAt: '2026-10-31T21:00:00+09:00',
|
||||
teamCount: 2,
|
||||
playerIds: ['star', 'wind', 'dawn'],
|
||||
result: { kind: 'series', series: final },
|
||||
},
|
||||
{
|
||||
id: 'friday',
|
||||
title: '금요일 심야 내전',
|
||||
scheduledAt: '2026-10-30T22:00:00+09:00',
|
||||
teamCount: 2,
|
||||
playerIds: ['forest', 'dawn'],
|
||||
result: { kind: 'unavailable' },
|
||||
},
|
||||
],
|
||||
players: [
|
||||
{
|
||||
id: 'star',
|
||||
name: '별빛',
|
||||
tag: 'LTS',
|
||||
position: '미드',
|
||||
wins: 12,
|
||||
losses: 5,
|
||||
},
|
||||
{
|
||||
id: 'wind',
|
||||
name: '바람',
|
||||
tag: 'LTS',
|
||||
position: '정글',
|
||||
wins: 10,
|
||||
losses: 6,
|
||||
},
|
||||
{
|
||||
id: 'forest',
|
||||
name: '숲길',
|
||||
tag: 'KR1',
|
||||
position: '서포터',
|
||||
wins: 8,
|
||||
losses: 6,
|
||||
},
|
||||
{
|
||||
id: 'dawn',
|
||||
name: '새벽',
|
||||
tag: 'KR1',
|
||||
position: '원딜',
|
||||
wins: 7,
|
||||
losses: 8,
|
||||
},
|
||||
],
|
||||
},
|
||||
'2025': {
|
||||
sideWins: [2, 1],
|
||||
matches: [
|
||||
{
|
||||
id: 'winter',
|
||||
title: '겨울 시즌 마감전',
|
||||
scheduledAt: '2025-12-20T21:00:00+09:00',
|
||||
teamCount: 2,
|
||||
playerIds: ['star', 'wind'],
|
||||
result: { kind: 'series', series: final },
|
||||
},
|
||||
],
|
||||
players: [
|
||||
{
|
||||
id: 'star',
|
||||
name: '별빛',
|
||||
tag: 'LTS',
|
||||
position: '미드',
|
||||
wins: 2,
|
||||
losses: 1,
|
||||
},
|
||||
{
|
||||
id: 'wind',
|
||||
name: '바람',
|
||||
tag: 'LTS',
|
||||
position: '정글',
|
||||
wins: 1,
|
||||
losses: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -1,48 +0,0 @@
|
||||
.match-flows-title {
|
||||
font-size: clamp(1.5rem, 5vw, 2rem);
|
||||
}
|
||||
|
||||
.match-flows-panel {
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 3px 10px color-mix(in srgb, var(--color-palette-black) 3%, transparent);
|
||||
}
|
||||
|
||||
.match-flows-link[aria-current="page"] {
|
||||
border-color: transparent;
|
||||
background: var(--lts-ink);
|
||||
color: var(--lts-on-ink);
|
||||
}
|
||||
|
||||
.match-flows-capacity {
|
||||
appearance: none;
|
||||
overflow: hidden;
|
||||
border-radius: 999px;
|
||||
background-color: var(--lts-sunken-strong);
|
||||
}
|
||||
|
||||
.match-flows-capacity::-webkit-progress-bar {
|
||||
background-color: var(--lts-sunken-strong);
|
||||
}
|
||||
|
||||
.match-flows-capacity::-webkit-progress-value {
|
||||
background-color: var(--color-brand-coral);
|
||||
}
|
||||
|
||||
.match-flows-capacity::-moz-progress-bar {
|
||||
background-color: var(--color-brand-coral);
|
||||
}
|
||||
|
||||
.match-flows-task {
|
||||
max-width: calc(100% - 1.25rem);
|
||||
}
|
||||
|
||||
.match-flows-task-context {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.match-flows-grid {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(16rem, 0.6fr);
|
||||
align-items: start;
|
||||
}
|
||||
}
|
||||
@@ -78,6 +78,6 @@ test('uses neutral titles and distinguishes registration states on the next matc
|
||||
assert.equal(getNextMatchBanner({ ...match, maxParticipants: 0 }).status, '모집 마감');
|
||||
assert.deepEqual(
|
||||
getNextMatchBanner({ ...fullMatch, title: '토요일 시즌 결승 내전', status: 'team-built' }),
|
||||
{ title: '토요일 시즌 결승 내전', status: '팀 편성', capacity: '1/1명', canApply: false },
|
||||
{ title: '토요일 시즌 결승 내전', status: '팀빌딩 상태 확인 필요', capacity: '1/1명', canApply: false },
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,40 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import type { CompetitionGameView } from '@lolympus/contracts';
|
||||
import { riotMatchIdForDisplay } from '../src/lib/internal-game-evidence.ts';
|
||||
|
||||
test('keeps a real Riot ID visible even when analysis is missing', () => {
|
||||
const game = {
|
||||
gameId: 'game-1',
|
||||
riotMatchId: 'KR_123',
|
||||
analysisAvailability: 'missing',
|
||||
};
|
||||
const official = {
|
||||
evidence: { type: 'riot', riotMatchId: 'KR_123' },
|
||||
} as CompetitionGameView;
|
||||
assert.equal(riotMatchIdForDisplay(game, official), 'KR_123');
|
||||
});
|
||||
|
||||
test('does not label a legacy evidence reference as a Riot ID', () => {
|
||||
const official = {
|
||||
evidence: { type: 'legacy', legacyReference: 'KR_123' },
|
||||
} as CompetitionGameView;
|
||||
assert.equal(
|
||||
riotMatchIdForDisplay({ riotMatchId: 'KR_123' }, official),
|
||||
null,
|
||||
);
|
||||
assert.equal(
|
||||
riotMatchIdForDisplay({ riotMatchId: 'match:legacy:123' }),
|
||||
null,
|
||||
);
|
||||
assert.equal(riotMatchIdForDisplay({ riotMatchId: 'KR_TEMP_123' }), null);
|
||||
});
|
||||
|
||||
test('shows a real Riot ID on unmigrated records and hides unresolved official references', () => {
|
||||
assert.equal(riotMatchIdForDisplay({ riotMatchId: 'KR_123' }), 'KR_123');
|
||||
assert.equal(riotMatchIdForDisplay({ riotMatchId: 'NA1_123' }), 'NA1_123');
|
||||
assert.equal(
|
||||
riotMatchIdForDisplay({ riotMatchId: 'KR_123', gameId: 'unresolved' }),
|
||||
null,
|
||||
);
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import {
|
||||
getInternalMatchOutcome,
|
||||
formatOfficialMatchResult,
|
||||
getMainLane,
|
||||
parseLeaderboardSort,
|
||||
rankLeaderboardByLane,
|
||||
@@ -74,32 +74,23 @@ test('picks the most played lane', () => {
|
||||
assert.equal(getMainLane({}), undefined);
|
||||
});
|
||||
|
||||
test('shows a score for a single two-team series and a winner otherwise', () => {
|
||||
const team = (teamIndex: number) => ({
|
||||
teamIndex,
|
||||
name: `${teamIndex + 1}팀`,
|
||||
members: [],
|
||||
});
|
||||
const pair = getInternalMatchOutcome({
|
||||
winnerTeamIndex: 1,
|
||||
teams: [team(0), team(1)],
|
||||
seriesResults: [
|
||||
{ teamAIndex: 0, teamBIndex: 1, teamAWins: 1, teamBWins: 2 },
|
||||
],
|
||||
});
|
||||
assert.equal(pair?.type, 'score');
|
||||
assert.equal(pair?.type === 'score' && pair.rightWins, 2);
|
||||
assert.equal(pair?.winner?.name, '2팀');
|
||||
|
||||
const tournament = getInternalMatchOutcome({
|
||||
winnerTeamIndex: 2,
|
||||
teams: [team(0), team(1), team(2), team(3)],
|
||||
seriesResults: [],
|
||||
});
|
||||
assert.deepEqual(tournament, { type: 'winner', winner: team(2) });
|
||||
|
||||
assert.equal(
|
||||
getInternalMatchOutcome({ teams: [team(0), team(1)], seriesResults: [] }),
|
||||
undefined,
|
||||
);
|
||||
test('displays official tournament winners by ID and keeps older records neutral', () => {
|
||||
const champion = 'winner' as import('@lolympus/contracts').TeamId;
|
||||
assert.equal(formatOfficialMatchResult({
|
||||
type: 'official',
|
||||
competitionId: 'tournament' as import('@lolympus/contracts').CompetitionId,
|
||||
sourceRevision: 10,
|
||||
phase: 'completed',
|
||||
formatType: 'double-elimination',
|
||||
completedSeriesCount: 2,
|
||||
teams: [{ teamId: champion, name: '별무리' }],
|
||||
outcome: {
|
||||
type: 'double-elimination',
|
||||
championTeamId: champion,
|
||||
placements: [{ rank: 1, teamId: champion }],
|
||||
completedAt: '2026-11-10T00:00:00Z',
|
||||
},
|
||||
}), '우승 · 별무리');
|
||||
assert.equal(formatOfficialMatchResult({ type: 'legacy' }), '과거 기록');
|
||||
assert.equal(formatOfficialMatchResult(undefined), '공식 결과 확인 불가');
|
||||
});
|
||||
Reference in new issue
Block a user