]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/rounds/List.js
number rounds and results
[alttp.git] / resources / js / components / rounds / List.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Alert } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
5
6 import Item from './Item';
7 import i18n from '../../i18n';
8
9 const List = ({
10         rounds,
11         tournament,
12 }) => rounds && rounds.length ?
13         <ol className="rounds">
14                 {rounds.map((round, index) =>
15                         <Item
16                                 index={index}
17                                 key={round.id}
18                                 round={round}
19                                 tournament={tournament}
20                         />
21                 )}
22         </ol>
23 :
24         <Alert variant="info">
25                 {i18n.t('rounds.empty')}
26         </Alert>
27 ;
28
29 List.propTypes = {
30         rounds: PropTypes.arrayOf(PropTypes.shape({
31                 id: PropTypes.number,
32         })),
33         tournament: PropTypes.shape({
34         }),
35 };
36
37 export default withTranslation()(List);