]> git.localhorst.tv Git - alttp.git/blob - resources/js/components/results/Item.js
771c7b62a68ad825a9fe74288db70935c51bdcb5
[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                         <div>
19                                 {result ?
20                                         <span>{i18n.t('results.time', { time: formatTime(result) })}</span>
21                                 : null}
22                         </div>
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         user: PropTypes.shape({
37         }),
38 };
39
40 export default withTranslation()(Item);