.
This commit is contained in:
1 parent
b152a5b0fa
commit
2379051196
32 files changed
+1682
-383
No files matched your search
+31
-24
@@ -25,6 +25,7 @@ export interface ParticipantView {
|
||||
mainPosition: Position;
|
||||
subPosition: Position;
|
||||
profileIconId: number;
|
||||
excluded?: boolean;
|
||||
}
|
||||
|
||||
export interface TeamParticipantView extends ParticipantView {
|
||||
@@ -34,6 +35,7 @@ export interface TeamParticipantView extends ParticipantView {
|
||||
|
||||
export interface TeamView {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
name: string;
|
||||
participants: TeamParticipantView[];
|
||||
}
|
||||
@@ -48,6 +50,7 @@ export interface MatchDetailView {
|
||||
map: string;
|
||||
maxParticipants: number;
|
||||
gameCount: number;
|
||||
gameMode: ApiMatch["gameMode"];
|
||||
tournamentCodes: TournamentCodeSlotView[];
|
||||
joined: boolean;
|
||||
participants: ParticipantView[];
|
||||
@@ -62,6 +65,8 @@ export interface MatchDetailView {
|
||||
gameNumber: number;
|
||||
riotMatchId: string;
|
||||
winnerSide: TeamSide;
|
||||
blueGroupIndex: number;
|
||||
redGroupIndex: number;
|
||||
gameCreation: number;
|
||||
gameDuration: number;
|
||||
participants: Array<{
|
||||
@@ -74,6 +79,7 @@ export interface MatchDetailView {
|
||||
win: boolean;
|
||||
}>;
|
||||
}>;
|
||||
seriesResults: NonNullable<ApiMatch["result"]>["seriesResults"];
|
||||
};
|
||||
prizes: string[];
|
||||
notices: string[];
|
||||
@@ -96,6 +102,7 @@ export interface AuctionPlayerView extends ParticipantView {
|
||||
|
||||
export interface AuctionTeamView {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
captainUserId: string;
|
||||
captainName: string;
|
||||
points: number;
|
||||
@@ -108,18 +115,19 @@ export interface AuctionTeamView {
|
||||
export interface AuctionStateView {
|
||||
matchId: string;
|
||||
phase: ApiAuction["phase"];
|
||||
teams: [AuctionTeamView, AuctionTeamView];
|
||||
teams: AuctionTeamView[];
|
||||
currentPlayer: AuctionPlayerView | null;
|
||||
currentPlayerIndex: number;
|
||||
totalPlayers: number;
|
||||
auctionOrder: AuctionPlayerView[];
|
||||
bids: {
|
||||
side: TeamSide;
|
||||
groupIndex: number;
|
||||
amount: number;
|
||||
timestamp: string;
|
||||
}[];
|
||||
currentBid: number;
|
||||
currentBidder: TeamSide | null;
|
||||
currentBidder: { side: TeamSide; groupIndex: number } | null;
|
||||
timer: number;
|
||||
maxTimer: number;
|
||||
deadline?: string;
|
||||
@@ -208,6 +216,7 @@ function mapMatchParticipantToView(
|
||||
mainPosition,
|
||||
subPosition,
|
||||
profileIconId: participant.profileIconId ?? 0,
|
||||
excluded: participant.excluded ?? false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -262,6 +271,7 @@ function mapAuctionTeamToView(
|
||||
): AuctionTeamView {
|
||||
return {
|
||||
side: team.side,
|
||||
groupIndex: team.groupIndex ?? 1,
|
||||
captainUserId: team.captainUserId,
|
||||
captainName:
|
||||
participantLookup.get(team.captainUserId)?.summonerName ??
|
||||
@@ -396,6 +406,7 @@ 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),
|
||||
participants: team.members.map((member) => {
|
||||
const participant =
|
||||
@@ -423,7 +434,8 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
|
||||
description: match.description,
|
||||
map: mapIdToLabel(match.mapId),
|
||||
maxParticipants: match.maxParticipants,
|
||||
gameCount: match.gameCount ?? 3,
|
||||
gameCount: match.gameCount ?? 3,
|
||||
gameMode: match.gameMode ?? "pair",
|
||||
tournamentCodes: match.tournamentCodes ?? [],
|
||||
joined: Boolean(match.joined),
|
||||
participants,
|
||||
@@ -440,6 +452,7 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView {
|
||||
games: [...(match.result.games ?? [])].sort(
|
||||
(left, right) => left.gameNumber - right.gameNumber,
|
||||
),
|
||||
seriesResults: match.result.seriesResults ?? [],
|
||||
}
|
||||
: undefined,
|
||||
prizes: match.prizes,
|
||||
@@ -462,22 +475,11 @@ export function mapApiAuctionToAuctionState(
|
||||
const auctionPlayerLookup = new Map(
|
||||
auctionOrder.map((player) => [player.userId, player]),
|
||||
);
|
||||
const blueTeam =
|
||||
auction.teams.find((team) => team.side === "blue") ??
|
||||
({
|
||||
side: "blue",
|
||||
captainUserId: "",
|
||||
points: 0,
|
||||
members: [],
|
||||
} satisfies ApiAuctionTeam);
|
||||
const redTeam =
|
||||
auction.teams.find((team) => team.side === "red") ??
|
||||
({
|
||||
side: "red",
|
||||
captainUserId: "",
|
||||
points: 0,
|
||||
members: [],
|
||||
} satisfies ApiAuctionTeam);
|
||||
const teams = [...auction.teams].sort(
|
||||
(left, right) =>
|
||||
(left.groupIndex ?? 1) - (right.groupIndex ?? 1) ||
|
||||
(left.side === "blue" ? -1 : 1),
|
||||
);
|
||||
|
||||
const totalPlayers = auctionOrder.length;
|
||||
const currentPlayer =
|
||||
@@ -500,21 +502,26 @@ export function mapApiAuctionToAuctionState(
|
||||
return {
|
||||
matchId: auction.matchId,
|
||||
phase: auction.phase,
|
||||
teams: [
|
||||
mapAuctionTeamToView(blueTeam, auctionPlayerLookup, participantLookup),
|
||||
mapAuctionTeamToView(redTeam, auctionPlayerLookup, participantLookup),
|
||||
],
|
||||
teams: teams.map((team) =>
|
||||
mapAuctionTeamToView(team, auctionPlayerLookup, participantLookup),
|
||||
),
|
||||
currentPlayer,
|
||||
currentPlayerIndex,
|
||||
totalPlayers,
|
||||
auctionOrder,
|
||||
bids: auction.bids.map((bid) => ({
|
||||
side: bid.side,
|
||||
groupIndex: bid.groupIndex ?? 1,
|
||||
amount: bid.amount,
|
||||
timestamp: bid.timestamp,
|
||||
})),
|
||||
currentBid: auction.currentBid,
|
||||
currentBidder: auction.currentBidder ?? null,
|
||||
currentBidder: auction.currentBidder
|
||||
? {
|
||||
side: auction.currentBidder,
|
||||
groupIndex: auction.currentBidderGroupIndex ?? 1,
|
||||
}
|
||||
: null,
|
||||
timer,
|
||||
maxTimer: auction.maxTimerSeconds,
|
||||
deadline: auction.currentDeadline,
|
||||
|
||||
Reference in new issue
Block a user