.
This commit is contained in:
1 parent
4baea89f89
commit
fd386ed202
32 files changed
+1128
-601
No files matched your search
@@ -77,7 +77,7 @@ function App() {
|
||||
<Route path="/auth/callback" element={<AuthCallbackPage />} />
|
||||
<Route path="/match/:id" element={<MatchDetailPage />} />
|
||||
<Route
|
||||
path="/match/:id/team/:side/:groupIndex"
|
||||
path="/match/:id/team/:teamIndex"
|
||||
element={<MatchTeamProgressPage />}
|
||||
/>
|
||||
<Route path="/match/:id/auction" element={<AuctionPage />} />
|
||||
|
||||
+28
-40
@@ -11,10 +11,9 @@ import type {
|
||||
MatchStatus,
|
||||
Position,
|
||||
RiotLane,
|
||||
TeamSide,
|
||||
TournamentCodeSlotView,
|
||||
} from "./types";
|
||||
import { POSITION_ORDER, sideLabel } from "../lib/league";
|
||||
import { POSITION_ORDER, teamIndexLabel } from "../lib/league";
|
||||
|
||||
export interface ParticipantView {
|
||||
id: string;
|
||||
@@ -34,8 +33,7 @@ export interface TeamParticipantView extends ParticipantView {
|
||||
}
|
||||
|
||||
export interface TeamView {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
name: string;
|
||||
participants: TeamParticipantView[];
|
||||
}
|
||||
@@ -57,21 +55,21 @@ export interface MatchDetailView {
|
||||
teams: TeamView[];
|
||||
result?: {
|
||||
winner?: string;
|
||||
winnerSide?: TeamSide;
|
||||
blueScore: number;
|
||||
redScore: number;
|
||||
winnerTeamIndex?: number;
|
||||
riotMatchIds: string[];
|
||||
games: Array<{
|
||||
gameNumber: number;
|
||||
riotMatchId: string;
|
||||
winnerSide: TeamSide;
|
||||
blueGroupIndex: number;
|
||||
redGroupIndex: number;
|
||||
blueTeamIndex: number;
|
||||
redTeamIndex: number;
|
||||
winnerTeamIndex: number;
|
||||
winnerSide: "blue" | "red";
|
||||
gameCreation: number;
|
||||
gameDuration: number;
|
||||
participants: Array<{
|
||||
userId: string;
|
||||
side: TeamSide;
|
||||
teamIndex: number;
|
||||
side: "blue" | "red";
|
||||
championId: number;
|
||||
kills: number;
|
||||
deaths: number;
|
||||
@@ -101,8 +99,8 @@ export interface AuctionPlayerView extends ParticipantView {
|
||||
}
|
||||
|
||||
export interface AuctionTeamView {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
name: string;
|
||||
captainUserId: string;
|
||||
captainName: string;
|
||||
points: number;
|
||||
@@ -121,13 +119,12 @@ export interface AuctionStateView {
|
||||
totalPlayers: number;
|
||||
auctionOrder: AuctionPlayerView[];
|
||||
bids: {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
amount: number;
|
||||
timestamp: string;
|
||||
}[];
|
||||
currentBid: number;
|
||||
currentBidder: { side: TeamSide; groupIndex: number } | null;
|
||||
currentBidder: { teamIndex: number } | null;
|
||||
timer: number;
|
||||
maxTimer: number;
|
||||
deadline?: string;
|
||||
@@ -270,8 +267,8 @@ function mapAuctionTeamToView(
|
||||
participantLookup: Map<string, ParticipantView>,
|
||||
): AuctionTeamView {
|
||||
return {
|
||||
side: team.side,
|
||||
groupIndex: team.groupIndex ?? 1,
|
||||
teamIndex: team.teamIndex,
|
||||
name: teamIndexLabel(team.teamIndex),
|
||||
captainUserId: team.captainUserId,
|
||||
captainName:
|
||||
participantLookup.get(team.captainUserId)?.summonerName ??
|
||||
@@ -405,9 +402,8 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
|
||||
);
|
||||
|
||||
const teams = match.teams.map((team) => ({
|
||||
side: team.side,
|
||||
groupIndex: team.groupIndex ?? 1,
|
||||
name: team.name || sideLabel(team.side),
|
||||
teamIndex: team.teamIndex,
|
||||
name: teamIndexLabel(team.teamIndex, team.name),
|
||||
participants: team.members.map((member) => {
|
||||
const participant =
|
||||
participantLookup.get(member.userId) ??
|
||||
@@ -421,8 +417,8 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
|
||||
}),
|
||||
}));
|
||||
|
||||
const winnerTeam = match.result?.winnerSide
|
||||
? teams.find((team) => team.side === match.result?.winnerSide)
|
||||
const winnerTeam = match.result?.winnerTeamIndex
|
||||
? teams.find((team) => team.teamIndex === match.result?.winnerTeamIndex)
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
@@ -434,20 +430,16 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
|
||||
description: match.description,
|
||||
map: mapIdToLabel(match.mapId),
|
||||
maxParticipants: match.maxParticipants,
|
||||
gameCount: match.gameCount ?? 3,
|
||||
gameMode: match.gameMode ?? "pair",
|
||||
gameCount: match.gameCount ?? 3,
|
||||
gameMode: match.gameMode ?? "pair",
|
||||
tournamentCodes: match.tournamentCodes ?? [],
|
||||
joined: Boolean(match.joined),
|
||||
participants,
|
||||
teams,
|
||||
result: match.result
|
||||
? {
|
||||
winner: match.result.winnerSide
|
||||
? winnerTeam?.name ?? sideLabel(match.result.winnerSide)
|
||||
: undefined,
|
||||
winnerSide: match.result.winnerSide,
|
||||
blueScore: match.result.blueScore,
|
||||
redScore: match.result.redScore,
|
||||
? {
|
||||
winner: match.result.winnerTeamIndex ? winnerTeam?.name : undefined,
|
||||
winnerTeamIndex: match.result.winnerTeamIndex,
|
||||
riotMatchIds: match.result.riotMatchIds,
|
||||
games: [...(match.result.games ?? [])].sort(
|
||||
(left, right) => left.gameNumber - right.gameNumber,
|
||||
@@ -476,9 +468,7 @@ export function mapApiAuctionToAuctionState(
|
||||
auctionOrder.map((player) => [player.userId, player]),
|
||||
);
|
||||
const teams = [...auction.teams].sort(
|
||||
(left, right) =>
|
||||
(left.groupIndex ?? 1) - (right.groupIndex ?? 1) ||
|
||||
(left.side === "blue" ? -1 : 1),
|
||||
(left, right) => left.teamIndex - right.teamIndex,
|
||||
);
|
||||
|
||||
const totalPlayers = auctionOrder.length;
|
||||
@@ -510,16 +500,14 @@ export function mapApiAuctionToAuctionState(
|
||||
totalPlayers,
|
||||
auctionOrder,
|
||||
bids: auction.bids.map((bid) => ({
|
||||
side: bid.side,
|
||||
groupIndex: bid.groupIndex ?? 1,
|
||||
teamIndex: bid.teamIndex,
|
||||
amount: bid.amount,
|
||||
timestamp: bid.timestamp,
|
||||
})),
|
||||
currentBid: auction.currentBid,
|
||||
currentBidder: auction.currentBidder
|
||||
currentBidder: auction.currentBidderTeamIndex
|
||||
? {
|
||||
side: auction.currentBidder,
|
||||
groupIndex: auction.currentBidderGroupIndex ?? 1,
|
||||
teamIndex: auction.currentBidderTeamIndex,
|
||||
}
|
||||
: null,
|
||||
timer,
|
||||
|
||||
+35
-27
@@ -117,8 +117,8 @@ export type TournamentCodeSlotState = TournamentCodeState | 'pending';
|
||||
|
||||
export interface TournamentCodeSlotView {
|
||||
gameNumber: number;
|
||||
blueGroupIndex: number;
|
||||
redGroupIndex: number;
|
||||
teamAIndex: number;
|
||||
teamBIndex: number;
|
||||
code: string | null;
|
||||
expiresAt: string | null;
|
||||
state: TournamentCodeSlotState;
|
||||
@@ -144,8 +144,7 @@ export interface ApiMatchTeamMember {
|
||||
}
|
||||
|
||||
export interface ApiMatchTeam {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
name: string;
|
||||
captainUserId?: string;
|
||||
members: ApiMatchTeamMember[];
|
||||
@@ -153,6 +152,7 @@ export interface ApiMatchTeam {
|
||||
|
||||
export interface ApiMatchGameResultParticipant {
|
||||
userId: string;
|
||||
teamIndex: number;
|
||||
side: TeamSide;
|
||||
championId: number;
|
||||
kills: number;
|
||||
@@ -164,27 +164,26 @@ export interface ApiMatchGameResultParticipant {
|
||||
export interface ApiMatchGameResult {
|
||||
gameNumber: number;
|
||||
riotMatchId: string;
|
||||
blueTeamIndex: number;
|
||||
redTeamIndex: number;
|
||||
winnerTeamIndex: number;
|
||||
winnerSide: TeamSide;
|
||||
blueGroupIndex: number;
|
||||
redGroupIndex: number;
|
||||
gameCreation: number;
|
||||
gameDuration: number;
|
||||
participants: ApiMatchGameResultParticipant[];
|
||||
}
|
||||
|
||||
export interface ApiMatchResult {
|
||||
winnerSide?: TeamSide;
|
||||
blueScore: number;
|
||||
redScore: number;
|
||||
winnerTeamIndex?: number;
|
||||
mvpUserId?: string;
|
||||
riotMatchIds: string[];
|
||||
games: ApiMatchGameResult[];
|
||||
seriesResults?: Array<{
|
||||
blueGroupIndex: number;
|
||||
redGroupIndex: number;
|
||||
blueScore: number;
|
||||
redScore: number;
|
||||
winnerSide?: TeamSide;
|
||||
teamAIndex: number;
|
||||
teamBIndex: number;
|
||||
teamAWins: number;
|
||||
teamBWins: number;
|
||||
winnerTeamIndex?: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
@@ -236,16 +235,14 @@ export interface ApiAuctionTeamMember {
|
||||
}
|
||||
|
||||
export interface ApiAuctionTeam {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
captainUserId: string;
|
||||
points: number;
|
||||
members: ApiAuctionTeamMember[];
|
||||
}
|
||||
|
||||
export interface ApiAuctionBid {
|
||||
side: TeamSide;
|
||||
groupIndex?: number;
|
||||
teamIndex: number;
|
||||
amount: number;
|
||||
bidderUserId: string;
|
||||
timestamp: string;
|
||||
@@ -260,8 +257,7 @@ export interface ApiAuction {
|
||||
currentIndex: number;
|
||||
bids: ApiAuctionBid[];
|
||||
currentBid: number;
|
||||
currentBidder?: TeamSide;
|
||||
currentBidderGroupIndex?: number;
|
||||
currentBidderTeamIndex?: number;
|
||||
maxTimerSeconds: number;
|
||||
currentDeadline?: string;
|
||||
initialPoints: number;
|
||||
@@ -520,17 +516,25 @@ export interface ApiInternalMatchCard {
|
||||
scheduledAt: string;
|
||||
status: 'finished' | 'in-progress';
|
||||
gameCount: number;
|
||||
blueScore: number;
|
||||
redScore: number;
|
||||
winnerSide?: TeamSide;
|
||||
winnerTeamIndex?: number;
|
||||
seriesResults: Array<{
|
||||
teamAIndex: number;
|
||||
teamBIndex: number;
|
||||
teamAWins: number;
|
||||
teamBWins: number;
|
||||
winnerTeamIndex?: number;
|
||||
}>;
|
||||
games: Array<{
|
||||
gameNumber: number;
|
||||
riotMatchId: string | null;
|
||||
blueTeamIndex: number;
|
||||
redTeamIndex: number;
|
||||
winnerTeamIndex: number | null;
|
||||
winnerSide: TeamSide | null;
|
||||
gameDuration: number;
|
||||
}>;
|
||||
teams: Array<{
|
||||
side: TeamSide;
|
||||
teamIndex: number;
|
||||
name: string;
|
||||
members: Array<{
|
||||
userId: string;
|
||||
@@ -605,12 +609,14 @@ export interface ApiInternalMatchDetailResponse {
|
||||
gameCreation: number;
|
||||
gameDuration: number;
|
||||
teams: Array<{
|
||||
teamIndex: number;
|
||||
side: TeamSide;
|
||||
win: boolean;
|
||||
objectives: { baron: number; dragon: number; tower: number };
|
||||
participants: Array<{
|
||||
userId: string | null;
|
||||
summonerName: string;
|
||||
teamIndex: number;
|
||||
side: TeamSide;
|
||||
teamPosition: string;
|
||||
championId: number;
|
||||
@@ -725,9 +731,11 @@ export interface LegacyMatchListItem {
|
||||
riotMatchId: string | null;
|
||||
memberCount: number;
|
||||
externalCount: number;
|
||||
blueScore: number;
|
||||
redScore: number;
|
||||
winnerSide?: TeamSide;
|
||||
teamAIndex: number;
|
||||
teamBIndex: number;
|
||||
teamAWins: number;
|
||||
teamBWins: number;
|
||||
winnerTeamIndex?: number;
|
||||
}
|
||||
|
||||
export interface LegacyMatchListResponse {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { 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 type { ApiAuction, Position, TeamSide } from './types';
|
||||
import type { ApiAuction, Position } from './types';
|
||||
|
||||
type ConnectionStatus =
|
||||
| 'idle'
|
||||
@@ -12,8 +12,7 @@ type ConnectionStatus =
|
||||
| 'error';
|
||||
|
||||
interface BidPayload {
|
||||
side: TeamSide;
|
||||
groupIndex?: number;
|
||||
teamIndex: number;
|
||||
amount: number;
|
||||
bidderUserId?: string;
|
||||
}
|
||||
|
||||
+24
-19
@@ -1,9 +1,8 @@
|
||||
import { useSyncExternalStore } from 'react';
|
||||
|
||||
export type DevCaptainSide = 'spectator' | 'blue' | 'red';
|
||||
|
||||
const AUTH_USER_ID_STORAGE_KEY = 'lolympus.authUserId';
|
||||
const DEV_CAPTAIN_SIDE_STORAGE_KEY = 'lolympus.devCaptainSide';
|
||||
const DEV_CAPTAIN_TEAM_INDEX_STORAGE_KEY = 'lolympus.devCaptainTeamIndex';
|
||||
const LEGACY_DEV_CAPTAIN_SIDE_STORAGE_KEY = 'lolympus.devCaptainSide';
|
||||
const AUTH_USER_CHANGED_EVENT = 'lolympus:auth-user-changed';
|
||||
const CAPTAIN_SIDE_CHANGED_EVENT = 'lolympus:captain-side-changed';
|
||||
|
||||
@@ -55,23 +54,29 @@ export function setAuthUserId(userId: string | null) {
|
||||
dispatchWindowEvent(AUTH_USER_CHANGED_EVENT);
|
||||
}
|
||||
|
||||
export function getDevCaptainSide(): DevCaptainSide {
|
||||
if (typeof window === 'undefined') return 'spectator';
|
||||
export function getDevCaptainTeamIndex(): number | null {
|
||||
if (typeof window === 'undefined') return null;
|
||||
|
||||
const value = window.localStorage.getItem(
|
||||
DEV_CAPTAIN_SIDE_STORAGE_KEY,
|
||||
) as DevCaptainSide | null;
|
||||
const value = window.localStorage.getItem(DEV_CAPTAIN_TEAM_INDEX_STORAGE_KEY);
|
||||
const parsed = Number(value);
|
||||
if (Number.isInteger(parsed) && parsed > 0) return parsed;
|
||||
|
||||
if (value === 'blue' || value === 'red' || value === 'spectator') {
|
||||
return value;
|
||||
}
|
||||
|
||||
return 'spectator';
|
||||
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 setDevCaptainSide(side: DevCaptainSide) {
|
||||
export function setDevCaptainTeamIndex(teamIndex: number | null) {
|
||||
if (typeof window === 'undefined') return;
|
||||
window.localStorage.setItem(DEV_CAPTAIN_SIDE_STORAGE_KEY, side);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -83,10 +88,10 @@ export function useAuthUserId(): string | null {
|
||||
);
|
||||
}
|
||||
|
||||
export function useDevCaptainSide(): DevCaptainSide {
|
||||
return useSyncExternalStore<DevCaptainSide>(
|
||||
export function useDevCaptainTeamIndex(): number | null {
|
||||
return useSyncExternalStore<number | null>(
|
||||
(callback) => subscribeToWindowChanges(CAPTAIN_SIDE_CHANGED_EVENT, callback),
|
||||
getDevCaptainSide,
|
||||
() => 'spectator',
|
||||
getDevCaptainTeamIndex,
|
||||
() => null,
|
||||
);
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import {
|
||||
import { useAuctionSocket } from '../api/useAuctionSocket';
|
||||
import {
|
||||
DEFAULT_COMMUNITY_ID,
|
||||
setDevCaptainSide,
|
||||
useDevCaptainSide,
|
||||
setDevCaptainTeamIndex,
|
||||
useDevCaptainTeamIndex,
|
||||
} from '../config';
|
||||
import { ApiError } from '../lib/api';
|
||||
import {
|
||||
@@ -19,36 +19,31 @@ import {
|
||||
championIconUrl,
|
||||
profileIconUrl,
|
||||
} from '../lib/ddragon';
|
||||
import { positionIcon, positionLabel } from '../lib/league';
|
||||
import {
|
||||
positionIcon,
|
||||
positionLabel,
|
||||
teamIndexColorClasses,
|
||||
teamIndexLabel,
|
||||
} from '../lib/league';
|
||||
import type {
|
||||
ApiAuction,
|
||||
ApiRiotLaneStats,
|
||||
Position,
|
||||
TeamSide,
|
||||
} from '../api/types';
|
||||
|
||||
type CaptainRole = {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
};
|
||||
|
||||
function formatPoints(value: number) {
|
||||
return value.toLocaleString();
|
||||
}
|
||||
|
||||
function teamLabel(side: 'blue' | 'red', groupIndex = 1) {
|
||||
const sideLabel = side === 'blue' ? '블루팀' : '레드팀';
|
||||
return groupIndex === 1 ? sideLabel : `${groupIndex}조 ${sideLabel}`;
|
||||
}
|
||||
|
||||
function isCurrentBidder(
|
||||
currentBidder: AuctionStateView['currentBidder'],
|
||||
team: Pick<AuctionStateView['teams'][number], 'side' | 'groupIndex'>,
|
||||
team: Pick<AuctionStateView['teams'][number], 'teamIndex'>,
|
||||
) {
|
||||
return (
|
||||
currentBidder?.side === team.side &&
|
||||
currentBidder.groupIndex === team.groupIndex
|
||||
);
|
||||
return currentBidder?.teamIndex === team.teamIndex;
|
||||
}
|
||||
|
||||
function getAuctionUpdatedAt(auction: ApiAuction | null | undefined) {
|
||||
@@ -231,26 +226,22 @@ function TeamPanel({
|
||||
isLeft: boolean;
|
||||
}) {
|
||||
const { data: ddragon } = useDdragonManifest();
|
||||
const borderColor =
|
||||
team.side === 'blue' ? 'border-blue-500/25' : 'border-red-500/25';
|
||||
const accentBar = team.side === 'blue' ? 'bg-blue-500' : 'bg-red-500';
|
||||
const sideColor = team.side === 'blue' ? 'text-blue-400' : 'text-red-400';
|
||||
const headerBg = team.side === 'blue' ? 'bg-blue-500/8' : 'bg-red-500/8';
|
||||
const tone = teamIndexColorClasses(team.teamIndex);
|
||||
const teamSize = team.members.length + 1;
|
||||
const isFull = teamSize >= AUCTION_MAX_TEAM_SIZE;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`border ${borderColor} bg-base-100 relative ${isActive ? 'ring-1 ring-primary/30' : ''}`}
|
||||
className={`border ${tone.border} bg-base-100 relative ${isActive ? 'ring-1 ring-primary/30' : ''}`}
|
||||
>
|
||||
<div
|
||||
className={`absolute ${isLeft ? 'left-0' : 'right-0'} top-0 bottom-0 w-0.5 ${accentBar}`}
|
||||
className={`absolute ${isLeft ? 'left-0' : 'right-0'} top-0 bottom-0 w-0.5 ${tone.bar}`}
|
||||
/>
|
||||
<div className={`${headerBg} px-3 py-2 border-b ${borderColor}`}>
|
||||
<div className={`${tone.bg} px-3 py-2 border-b ${tone.border}`}>
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<span className={`text-[11px] font-bold uppercase tracking-wide ${sideColor}`}>
|
||||
{teamLabel(team.side, team.groupIndex)}
|
||||
<span className={`text-[11px] font-bold uppercase tracking-wide ${tone.text}`}>
|
||||
{teamIndexLabel(team.teamIndex, team.name)}
|
||||
</span>
|
||||
<span className="text-[10px] text-base-content/30">
|
||||
팀장: {team.captainName}
|
||||
@@ -306,7 +297,7 @@ function TeamPanel({
|
||||
length: Math.max(0, AUCTION_MAX_TEAM_SIZE - 1 - team.members.length),
|
||||
}).map((_, index) => (
|
||||
<div
|
||||
key={`empty-${team.side}-${team.groupIndex}-${index}`}
|
||||
key={`empty-${team.teamIndex}-${index}`}
|
||||
className="px-3 py-1.5 h-[34px] flex items-center"
|
||||
>
|
||||
<div className="w-6 h-6 border border-dashed border-base-content/8 shrink-0" />
|
||||
@@ -426,12 +417,9 @@ function PlayerSpotlight({
|
||||
<div className="flex items-center gap-2">
|
||||
{state.currentBidder && (
|
||||
<span
|
||||
className={`text-[10px] font-bold uppercase ${state.currentBidder.side === 'blue' ? 'text-blue-400' : 'text-red-400'}`}
|
||||
className={`text-[10px] font-bold uppercase ${teamIndexColorClasses(state.currentBidder.teamIndex).text}`}
|
||||
>
|
||||
{teamLabel(
|
||||
state.currentBidder.side,
|
||||
state.currentBidder.groupIndex,
|
||||
)}
|
||||
{teamIndexLabel(state.currentBidder.teamIndex)}
|
||||
</span>
|
||||
)}
|
||||
<span className="text-lg font-black text-amber-400 tabular-nums">
|
||||
@@ -452,16 +440,12 @@ function BidControls({
|
||||
}: {
|
||||
state: AuctionStateView;
|
||||
captainRole: CaptainRole | null;
|
||||
onBid: (side: TeamSide, groupIndex: number, amount: number) => void;
|
||||
onBid: (teamIndex: number, amount: number) => void;
|
||||
}) {
|
||||
const [bidAmount, setBidAmount] = useState(100);
|
||||
const minBid = state.currentBid + 10;
|
||||
const activeTeam = captainRole
|
||||
? state.teams.find(
|
||||
(team) =>
|
||||
team.side === captainRole.side &&
|
||||
team.groupIndex === captainRole.groupIndex,
|
||||
)
|
||||
? state.teams.find((team) => team.teamIndex === captainRole.teamIndex)
|
||||
: null;
|
||||
const activeTeamSize = activeTeam ? activeTeam.members.length + 1 : 0;
|
||||
const isActiveTeamFull = activeTeamSize >= AUCTION_MAX_TEAM_SIZE;
|
||||
@@ -511,21 +495,19 @@ function BidControls({
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => onBid(activeTeam.side, activeTeam.groupIndex, bidAmount)}
|
||||
onClick={() => onBid(activeTeam.teamIndex, bidAmount)}
|
||||
disabled={
|
||||
isActiveTeamFull ||
|
||||
bidAmount > activeTeam.points ||
|
||||
bidAmount <= state.currentBid
|
||||
}
|
||||
className={`w-full py-2 text-xs font-bold uppercase tracking-wide border transition-colors disabled:opacity-30 disabled:cursor-not-allowed ${
|
||||
activeTeam.side === 'blue'
|
||||
? 'border-blue-500/30 bg-blue-500/10 text-blue-400 hover:bg-blue-500/20'
|
||||
: 'border-red-500/30 bg-red-500/10 text-red-400 hover:bg-red-500/20'
|
||||
`${teamIndexColorClasses(activeTeam.teamIndex).border} ${teamIndexColorClasses(activeTeam.teamIndex).bg} ${teamIndexColorClasses(activeTeam.teamIndex).text} hover:bg-base-content/5`
|
||||
}`}
|
||||
>
|
||||
{isActiveTeamFull
|
||||
? `${teamLabel(activeTeam.side, activeTeam.groupIndex)} 정원 완료 (${activeTeamSize}/${AUCTION_MAX_TEAM_SIZE})`
|
||||
: `${teamLabel(activeTeam.side, activeTeam.groupIndex)} 입찰 (${formatPoints(bidAmount)}P)`}
|
||||
? `${teamIndexLabel(activeTeam.teamIndex, activeTeam.name)} 정원 완료 (${activeTeamSize}/${AUCTION_MAX_TEAM_SIZE})`
|
||||
: `${teamIndexLabel(activeTeam.teamIndex, activeTeam.name)} 입찰 (${formatPoints(bidAmount)}P)`}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
@@ -549,11 +531,11 @@ function BidLog({ bids }: { bids: AuctionStateView['bids'] }) {
|
||||
</div>
|
||||
<div className="max-h-28 overflow-y-auto p-2 space-y-0.5">
|
||||
{bids.map((bid, index) => (
|
||||
<div key={`${bid.side}-${bid.timestamp}-${index}`} className="flex items-center gap-2 text-[11px]">
|
||||
<div key={`${bid.teamIndex}-${bid.timestamp}-${index}`} className="flex items-center gap-2 text-[11px]">
|
||||
<span
|
||||
className={`font-bold uppercase ${bid.side === 'blue' ? 'text-blue-400' : 'text-red-400'}`}
|
||||
className={`font-bold uppercase ${teamIndexColorClasses(bid.teamIndex).text}`}
|
||||
>
|
||||
{teamLabel(bid.side, bid.groupIndex)}
|
||||
{teamIndexLabel(bid.teamIndex)}
|
||||
</span>
|
||||
<span className="text-base-content/30">→</span>
|
||||
<span className="text-amber-400 tabular-nums font-semibold">
|
||||
@@ -579,8 +561,7 @@ export default function AuctionPage() {
|
||||
refetchInterval: 5000,
|
||||
});
|
||||
const socket = useAuctionSocket(id);
|
||||
const captainSide = useDevCaptainSide();
|
||||
const [captainGroupIndex, setCaptainGroupIndex] = useState(1);
|
||||
const captainTeamIndex = useDevCaptainTeamIndex();
|
||||
const [now, setNow] = useState(() => Date.now());
|
||||
const [assignedPosition, setAssignedPosition] = useState<Position>('MID');
|
||||
|
||||
@@ -594,16 +575,15 @@ export default function AuctionPage() {
|
||||
liveAuction && matchQuery.data
|
||||
? mapApiAuctionToAuctionState(liveAuction, matchQuery.data, new Date(now))
|
||||
: null;
|
||||
const availableGroups = useMemo(() => {
|
||||
const groups = new Set((auctionState?.teams ?? []).map((team) => team.groupIndex));
|
||||
return [...groups].sort((left, right) => left - right);
|
||||
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 =
|
||||
captainSide === 'spectator'
|
||||
captainTeamIndex === null
|
||||
? null
|
||||
: {
|
||||
side: captainSide,
|
||||
groupIndex: captainGroupIndex,
|
||||
teamIndex: captainTeamIndex,
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -613,11 +593,11 @@ export default function AuctionPage() {
|
||||
}, [auctionState?.currentPlayer?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (availableGroups.length === 0) return;
|
||||
if (!availableGroups.includes(captainGroupIndex)) {
|
||||
setCaptainGroupIndex(availableGroups[0]);
|
||||
if (availableTeamIndexes.length === 0) return;
|
||||
if (captainTeamIndex !== null && !availableTeamIndexes.includes(captainTeamIndex)) {
|
||||
setDevCaptainTeamIndex(availableTeamIndexes[0]);
|
||||
}
|
||||
}, [availableGroups, captainGroupIndex]);
|
||||
}, [availableTeamIndexes, captainTeamIndex]);
|
||||
|
||||
if (!DEFAULT_COMMUNITY_ID) {
|
||||
return (
|
||||
@@ -737,31 +717,23 @@ export default function AuctionPage() {
|
||||
<span>소켓: {socket.connectionStatus}</span>
|
||||
{/* 임시 운영용: 로그인/권한 확인 없이 조작자 역할을 선택할 수 있게 열어둔다. */}
|
||||
<select
|
||||
value={captainSide}
|
||||
value={captainTeamIndex ?? 'spectator'}
|
||||
onChange={(event) =>
|
||||
setDevCaptainSide(event.target.value as 'spectator' | 'blue' | 'red')
|
||||
setDevCaptainTeamIndex(
|
||||
event.target.value === 'spectator'
|
||||
? null
|
||||
: Number(event.target.value),
|
||||
)
|
||||
}
|
||||
className="border border-base-content/10 bg-transparent px-2 py-1 text-xs"
|
||||
>
|
||||
<option value="spectator">관전자</option>
|
||||
<option value="blue">블루팀장</option>
|
||||
<option value="red">레드팀장</option>
|
||||
{availableTeamIndexes.map((teamIndex) => (
|
||||
<option key={teamIndex} value={teamIndex}>
|
||||
{teamIndexLabel(teamIndex)} 팀장
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{captainSide !== 'spectator' && availableGroups.length > 1 && (
|
||||
<select
|
||||
value={captainGroupIndex}
|
||||
onChange={(event) =>
|
||||
setCaptainGroupIndex(Number(event.target.value))
|
||||
}
|
||||
className="border border-base-content/10 bg-transparent px-2 py-1 text-xs"
|
||||
>
|
||||
{availableGroups.map((groupIndex) => (
|
||||
<option key={groupIndex} value={groupIndex}>
|
||||
{groupIndex}조
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -774,10 +746,10 @@ export default function AuctionPage() {
|
||||
<div className="grid sm:grid-cols-2 gap-4 content-start">
|
||||
{auctionState.teams.map((team) => (
|
||||
<TeamPanel
|
||||
key={`${team.side}-${team.groupIndex}`}
|
||||
key={team.teamIndex}
|
||||
team={team}
|
||||
isActive={isCurrentBidder(auctionState.currentBidder, team)}
|
||||
isLeft={team.side === 'blue'}
|
||||
isLeft={team.teamIndex % 2 === 1}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -805,15 +777,10 @@ export default function AuctionPage() {
|
||||
{auctionState.phase === 'sold' && auctionState.currentBidder && (
|
||||
<div
|
||||
className={`text-center py-3 border text-sm font-bold ${
|
||||
auctionState.currentBidder.side === 'blue'
|
||||
? 'border-blue-500/20 bg-blue-500/8 text-blue-400'
|
||||
: 'border-red-500/20 bg-red-500/8 text-red-400'
|
||||
`${teamIndexColorClasses(auctionState.currentBidder.teamIndex).border} ${teamIndexColorClasses(auctionState.currentBidder.teamIndex).bg} ${teamIndexColorClasses(auctionState.currentBidder.teamIndex).text}`
|
||||
}`}
|
||||
>
|
||||
{teamLabel(
|
||||
auctionState.currentBidder.side,
|
||||
auctionState.currentBidder.groupIndex,
|
||||
)} 낙찰
|
||||
{teamIndexLabel(auctionState.currentBidder.teamIndex)} 낙찰
|
||||
{' '}— {formatPoints(auctionState.currentBid)}P
|
||||
</div>
|
||||
)}
|
||||
@@ -821,8 +788,8 @@ export default function AuctionPage() {
|
||||
<BidControls
|
||||
state={auctionState}
|
||||
captainRole={captainRole}
|
||||
onBid={(side, groupIndex, amount) =>
|
||||
socket.placeBid({ side, groupIndex, amount })
|
||||
onBid={(teamIndex, amount) =>
|
||||
socket.placeBid({ teamIndex, amount })
|
||||
}
|
||||
/>
|
||||
<BidLog bids={auctionState.bids} />
|
||||
|
||||
@@ -14,6 +14,7 @@ import type {
|
||||
} from '../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import { championDisplayName, championIconUrl, profileIconUrl } from '../lib/ddragon';
|
||||
import { sideShortLabel, teamIndexColorClasses, teamIndexLabel } from '../lib/league';
|
||||
|
||||
function formatDateTime(value: string) {
|
||||
return new Intl.DateTimeFormat('ko-KR', {
|
||||
@@ -31,7 +32,7 @@ function formatDuration(seconds: number) {
|
||||
}
|
||||
|
||||
function sideLabel(side: TeamSide) {
|
||||
return side === 'blue' ? '블루팀' : '레드팀';
|
||||
return sideShortLabel(side);
|
||||
}
|
||||
|
||||
function sideText(side: TeamSide) {
|
||||
@@ -70,6 +71,13 @@ function MatchCard({
|
||||
match: ApiInternalMatchCard;
|
||||
manifest: ReturnType<typeof useDdragonManifest>['data'];
|
||||
}) {
|
||||
const primarySeries = match.seriesResults[0];
|
||||
const teamName = (teamIndex: number) =>
|
||||
teamIndexLabel(
|
||||
teamIndex,
|
||||
match.teams.find((team) => team.teamIndex === teamIndex)?.name,
|
||||
);
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={`/communities/${DEFAULT_COMMUNITY_ID}/internal-stats/match/${match.matchId}`}
|
||||
@@ -91,9 +99,9 @@ function MatchCard({
|
||||
className="inline-flex items-center gap-1 border border-base-content/10 px-2 py-1 text-[10px] text-base-content/45"
|
||||
>
|
||||
{game.gameNumber}경기
|
||||
{game.winnerSide ? (
|
||||
{game.winnerSide && game.winnerTeamIndex ? (
|
||||
<span className={sideText(game.winnerSide)}>
|
||||
{sideLabel(game.winnerSide)} 승
|
||||
{teamName(game.winnerTeamIndex)} 승 ({sideLabel(game.winnerSide)})
|
||||
</span>
|
||||
) : (
|
||||
'대기'
|
||||
@@ -105,26 +113,32 @@ function MatchCard({
|
||||
</div>
|
||||
|
||||
<div className="text-center px-8">
|
||||
<div className="flex items-center justify-center gap-5">
|
||||
<div className={match.winnerSide === 'blue' ? 'text-blue-400' : 'text-blue-400/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{match.blueScore}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">BLUE</div>
|
||||
{primarySeries && (
|
||||
<div className="flex items-center justify-center gap-5">
|
||||
<div className={primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : 'text-base-content/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{primarySeries.teamAWins}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">
|
||||
{teamName(primarySeries.teamAIndex)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/15 text-xs font-black">VS</div>
|
||||
<div className={primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : 'text-base-content/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{primarySeries.teamBWins}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">
|
||||
{teamName(primarySeries.teamBIndex)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/15 text-xs font-black">VS</div>
|
||||
<div className={match.winnerSide === 'red' ? 'text-red-400' : 'text-red-400/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{match.redScore}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">RED</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="grid sm:grid-cols-2 gap-2">
|
||||
{match.teams.map((team) => (
|
||||
<div
|
||||
key={team.side}
|
||||
className={`border ${team.side === 'blue' ? 'border-blue-500/15' : 'border-red-500/15'} p-2`}
|
||||
key={team.teamIndex}
|
||||
className={`border ${teamIndexColorClasses(team.teamIndex).border} p-2`}
|
||||
>
|
||||
<div className={`text-[10px] font-black uppercase tracking-wider ${sideText(team.side)}`}>
|
||||
<div className={`text-[10px] font-black uppercase tracking-wider ${teamIndexColorClasses(team.teamIndex).text}`}>
|
||||
{team.name}
|
||||
</div>
|
||||
<div className="mt-2 space-y-1">
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useDdragonManifest, useInternalMatchDetail } from '../api/hooks';
|
||||
import type { ApiInternalMatchDetailResponse, TeamSide } from '../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import { championDisplayName, championIconUrl, itemIconUrl } from '../lib/ddragon';
|
||||
import { sideShortLabel, teamIndexColorClasses, teamIndexLabel } from '../lib/league';
|
||||
import { LANE_LABELS } from '../lib/riot-history';
|
||||
|
||||
function formatDateTime(value: string | number) {
|
||||
@@ -21,7 +22,7 @@ function formatDuration(seconds: number) {
|
||||
}
|
||||
|
||||
function sideLabel(side: TeamSide) {
|
||||
return side === 'blue' ? '블루팀' : '레드팀';
|
||||
return sideShortLabel(side);
|
||||
}
|
||||
|
||||
function sideClass(side: TeamSide) {
|
||||
@@ -100,7 +101,8 @@ function GamePanel({
|
||||
team.win ? 'bg-base-content/5' : 'opacity-40'
|
||||
}`}
|
||||
>
|
||||
{sideLabel(team.side)} {team.win ? '승' : '패'}
|
||||
{teamIndexLabel(team.teamIndex)} ({sideLabel(team.side)}){' '}
|
||||
{team.win ? '승' : '패'}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
@@ -109,7 +111,7 @@ function GamePanel({
|
||||
{game.teams.map((team) => (
|
||||
<div key={team.side} className="border-b border-base-content/8 last:border-b-0">
|
||||
<div className={`px-4 py-2 text-[11px] font-black uppercase tracking-wider ${sideClass(team.side)}`}>
|
||||
{sideLabel(team.side)} · 바론 {team.objectives.baron} · 드래곤{' '}
|
||||
{teamIndexLabel(team.teamIndex)} ({sideLabel(team.side)}) · 바론 {team.objectives.baron} · 드래곤{' '}
|
||||
{team.objectives.dragon} · 타워 {team.objectives.tower}
|
||||
</div>
|
||||
<div className="overflow-x-auto">
|
||||
@@ -219,6 +221,13 @@ export default function InternalMatchDetailPage() {
|
||||
);
|
||||
}
|
||||
|
||||
const primarySeries = detail.match.seriesResults[0];
|
||||
const teamName = (teamIndex: number) =>
|
||||
teamIndexLabel(
|
||||
teamIndex,
|
||||
detail.match.teams.find((team) => team.teamIndex === teamIndex)?.name,
|
||||
);
|
||||
|
||||
return (
|
||||
<main className="max-w-6xl mx-auto px-4 sm:px-6 py-6">
|
||||
<Link
|
||||
@@ -238,17 +247,23 @@ export default function InternalMatchDetailPage() {
|
||||
{formatDateTime(detail.match.scheduledAt)} · {detail.match.gameCount}전제
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center gap-6">
|
||||
<div className={detail.match.winnerSide === 'blue' ? 'text-blue-400' : 'text-blue-400/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{detail.match.blueScore}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">BLUE</div>
|
||||
{primarySeries && (
|
||||
<div className="flex items-center gap-6">
|
||||
<div className={primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : 'text-base-content/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{primarySeries.teamAWins}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">
|
||||
{teamName(primarySeries.teamAIndex)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/15 text-xs font-black">VS</div>
|
||||
<div className={primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : 'text-base-content/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{primarySeries.teamBWins}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">
|
||||
{teamName(primarySeries.teamBIndex)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/15 text-xs font-black">VS</div>
|
||||
<div className={detail.match.winnerSide === 'red' ? 'text-red-400' : 'text-red-400/30'}>
|
||||
<div className="text-4xl font-black tabular-nums">{detail.match.redScore}</div>
|
||||
<div className="text-[10px] font-bold uppercase tracking-wider">RED</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -21,7 +21,13 @@ import {
|
||||
import { DEFAULT_COMMUNITY_ID, useAuthUserId } from '../config';
|
||||
import { apiFetch, ApiError } from '../lib/api';
|
||||
import { profileIconUrl } from '../lib/ddragon';
|
||||
import { positionIcon, positionLabel } from '../lib/league';
|
||||
import {
|
||||
positionIcon,
|
||||
positionLabel,
|
||||
sideShortLabel,
|
||||
teamIndexColorClasses,
|
||||
teamIndexLabel,
|
||||
} from '../lib/league';
|
||||
import type {
|
||||
ApiMatchParticipant,
|
||||
Position,
|
||||
@@ -30,17 +36,11 @@ import type {
|
||||
} from '../api/types';
|
||||
|
||||
type CaptainSelectionSlot = {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
teamIndex: number;
|
||||
};
|
||||
|
||||
function captainSlotKey(slot: CaptainSelectionSlot) {
|
||||
return `${slot.side}:${slot.groupIndex}`;
|
||||
}
|
||||
|
||||
function teamLabel(side: TeamSide, groupIndex = 1) {
|
||||
const sideText = side === 'blue' ? '블루팀' : '레드팀';
|
||||
return groupIndex === 1 ? sideText : `${groupIndex}조 ${sideText}`;
|
||||
return String(slot.teamIndex);
|
||||
}
|
||||
|
||||
function buildAuctionParticipantPool(participants: ApiMatchParticipant[]) {
|
||||
@@ -55,13 +55,10 @@ function buildAuctionParticipantPool(participants: ApiMatchParticipant[]) {
|
||||
function buildCaptainSlots(
|
||||
participants: ApiMatchParticipant[],
|
||||
): CaptainSelectionSlot[] {
|
||||
const groupCount = Math.floor(buildAuctionParticipantPool(participants).length / 10);
|
||||
return Array.from({ length: groupCount }, (_, index) => index + 1).flatMap(
|
||||
(groupIndex) => [
|
||||
{ side: 'blue' as const, groupIndex },
|
||||
{ side: 'red' as const, groupIndex },
|
||||
],
|
||||
);
|
||||
const teamCount = Math.floor(buildAuctionParticipantPool(participants).length / 5);
|
||||
return Array.from({ length: teamCount }, (_, index) => ({
|
||||
teamIndex: index + 1,
|
||||
}));
|
||||
}
|
||||
|
||||
function PosBadge({ pos, sub }: { pos: Position; sub?: boolean }) {
|
||||
@@ -267,20 +264,16 @@ function TeamCard({
|
||||
matchId: string;
|
||||
isWinner?: boolean;
|
||||
}) {
|
||||
const borderColor =
|
||||
team.side === 'blue' ? 'border-blue-500/25' : 'border-red-500/25';
|
||||
const headerBg = team.side === 'blue' ? 'bg-blue-500/8' : 'bg-red-500/8';
|
||||
const sideColor = team.side === 'blue' ? 'text-blue-400' : 'text-red-400';
|
||||
const accentBar = team.side === 'blue' ? 'bg-blue-500' : 'bg-red-500';
|
||||
const tone = teamIndexColorClasses(team.teamIndex);
|
||||
|
||||
return (
|
||||
<div className={`border ${borderColor} overflow-hidden bg-base-100 relative`}>
|
||||
<div className={`absolute left-0 top-0 bottom-0 w-0.5 ${accentBar}`} />
|
||||
<div className={`border ${tone.border} overflow-hidden bg-base-100 relative`}>
|
||||
<div className={`absolute left-0 top-0 bottom-0 w-0.5 ${tone.bar}`} />
|
||||
<div
|
||||
className={`${headerBg} px-4 py-2 flex items-center justify-between border-b ${borderColor}`}
|
||||
className={`${tone.bg} px-4 py-2 flex items-center justify-between border-b ${tone.border}`}
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<span className={`text-xs font-bold uppercase tracking-wide ${sideColor}`}>
|
||||
<span className={`text-xs font-bold uppercase tracking-wide ${tone.text}`}>
|
||||
{team.name}
|
||||
</span>
|
||||
{isWinner && (
|
||||
@@ -290,7 +283,7 @@ function TeamCard({
|
||||
)}
|
||||
</div>
|
||||
<Link
|
||||
to={`/match/${matchId}/team/${team.side}/${team.groupIndex}`}
|
||||
to={`/match/${matchId}/team/${team.teamIndex}`}
|
||||
className="text-[10px] font-bold text-base-content/35 hover:text-primary"
|
||||
>
|
||||
진행 페이지
|
||||
@@ -414,9 +407,9 @@ function TournamentCodeList({ slots }: { slots: TournamentCodeSlotView[] }) {
|
||||
<div key={slot.gameNumber} className="flex items-start gap-2">
|
||||
<span className="text-[11px] font-bold text-base-content/40 w-20 shrink-0 pt-1.5">
|
||||
{slot.gameNumber}경기
|
||||
{(slot.blueGroupIndex > 1 || slot.redGroupIndex > 1) && (
|
||||
{(slot.teamAIndex > 1 || slot.teamBIndex > 2) && (
|
||||
<span className="block text-[10px] font-normal text-base-content/25">
|
||||
{slot.blueGroupIndex}조
|
||||
{teamIndexLabel(slot.teamAIndex)} vs {teamIndexLabel(slot.teamBIndex)}
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
@@ -461,14 +454,19 @@ function formatGameDuration(seconds: number) {
|
||||
return `${minutes}:${String(rest).padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
function resultSideLabel(side: 'blue' | 'red', groupIndex = 1) {
|
||||
return teamLabel(side, groupIndex);
|
||||
}
|
||||
|
||||
function resultSideClass(side: 'blue' | 'red') {
|
||||
return side === 'blue' ? 'text-blue-400' : 'text-red-400';
|
||||
}
|
||||
|
||||
function resultSideLabel(side: TeamSide) {
|
||||
return sideShortLabel(side);
|
||||
}
|
||||
|
||||
function resolveMatchTeamName(match: MatchDetailView, teamIndex: number) {
|
||||
const team = match.teams.find((item) => item.teamIndex === teamIndex);
|
||||
return teamIndexLabel(teamIndex, team?.name);
|
||||
}
|
||||
|
||||
function MatchResultPanel({ match }: { match: MatchDetailView }) {
|
||||
if (!match.result) return null;
|
||||
|
||||
@@ -485,34 +483,37 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
|
||||
(_, index) => index + 1,
|
||||
);
|
||||
const seriesResults = match.result.seriesResults ?? [];
|
||||
const primarySeries = seriesResults[0];
|
||||
|
||||
return (
|
||||
<div className="mb-6 border border-base-content/10 bg-base-content/[0.02] p-5">
|
||||
<div className="flex items-center justify-center gap-8">
|
||||
<div
|
||||
className={`text-center ${match.result.winnerSide === 'blue' ? 'text-blue-400' : 'text-blue-400/30'}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{match.result.blueScore}
|
||||
{primarySeries && (
|
||||
<div className="flex items-center justify-center gap-8">
|
||||
<div
|
||||
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamAIndex ? teamIndexColorClasses(primarySeries.teamAIndex).text : 'text-base-content/30'}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{primarySeries.teamAWins}
|
||||
</div>
|
||||
<div className="text-[10px] uppercase tracking-wider mt-0.5 font-semibold">
|
||||
{resolveMatchTeamName(match, primarySeries.teamAIndex)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-[10px] uppercase tracking-wider mt-0.5 font-semibold">
|
||||
블루팀
|
||||
<div className="text-base-content/20 text-xs font-bold uppercase tracking-widest">
|
||||
VS
|
||||
</div>
|
||||
<div
|
||||
className={`text-center ${primarySeries.winnerTeamIndex === primarySeries.teamBIndex ? teamIndexColorClasses(primarySeries.teamBIndex).text : 'text-base-content/30'}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{primarySeries.teamBWins}
|
||||
</div>
|
||||
<div className="text-[10px] uppercase tracking-wider mt-0.5 font-semibold">
|
||||
{resolveMatchTeamName(match, primarySeries.teamBIndex)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="text-base-content/20 text-xs font-bold uppercase tracking-widest">
|
||||
VS
|
||||
</div>
|
||||
<div
|
||||
className={`text-center ${match.result.winnerSide === 'red' ? 'text-red-400' : 'text-red-400/30'}`}
|
||||
>
|
||||
<div className="text-3xl font-black tabular-nums">
|
||||
{match.result.redScore}
|
||||
</div>
|
||||
<div className="text-[10px] uppercase tracking-wider mt-0.5 font-semibold">
|
||||
레드팀
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="text-center mt-3 text-[11px] font-bold text-amber-400 uppercase tracking-wide">
|
||||
{match.result.winner
|
||||
? `${match.result.winner} 승리`
|
||||
@@ -522,16 +523,21 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
|
||||
<div className="mt-4 grid sm:grid-cols-2 gap-2">
|
||||
{seriesResults.map((series) => (
|
||||
<div
|
||||
key={`${series.blueGroupIndex}-${series.redGroupIndex}`}
|
||||
key={`${series.teamAIndex}-${series.teamBIndex}`}
|
||||
className="border border-base-content/8 bg-base-100 px-3 py-2 text-xs"
|
||||
>
|
||||
<div className="font-bold text-base-content/55">
|
||||
{series.blueGroupIndex}조
|
||||
{resolveMatchTeamName(match, series.teamAIndex)} vs{' '}
|
||||
{resolveMatchTeamName(match, series.teamBIndex)}
|
||||
</div>
|
||||
<div className="mt-1 flex items-center justify-between">
|
||||
<span className="text-blue-400">블루 {series.blueScore}</span>
|
||||
<span className={teamIndexColorClasses(series.teamAIndex).text}>
|
||||
{series.teamAWins}
|
||||
</span>
|
||||
<span className="text-base-content/20">:</span>
|
||||
<span className="text-red-400">레드 {series.redScore}</span>
|
||||
<span className={teamIndexColorClasses(series.teamBIndex).text}>
|
||||
{series.teamBWins}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
@@ -540,10 +546,6 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
|
||||
<div className="mt-5 border border-base-content/8 divide-y divide-base-content/8">
|
||||
{gameNumbers.map((gameNumber) => {
|
||||
const game = gamesByNumber.get(gameNumber);
|
||||
const winnerGroupIndex =
|
||||
game?.winnerSide === 'blue'
|
||||
? game.blueGroupIndex
|
||||
: game?.redGroupIndex;
|
||||
return (
|
||||
<div
|
||||
key={gameNumber}
|
||||
@@ -555,7 +557,10 @@ function MatchResultPanel({ match }: { match: MatchDetailView }) {
|
||||
{game ? (
|
||||
<div>
|
||||
<span className={`font-black ${resultSideClass(game.winnerSide)}`}>
|
||||
{resultSideLabel(game.winnerSide, winnerGroupIndex)} 승
|
||||
{resolveMatchTeamName(match, game.winnerTeamIndex)} 승
|
||||
</span>
|
||||
<span className="ml-1 text-base-content/35">
|
||||
({resultSideLabel(game.winnerSide)} 진영)
|
||||
</span>
|
||||
<span className="ml-2 text-base-content/35 font-mono">
|
||||
{game.riotMatchId}
|
||||
@@ -625,8 +630,7 @@ export default function MatchDetailPage() {
|
||||
body: JSON.stringify({
|
||||
captains: buildCaptainSlots(matchQuery.data?.participants ?? []).map(
|
||||
(slot) => ({
|
||||
side: slot.side,
|
||||
groupIndex: slot.groupIndex,
|
||||
teamIndex: slot.teamIndex,
|
||||
userId: captainSelections[captainSlotKey(slot)],
|
||||
}),
|
||||
),
|
||||
@@ -851,7 +855,7 @@ export default function MatchDetailPage() {
|
||||
경매 시작
|
||||
</h3>
|
||||
<p className="mt-1 text-xs text-base-content/40">
|
||||
참가 신청 순서 기준 10명당 1개 조가 만들어지고, 각 조에 블루/레드 팀장을 지정합니다.
|
||||
참가 신청 순서 기준 5명당 1개 팀이 만들어지고, 각 팀의 팀장을 지정합니다.
|
||||
</p>
|
||||
{waitingParticipantCount > 0 && (
|
||||
<p className="mt-1 text-[11px] text-amber-500">
|
||||
@@ -876,7 +880,7 @@ export default function MatchDetailPage() {
|
||||
key={key}
|
||||
className="text-xs text-base-content/45"
|
||||
>
|
||||
{teamLabel(slot.side, slot.groupIndex)} 팀장
|
||||
{teamIndexLabel(slot.teamIndex)} 팀장
|
||||
<select
|
||||
className="mt-1 w-full border border-base-content/10 bg-transparent px-2 py-2 text-sm"
|
||||
value={currentValue}
|
||||
@@ -938,12 +942,12 @@ export default function MatchDetailPage() {
|
||||
<div className="space-y-4">
|
||||
{match.teams.map((team) => (
|
||||
<TeamCard
|
||||
key={`${team.side}-${team.groupIndex}`}
|
||||
key={team.teamIndex}
|
||||
team={team}
|
||||
matchId={match.id}
|
||||
isWinner={
|
||||
match.status === 'finished'
|
||||
? match.result?.winner === team.name
|
||||
? match.result?.winnerTeamIndex === team.teamIndex
|
||||
: undefined
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { Link, useParams } from 'react-router';
|
||||
import { useDdragonManifest, useMatch } from '../api/hooks';
|
||||
import type { ApiMatchParticipant, Position, TeamSide } from '../api/types';
|
||||
import type { ApiMatchParticipant, Position } from '../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../config';
|
||||
import { profileIconUrl } from '../lib/ddragon';
|
||||
import { positionLabel } from '../lib/league';
|
||||
|
||||
function teamLabel(side: TeamSide, groupIndex = 1) {
|
||||
const sideText = side === 'blue' ? '블루팀' : '레드팀';
|
||||
return groupIndex === 1 ? sideText : `${groupIndex}조 ${sideText}`;
|
||||
}
|
||||
import { positionLabel, sideShortLabel, teamIndexLabel } from '../lib/league';
|
||||
|
||||
function formatExpiry(value: string | null) {
|
||||
if (!value) return '-';
|
||||
@@ -64,9 +59,8 @@ function ParticipantLine({
|
||||
}
|
||||
|
||||
export default function MatchTeamProgressPage() {
|
||||
const { id, side, groupIndex } = useParams();
|
||||
const parsedGroupIndex = Number(groupIndex ?? 1);
|
||||
const teamSide = side === 'blue' || side === 'red' ? side : null;
|
||||
const { id, teamIndex } = useParams();
|
||||
const parsedTeamIndex = Number(teamIndex);
|
||||
const matchQuery = useMatch(id, DEFAULT_COMMUNITY_ID);
|
||||
|
||||
if (!DEFAULT_COMMUNITY_ID) {
|
||||
@@ -85,7 +79,7 @@ export default function MatchTeamProgressPage() {
|
||||
);
|
||||
}
|
||||
|
||||
if (!teamSide || !matchQuery.data) {
|
||||
if (!Number.isInteger(parsedTeamIndex) || parsedTeamIndex < 1 || !matchQuery.data) {
|
||||
return (
|
||||
<main className="mx-auto max-w-5xl px-4 py-20 text-center">
|
||||
<h1 className="text-lg font-bold">팀 정보를 찾을 수 없습니다</h1>
|
||||
@@ -97,22 +91,15 @@ export default function MatchTeamProgressPage() {
|
||||
}
|
||||
|
||||
const match = matchQuery.data;
|
||||
const team = match.teams.find(
|
||||
(item) =>
|
||||
item.side === teamSide && (item.groupIndex ?? 1) === parsedGroupIndex,
|
||||
);
|
||||
const team = match.teams.find((item) => item.teamIndex === parsedTeamIndex);
|
||||
const participantByUserId = new Map(
|
||||
match.participants.map((participant) => [participant.userId, participant]),
|
||||
);
|
||||
const codes = (match.tournamentCodes ?? []).filter((slot) =>
|
||||
teamSide === 'blue'
|
||||
? slot.blueGroupIndex === parsedGroupIndex
|
||||
: slot.redGroupIndex === parsedGroupIndex,
|
||||
slot.teamAIndex === parsedTeamIndex || slot.teamBIndex === parsedTeamIndex,
|
||||
);
|
||||
const games = (match.result?.games ?? []).filter((game) =>
|
||||
teamSide === 'blue'
|
||||
? game.blueGroupIndex === parsedGroupIndex
|
||||
: game.redGroupIndex === parsedGroupIndex,
|
||||
game.blueTeamIndex === parsedTeamIndex || game.redTeamIndex === parsedTeamIndex,
|
||||
);
|
||||
|
||||
if (!team) {
|
||||
@@ -140,7 +127,7 @@ export default function MatchTeamProgressPage() {
|
||||
|
||||
<div className="mb-6 border-b border-base-content/8 pb-5">
|
||||
<h1 className="text-2xl font-black text-base-content">
|
||||
{team.name || teamLabel(team.side, team.groupIndex)}
|
||||
{teamIndexLabel(team.teamIndex, team.name)}
|
||||
</h1>
|
||||
<p className="mt-1 text-sm text-base-content/45">
|
||||
이 팀에 연결된 토너먼트 코드와 수집된 결과만 보여줍니다.
|
||||
@@ -212,7 +199,9 @@ export default function MatchTeamProgressPage() {
|
||||
<div className="divide-y divide-base-content/5">
|
||||
{games.length > 0 ? (
|
||||
games.map((game) => {
|
||||
const won = game.winnerSide === teamSide;
|
||||
const won = game.winnerTeamIndex === parsedTeamIndex;
|
||||
const side =
|
||||
game.blueTeamIndex === parsedTeamIndex ? 'blue' : 'red';
|
||||
return (
|
||||
<div key={game.gameNumber} className="px-4 py-3 text-xs">
|
||||
<div className="flex items-center justify-between gap-2">
|
||||
@@ -225,6 +214,9 @@ export default function MatchTeamProgressPage() {
|
||||
{won ? '승리' : '패배'}
|
||||
</span>
|
||||
</div>
|
||||
<div className="mt-1 text-[11px] text-base-content/35">
|
||||
{sideShortLabel(side)} 진영
|
||||
</div>
|
||||
<div className="mt-1 truncate font-mono text-[11px] text-base-content/30">
|
||||
{game.riotMatchId}
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from '../../api/hooks';
|
||||
import type { LegacyMatchListItem } from '../../api/types';
|
||||
import { DEFAULT_COMMUNITY_ID } from '../../config';
|
||||
import { teamIndexLabel } from '../../lib/league';
|
||||
|
||||
function formatDate(value: string) {
|
||||
return new Intl.DateTimeFormat('ko-KR', {
|
||||
@@ -22,10 +23,16 @@ function formatDate(value: string) {
|
||||
}
|
||||
|
||||
function resultLabel(match: LegacyMatchListItem) {
|
||||
if (!match.winnerSide) return '-';
|
||||
return match.winnerSide === 'blue'
|
||||
? `블루 ${match.blueScore}:${match.redScore}`
|
||||
: `레드 ${match.redScore}:${match.blueScore}`;
|
||||
if (!match.winnerTeamIndex) return '-';
|
||||
const winnerScore =
|
||||
match.winnerTeamIndex === match.teamAIndex
|
||||
? match.teamAWins
|
||||
: match.teamBWins;
|
||||
const loserScore =
|
||||
match.winnerTeamIndex === match.teamAIndex
|
||||
? match.teamBWins
|
||||
: match.teamAWins;
|
||||
return `${teamIndexLabel(match.winnerTeamIndex)} ${winnerScore}:${loserScore}`;
|
||||
}
|
||||
|
||||
export default function LegacyMatchesPage() {
|
||||
|
||||
Reference in new issue
Block a user