From: Daniel Karbach Date: Mon, 5 Jan 2026 19:56:25 +0000 (+0100) Subject: hide rounds for qualifiers X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=eb9848b4766094cf34e70562e0650c8f9a9f20ad;p=alttp.git hide rounds for qualifiers --- diff --git a/resources/js/components/tournament/Detail.jsx b/resources/js/components/tournament/Detail.jsx index 1a16ea4..e90ab99 100644 --- a/resources/js/components/tournament/Detail.jsx +++ b/resources/js/components/tournament/Detail.jsx @@ -19,6 +19,7 @@ import { isRunner, mayAddRounds, mayExportTournament, + maySeeRound, mayUpdateTournament, mayViewProtocol, } from '../../helpers/permissions'; @@ -65,6 +66,11 @@ const Detail = ({ }) }, []); + const rounds = React.useMemo( + () => tournament.rounds || []).filter((r) => maySeeRound(user, tournament, r), + [tournament.rounds, user], + ); + return @@ -164,14 +170,12 @@ const Detail = ({ : null} - {tournament.rounds ? - - : null} + ; diff --git a/resources/js/helpers/permissions.js b/resources/js/helpers/permissions.js index bac1559..10af0b0 100644 --- a/resources/js/helpers/permissions.js +++ b/resources/js/helpers/permissions.js @@ -3,6 +3,7 @@ import * as Episode from './Episode'; import Round from './Round'; +import * as Tournament from './Tournament'; import User from './User'; export const hasGlobalRole = (user, role) => @@ -187,6 +188,19 @@ export const mayUpdateTournament = (user, tournament) => export const mayViewProtocol = (user, tournament) => isTournamentCrew(user, tournament); +export const maySeeRound = (user, tournament, round) => { + if (!Tournament.hasAssignedGroups(tournament)) { + return true; + } + if (isTournamentCrew(user, tournament)) { + return true; + } + if (hasFinished(user, round)) { + return true; + } + return false; +}; + export const maySeeResults = (user, tournament, round) => { if (tournament.result_reveal === 'always') { return true;