Skip to content

Commit

Permalink
Probably get clone tournament working for anoek
Browse files Browse the repository at this point in the history
  • Loading branch information
dexonsmith committed Feb 12, 2024
1 parent 30251cb commit 80e5e8f
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions src/views/Tournament/Tournament.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export function Tournament(): JSX.Element {

const [edit_save_state, setEditSaveState] = React.useState<EditSaveState>("none");

const default_tournament: TournamentInterface = {
const user_default_tournament: TournamentInterface = {
name: "",
// TODO: replace {} with something that makes type sense. -bpj
director: tournament_id === 0 ? user : ({} as any),
Expand Down Expand Up @@ -184,6 +184,22 @@ export function Tournament(): JSX.Element {
lead_time_seconds: 1800,
base_points: 10.0,
};
// this is so anoek (user id 1) can quickly test tournaments
const default_tournament: TournamentInterface =
user.id === 1
? {
...user_default_tournament,
name: "Culture: join 4",
time_start: moment(new Date()).add(1, "minute").format(),
rules: "japanese",
description:
/* cspell: disable-next-line */
"Aliquam dolor blanditiis voluptatem et harum officiis atque. Eum eos aut consequatur quis sunt. Minima nisi aut ratione. Consequatur deleniti vitae minima exercitationem illum debitis debitis sunt. Culpa officia voluptates quos sit. Reprehenderit fuga ad quo ipsam assumenda nihil quos qui.",
tournament_type: "elimination",
first_pairing_method: "slide",
subsequent_pairing_method: "slaughter",
}
: user_default_tournament;
const [tournament, setTournament] = React.useState<TournamentInterface>(default_tournament);
const ref_tournament_to_clone = React.useRef<LoadedTournamentInterface | null>(null);

Expand Down Expand Up @@ -261,27 +277,6 @@ export function Tournament(): JSX.Element {
? raw_rounds[selected_round_idx]
: null;

// this is so anoek (user id 1) can quickly test tournaments
React.useEffect(() => {
if (user.id === 1 && tournament_id === 0) {
setTournament({
...default_tournament,
name: "Culture: join 4",
time_start: moment(new Date()).add(1, "minute").format(),
rules: "japanese",
description:
/* cspell: disable-next-line */
"Aliquam dolor blanditiis voluptatem et harum officiis atque. Eum eos aut consequatur quis sunt. Minima nisi aut ratione. Consequatur deleniti vitae minima exercitationem illum debitis debitis sunt. Culpa officia voluptates quos sit. Reprehenderit fuga ad quo ipsam assumenda nihil quos qui.",
tournament_type: "elimination",
first_pairing_method: "slide",
subsequent_pairing_method: "slaughter",
// tournament_type: "opengotha",
// first_pairing_method: "opengotha",
// subsequent_pairing_method: "opengotha",
});
}
}, [tournament_id]);

React.useEffect(() => {
window.document.title = tournament_id ? tournament.name : _("Tournament");
}, [tournament_id, tournament.name]);
Expand Down

0 comments on commit 80e5e8f

Please sign in to comment.