mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-06-02 22:26:57 -05:00
Allow locking round robin matches for cast
This commit is contained in:
parent
99f912a8e6
commit
457f747f7a
|
|
@ -1,5 +1,6 @@
|
|||
import type { ActionFunction } from "@remix-run/node";
|
||||
import { sql } from "~/db/sql";
|
||||
import { TournamentMatchStatus } from "~/db/tables";
|
||||
import { requireUser } from "~/features/auth/core/user.server";
|
||||
import * as ChatSystemMessage from "~/features/chat/ChatSystemMessage.server";
|
||||
import * as TournamentRepository from "~/features/tournament/TournamentRepository.server";
|
||||
|
|
@ -556,8 +557,8 @@ export const action: ActionFunction = async ({ params, request }) => {
|
|||
"Not an organizer or streamer",
|
||||
);
|
||||
|
||||
// can't lock, let's update their view to reflect that
|
||||
if (match.opponentOne?.id && match.opponentTwo?.id) {
|
||||
// can't lock if match status is not Locked (team(s) busy with previous match), let's update their view to reflect that
|
||||
if (match.status !== TournamentMatchStatus.Locked) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export function RoundRobinBracket({ bracket }: { bracket: BracketType }) {
|
|||
});
|
||||
|
||||
return (
|
||||
<div key={groupName} className="stack lg ml-4">
|
||||
<div key={groupName} className="stack lg ml-6">
|
||||
<h2 className="text-lg">{groupName}</h2>
|
||||
<div
|
||||
className="elim-bracket__container"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { InfoPopover } from "~/components/InfoPopover";
|
|||
import { LockIcon } from "~/components/icons/Lock";
|
||||
import { UnlockIcon } from "~/components/icons/Unlock";
|
||||
import { SubmitButton } from "~/components/SubmitButton";
|
||||
import { TournamentMatchStatus } from "~/db/tables";
|
||||
import { useUser } from "~/features/auth/core/user";
|
||||
import { useTournament } from "~/features/tournament/routes/to.$id";
|
||||
|
||||
|
|
@ -14,13 +15,13 @@ const setAsCastedInfo =
|
|||
export function CastInfo({
|
||||
matchIsOngoing,
|
||||
matchId,
|
||||
hasBothParticipants,
|
||||
matchIsOver,
|
||||
matchStatus,
|
||||
}: {
|
||||
matchIsOngoing: boolean;
|
||||
matchId: number;
|
||||
hasBothParticipants: boolean;
|
||||
matchIsOver: boolean;
|
||||
matchStatus: number;
|
||||
}) {
|
||||
const user = useUser();
|
||||
const tournament = useTournament();
|
||||
|
|
@ -36,8 +37,8 @@ export function CastInfo({
|
|||
|
||||
if (castTwitchAccounts.length === 0 || !hasPerms || matchIsOver) return null;
|
||||
|
||||
// match has to be locked beforehand, can't be done when both participants are there already
|
||||
if (!hasBothParticipants && !isLocked) {
|
||||
// match can only be locked when status is Locked (team(s) busy with previous match)
|
||||
if (matchStatus === TournamentMatchStatus.Locked && !isLocked) {
|
||||
return (
|
||||
<CastInfoWrapper
|
||||
submitButtonText="Lock to be casted"
|
||||
|
|
|
|||
|
|
@ -110,9 +110,7 @@ export default function TournamentMatchPage() {
|
|||
)}
|
||||
matchIsOver={data.matchIsOver}
|
||||
matchId={data.match.id}
|
||||
hasBothParticipants={Boolean(
|
||||
data.match.opponentOne?.id && data.match.opponentTwo?.id,
|
||||
)}
|
||||
matchStatus={data.match.status}
|
||||
/>
|
||||
{data.matchIsOver && !data.endedEarly && data.results.length > 0 ? (
|
||||
<ResultsSection />
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user