]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/rounds/Item.js
allow setting seeds
[alttp.git] / resources / js / components / rounds / Item.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Button } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
5
6 import SeedButton from './SeedButton';
7 import List from '../results/List';
8 import ReportButton from '../results/ReportButton';
9 import { maySetSeed, isParticipant } from '../../helpers/permissions';
10 import { findParticipant } from '../../helpers/Tournament';
11 import { withUser } from '../../helpers/UserContext';
12 import i18n from '../../i18n';
13
14 const Item = ({
15         round,
16         tournament,
17         user,
18 }) =>
19 <li className="round d-flex">
20         <div className="info">
21                 <p className="date">{i18n.t('rounds.date', { date: new Date(round.created_at) })}</p>
22                 <p className="seed">
23                         <SeedButton
24                                 round={round}
25                                 tournament={tournament}
26                         />
27                 </p>
28                 {isParticipant(user, tournament) ?
29                         <p className="report">
30                                 <ReportButton
31                                         participant={findParticipant(tournament, user)}
32                                         round={round}
33                                         tournament={tournament}
34                                 />
35                         </p>
36                 : null}
37         </div>
38         <List round={round} tournament={tournament} />
39 </li>;
40
41 Item.propTypes = {
42         round: PropTypes.shape({
43                 created_at: PropTypes.string,
44                 seed: PropTypes.string,
45         }),
46         tournament: PropTypes.shape({
47                 participants: PropTypes.arrayOf(PropTypes.shape({
48                 })),
49         }),
50         user: PropTypes.shape({
51         }),
52 };
53
54 export default withTranslation()(withUser(Item));