diff --git a/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx b/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx index f635335ea..51a18bdef 100644 --- a/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx +++ b/app/features/tournament-bracket/components/Bracket/PlacementsTable.tsx @@ -196,10 +196,10 @@ export function PlacementsTable({ const key = () => { if (overridenDestinationBracket === null) { - return "null"; + return `${s.team.id}-null`; } - return overridenDestinationBracket?.idx; + return `${s.team.id}-${overridenDestinationBracket?.idx}`; }; const renderQualifiedRow = diff --git a/app/features/tournament-bracket/routes/to.$id.matches.$mid.test.ts b/app/features/tournament-bracket/routes/to.$id.matches.$mid.test.ts index 89231ae60..a71f1ef76 100644 --- a/app/features/tournament-bracket/routes/to.$id.matches.$mid.test.ts +++ b/app/features/tournament-bracket/routes/to.$id.matches.$mid.test.ts @@ -1,5 +1,5 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest"; -import type { adminActionSchema } from "~/features/tournament/actions/to.$id.admin.server"; +import type { adminActionSchema } from "~/features/tournament/tournament-schemas.server"; import { dbInsertTournament, dbInsertTournamentTeam, diff --git a/app/features/tournament-bracket/tournament-bracket.css b/app/features/tournament-bracket/tournament-bracket.css index 04c8516bc..5064a351d 100644 --- a/app/features/tournament-bracket/tournament-bracket.css +++ b/app/features/tournament-bracket/tournament-bracket.css @@ -509,7 +509,8 @@ } .tournament-bracket__compactify-button svg { - width: 0.85rem; + min-width: 0.85rem; + max-width: 0.85rem; } .tournament-bracket__cast-info-container { diff --git a/app/features/tournament/actions/to.$id.admin.server.ts b/app/features/tournament/actions/to.$id.admin.server.ts index 7c0052c6d..a8f00ab56 100644 --- a/app/features/tournament/actions/to.$id.admin.server.ts +++ b/app/features/tournament/actions/to.$id.admin.server.ts @@ -1,8 +1,6 @@ import type { ActionFunction } from "@remix-run/node"; -import { z } from "zod/v4"; import { requireUser } from "~/features/auth/core/user.server"; import { userIsBanned } from "~/features/ban/core/banned.server"; -import { bracketProgressionSchema } from "~/features/calendar/calendar-schemas"; import * as ShowcaseTournaments from "~/features/front-page/core/ShowcaseTournaments.server"; import { notify } from "~/features/notifications/core/notify.server"; import * as TournamentTeamRepository from "~/features/tournament/TournamentTeamRepository.server"; @@ -11,7 +9,6 @@ import { clearTournamentDataCache, tournamentFromDB, } from "~/features/tournament-bracket/core/Tournament.server"; -import { USER } from "~/features/user-page/user-page-constants"; import invariant from "~/utils/invariant"; import { logger } from "~/utils/logger"; import { @@ -22,13 +19,12 @@ import { successToast, } from "~/utils/remix.server"; import { assertUnreachable } from "~/utils/types"; -import { _action, id, idObject } from "../../../utils/zod"; -import { bracketIdx } from "../../tournament-bracket/tournament-bracket-schemas.server"; +import { idObject } from "../../../utils/zod"; import { changeTeamOwner } from "../queries/changeTeamOwner.server"; import { deleteTeam } from "../queries/deleteTeam.server"; import { joinTeam, leaveTeam } from "../queries/joinLeaveTeam.server"; import * as TournamentRepository from "../TournamentRepository.server"; -import { teamName } from "../tournament-schemas.server"; +import { adminActionSchema } from "../tournament-schemas.server"; import { inGameNameIfNeeded } from "../tournament-utils.server"; export const action: ActionFunction = async ({ request, params }) => { @@ -458,95 +454,3 @@ export const action: ActionFunction = async ({ request, params }) => { return successToast(message); }; - -export const adminActionSchema = z.union([ - z.object({ - _action: _action("CHANGE_TEAM_OWNER"), - teamId: id, - memberId: id, - }), - z.object({ - _action: _action("CHANGE_TEAM_NAME"), - teamId: id, - teamName, - }), - z.object({ - _action: _action("CHECK_IN"), - teamId: id, - bracketIdx, - }), - z.object({ - _action: _action("CHECK_OUT"), - teamId: id, - bracketIdx, - }), - z.object({ - _action: _action("ADD_MEMBER"), - teamId: id, - userId: id, - }), - z.object({ - _action: _action("REMOVE_MEMBER"), - teamId: id, - memberId: id, - }), - z.object({ - _action: _action("DELETE_TEAM"), - teamId: id, - }), - z.object({ - _action: _action("ADD_TEAM"), - userId: id, - teamName, - }), - z.object({ - _action: _action("ADD_STAFF"), - userId: id, - role: z.enum(["ORGANIZER", "STREAMER"]), - }), - z.object({ - _action: _action("REMOVE_STAFF"), - userId: id, - }), - z.object({ - _action: _action("DROP_TEAM_OUT"), - teamId: id, - }), - z.object({ - _action: _action("UNDO_DROP_TEAM_OUT"), - teamId: id, - }), - z.object({ - _action: _action("DELETE_LOGO"), - teamId: id, - }), - z.object({ - _action: _action("UPDATE_CAST_TWITCH_ACCOUNTS"), - castTwitchAccounts: z.preprocess( - (val) => - typeof val === "string" - ? val - .split(",") - .map((account) => account.trim()) - .map((account) => account.toLowerCase()) - : val, - z.array(z.string()), - ), - }), - z.object({ - _action: _action("RESET_BRACKET"), - stageId: id, - }), - z.object({ - _action: _action("UPDATE_IN_GAME_NAME"), - inGameNameText: z.string().max(USER.IN_GAME_NAME_TEXT_MAX_LENGTH), - inGameNameDiscriminator: z - .string() - .refine((val) => /^[0-9a-z]{4,5}$/.test(val)), - memberId: id, - }), - z.object({ - _action: _action("UPDATE_TOURNAMENT_PROGRESSION"), - bracketProgression: bracketProgressionSchema, - }), -]); diff --git a/app/features/tournament/routes/to.$id.admin.tsx b/app/features/tournament/routes/to.$id.admin.tsx index 398946edc..9070c4945 100644 --- a/app/features/tournament/routes/to.$id.admin.tsx +++ b/app/features/tournament/routes/to.$id.admin.tsx @@ -330,7 +330,17 @@ function TeamActions() {