]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/results/Item.js
protocol frontend
[alttp.git] / resources / js / components / results / Item.js
1 import PropTypes from 'prop-types';
2 import React from 'react';
3 import { withTranslation } from 'react-i18next';
4
5 import Box from '../users/Box';
6 import { formatTime } from '../../helpers/Result';
7 import { findResult } from '../../helpers/Participant';
8 import i18n from '../../i18n';
9
10 const Item = ({
11         participant,
12         round,
13 }) => {
14         const result = findResult(participant, round);
15         return (
16                 <div className="result">
17                         <Box user={participant.user} />
18                         {result ?
19                                 <div>
20                                         {i18n.t('results.time', { time: formatTime(result) })}
21                                 </div>
22                         : null}
23                 </div>
24         );
25 };
26
27 Item.propTypes = {
28         participant: PropTypes.shape({
29                 user: PropTypes.shape({
30                 }),
31         }),
32         round: PropTypes.shape({
33         }),
34         tournament: PropTypes.shape({
35         }),
36 };
37
38 export default withTranslation()(Item);