X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Ftournament%2FDetail.js;h=66b425e83740e4c0b81cdf10efa6cc2368016c04;hb=f446d5bcf3b87bd9443a060e27e9c0601c96fbb9;hp=912d2a26d58df7a0aedcdfd87a3249353bc1b949;hpb=c30ac282dde3d746d6a7762ee18c70b4416500b5;p=alttp.git diff --git a/resources/js/components/tournament/Detail.js b/resources/js/components/tournament/Detail.js index 912d2a2..66b425e 100644 --- a/resources/js/components/tournament/Detail.js +++ b/resources/js/components/tournament/Detail.js @@ -1,46 +1,115 @@ import PropTypes from 'prop-types'; import React from 'react'; -import { Button, Container } from 'react-bootstrap'; +import { Button, Col, Container, Row } from 'react-bootstrap'; import { withTranslation } from 'react-i18next'; -import Participants from '../participants/List'; +import ApplyButton from './ApplyButton'; +import Scoreboard from './Scoreboard'; +import ScoreChartButton from './ScoreChartButton'; +import SettingsButton from './SettingsButton'; +import ApplicationsButton from '../applications/Button'; import Protocol from '../protocol/Protocol'; import Rounds from '../rounds/List'; +import Box from '../users/Box'; import { + isRunner, mayAddRounds, + mayUpdateTournament, mayViewProtocol, } from '../../helpers/permissions'; +import { + getTournamentAdmins, + getTournamentMonitors, + hasRunners, + hasTournamentAdmins, + hasTournamentMonitors, +} from '../../helpers/Tournament'; import { withUser } from '../../helpers/UserContext'; import i18n from '../../i18n'; +const getClassName = (tournament, user) => { + const classNames = ['tournament']; + if (tournament.locked) { + classNames.push('is-locked'); + } else { + classNames.push('is-active'); + } + if (isRunner(user, tournament)) { + classNames.push('is-runner'); + } + return classNames.join(' '); +}; + const Detail = ({ addRound, tournament, user, -}) => -
-

{tournament.title}

- {mayViewProtocol(user, tournament) ? - - : null} -
-
-

{i18n.t('participants.heading')}

-
- {tournament.participants ? - - : null} -
-

{i18n.t('rounds.heading')}

- {addRound && mayAddRounds(user, tournament) ? - - : null} -
- {tournament.rounds ? - - : null} +}) => + + +
+

{tournament.title}

+
+ + + {mayUpdateTournament(user, tournament) ? + + : null} + {mayViewProtocol(user, tournament) ? + + : null} +
+
+ +
+ + +
+
+

{i18n.t('tournaments.scoreboard')}

+ {hasRunners(tournament) && tournament.rounds.length > 2 ? + + : null} +
+ {hasRunners(tournament) ? + + : null} + {hasTournamentAdmins(tournament) ? + <> +
+

{i18n.t('tournaments.admins')}

+
+ {getTournamentAdmins(tournament).map(p => +

+ )} + + : null} + {hasTournamentMonitors(tournament) ? + <> +
+

{i18n.t('tournaments.monitors')}

+
+ {getTournamentMonitors(tournament).map(p => +

+ )} + + : null} +
+ + +
+

{i18n.t('rounds.heading')}

+ {addRound && mayAddRounds(user, tournament) ? + + : null} +
+ {tournament.rounds ? + + : null} + +
; Detail.propTypes = {