]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/tournament/Scoreboard.js
switch participant list to scoreboard
[alttp.git] / resources / js / components / tournament / Scoreboard.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { Table } from 'react-bootstrap';
4 import { withTranslation } from 'react-i18next';
5
6 import Box from '../users/Box';
7 import { calculateScores } from '../../helpers/Tournament';
8 import i18n from '../../i18n';
9
10 const Scoreboard = ({ tournament }) =>
11 <Table striped className="scoreboard">
12         <thead>
13                 <tr>
14                         <th>{i18n.t('participants.participant')}</th>
15                         <th className="text-end">{i18n.t('participants.score')}</th>
16                 </tr>
17         </thead>
18         <tbody>
19         {calculateScores(tournament).map(score =>
20                 <tr className="score" key={score.participant.id}>
21                         <td><Box user={score.participant.user} /></td>
22                         <td className="text-end text-lg">{score.score}</td>
23                 </tr>
24         )}
25         </tbody>
26 </Table>;
27
28 Scoreboard.propTypes = {
29         tournament: PropTypes.shape({
30         }),
31 };
32
33 export default withTranslation()(Scoreboard);