mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-25 12:49:26 -05:00
Disable register for invite only events
This commit is contained in:
@@ -74,6 +74,7 @@ import { TOURNAMENT } from "../tournament-constants";
|
||||
import { useSelectCounterpickMapPoolState } from "../tournament-hooks";
|
||||
import { registerSchema } from "../tournament-schemas.server";
|
||||
import {
|
||||
HACKY_isInviteOnlyEvent,
|
||||
HACKY_resolveCheckInTime,
|
||||
HACKY_resolvePicture,
|
||||
HACKY_subsFeatureEnabled,
|
||||
@@ -127,6 +128,8 @@ export const action: ActionFunction = async ({ request, params }) => {
|
||||
prefersNotToHost: booleanToInt(data.prefersNotToHost),
|
||||
});
|
||||
} else {
|
||||
validate(!HACKY_isInviteOnlyEvent(event), "Event is invite only");
|
||||
|
||||
createTeam({
|
||||
name: data.teamName,
|
||||
tournamentId: tournamentId,
|
||||
@@ -347,15 +350,30 @@ function RegistrationForms({
|
||||
userId: user?.id,
|
||||
});
|
||||
|
||||
const showRegistrationProgress = () => {
|
||||
if (ownTeam) return true;
|
||||
|
||||
return !HACKY_isInviteOnlyEvent(parentRouteData.tournament);
|
||||
};
|
||||
|
||||
const showRegisterNewTeam = () => {
|
||||
if (ownTeam) return true;
|
||||
if (HACKY_isInviteOnlyEvent(parentRouteData.tournament)) return false;
|
||||
|
||||
return !checkInHasEnded(parentRouteData.tournament);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="stack lg">
|
||||
<RegistrationProgress
|
||||
checkedIn={Boolean(ownTeam?.checkedInAt)}
|
||||
name={ownTeam?.name}
|
||||
mapPool={data?.mapPool}
|
||||
members={ownTeamFromList?.members}
|
||||
/>
|
||||
{ownTeam || !checkInHasEnded(parentRouteData.tournament) ? (
|
||||
{showRegistrationProgress() ? (
|
||||
<RegistrationProgress
|
||||
checkedIn={Boolean(ownTeam?.checkedInAt)}
|
||||
name={ownTeam?.name}
|
||||
mapPool={data?.mapPool}
|
||||
members={ownTeamFromList?.members}
|
||||
/>
|
||||
) : null}
|
||||
{showRegisterNewTeam() ? (
|
||||
<TeamInfo
|
||||
name={ownTeam?.name}
|
||||
prefersNotToHost={ownTeamFromList?.prefersNotToHost}
|
||||
|
||||
@@ -80,6 +80,9 @@ export function isOneModeTournamentOf(
|
||||
export function HACKY_resolvePicture(
|
||||
event: TournamentLoaderData["tournament"],
|
||||
) {
|
||||
if (HACKY_isInviteOnlyEvent(event))
|
||||
return "https://abload.de/img/screenshot2023-11-25ay1fbc.png";
|
||||
|
||||
if (event.name.includes("In The Zone"))
|
||||
return "https://abload.de/img/screenshot2023-04-19a2bfv0.png";
|
||||
|
||||
@@ -94,9 +97,12 @@ export function HACKY_resolveCheckInTime(
|
||||
return databaseTimestampToDate(event.startTime - 60 * 60);
|
||||
}
|
||||
|
||||
const HACKY_isSendouQSeasonFinale = (
|
||||
event: TournamentLoaderData["tournament"],
|
||||
) => event.name.includes("Finale");
|
||||
const HACKY_isSendouQSeasonFinale = (event: { name: string }) =>
|
||||
event.name.includes("Finale");
|
||||
|
||||
export function HACKY_isInviteOnlyEvent(event: { name: string }) {
|
||||
return HACKY_isSendouQSeasonFinale(event);
|
||||
}
|
||||
|
||||
export function HACKY_subsFeatureEnabled(
|
||||
event: TournamentLoaderData["tournament"],
|
||||
|
||||
Reference in New Issue
Block a user