1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Button, Col, Container, Row } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
6 import Scoreboard from './Scoreboard';
7 import Protocol from '../protocol/Protocol';
8 import Rounds from '../rounds/List';
9 import Box from '../users/Box';
13 } from '../../helpers/permissions';
18 } from '../../helpers/Tournament';
19 import { withUser } from '../../helpers/UserContext';
20 import i18n from '../../i18n';
26 }) => <Container fluid>
29 <div className="d-flex align-items-center justify-content-between">
30 <h1>{tournament.title}</h1>
31 {mayViewProtocol(user, tournament) ?
32 <Protocol id={tournament.id} />
38 <Col lg={{ order: 2, span: 4 }} xl={{ order: 2, span: 3 }}>
39 <div className="d-flex align-items-center justify-content-between">
40 <h2>{i18n.t('tournaments.scoreboard')}</h2>
42 {hasRunners(tournament) ?
43 <Scoreboard tournament={tournament} />
45 {hasTournamentAdmins(tournament) ?
47 <div className="d-flex align-items-center justify-content-between">
48 <h2>{i18n.t('tournaments.admins')}</h2>
50 {getTournamentAdmins(tournament).map(p =>
51 <p key={p.id}><Box user={p.user} /></p>
56 <Col lg={{ order: 1, span: 8 }} xl={{ order: 1, span: 9 }}>
57 <div className="d-flex align-items-center justify-content-between">
58 <h2>{i18n.t('rounds.heading')}</h2>
59 {addRound && mayAddRounds(user, tournament) ?
60 <Button onClick={addRound}>
61 {i18n.t('rounds.new')}
66 <Rounds rounds={tournament.rounds} tournament={tournament} />
73 addRound: PropTypes.func,
74 tournament: PropTypes.shape({
76 participants: PropTypes.arrayOf(PropTypes.shape({
78 rounds: PropTypes.arrayOf(PropTypes.shape({
80 title: PropTypes.string,
82 user: PropTypes.shape({
86 export default withTranslation()(withUser(Detail));