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';
19 } from '../../helpers/Tournament';
20 import { withUser } from '../../helpers/UserContext';
21 import i18n from '../../i18n';
27 }) => <Container fluid>
30 <div className="d-flex align-items-center justify-content-between">
31 <h1>{tournament.title}</h1>
32 {mayViewProtocol(user, tournament) ?
33 <Protocol id={tournament.id} />
40 <div className="d-flex align-items-center justify-content-between">
41 <h2>{i18n.t('rounds.heading')}</h2>
42 {addRound && mayAddRounds(user, tournament) ?
43 <Button onClick={addRound}>
44 {i18n.t('rounds.new')}
49 <Rounds rounds={tournament.rounds} tournament={tournament} />
53 <div className="d-flex align-items-center justify-content-between">
54 <h2>{i18n.t('tournaments.scoreboard')}</h2>
56 {hasRunners(tournament) ?
57 <Scoreboard tournament={tournament} />
59 {hasTournamentAdmins(tournament) ?
61 <div className="d-flex align-items-center justify-content-between">
62 <h2>{i18n.t('tournaments.admins')}</h2>
64 {getTournamentAdmins(tournament).map(p =>
65 <p key={p.id}><Box user={p.user} /></p>
74 addRound: PropTypes.func,
75 tournament: PropTypes.shape({
77 participants: PropTypes.arrayOf(PropTypes.shape({
79 rounds: PropTypes.arrayOf(PropTypes.shape({
81 title: PropTypes.string,
83 user: PropTypes.shape({
87 export default withTranslation()(withUser(Detail));