]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/rounds/List.js
svg dungeon tracker
[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 LoadMore from './LoadMore';
8 import i18n from '../../i18n';
9
10 const List = ({
11         loadMore,
12         rounds,
13         tournament,
14 }) => rounds && rounds.length ? <>
15         <ol className="rounds">
16                 {rounds.map(round =>
17                         <Item
18                                 key={round.id}
19                                 round={round}
20                                 tournament={tournament}
21                         />
22                 )}
23         </ol>
24         {loadMore ?
25                 <LoadMore loadMore={loadMore} />
26         : null}
27 </> :
28         <Alert variant="info">
29                 {i18n.t('rounds.empty')}
30         </Alert>
31 ;
32
33 List.propTypes = {
34         loadMore: PropTypes.func,
35         rounds: PropTypes.arrayOf(PropTypes.shape({
36                 id: PropTypes.number,
37         })),
38         tournament: PropTypes.shape({
39         }),
40 };
41
42 export default withTranslation()(List);