X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fresults%2FItem.js;h=a2ee8e392b82a392b76236b8bab92e4e7806d6f7;hb=8d97d023740e438361e659c6e133418e33343178;hp=771c7b62a68ad825a9fe74288db70935c51bdcb5;hpb=d748feb96453d74aeffec648d6f5f68d9ef3b520;p=alttp.git diff --git a/resources/js/components/results/Item.js b/resources/js/components/results/Item.js index 771c7b6..a2ee8e3 100644 --- a/resources/js/components/results/Item.js +++ b/resources/js/components/results/Item.js @@ -1,27 +1,56 @@ import PropTypes from 'prop-types'; -import React from 'react'; -import { withTranslation } from 'react-i18next'; +import React, { useState } from 'react'; +import { Button } from 'react-bootstrap'; +import DetailDialog from './DetailDialog'; import Box from '../users/Box'; -import { formatTime } from '../../helpers/Result'; +import { getIcon, getTime } from '../../helpers/Result'; import { findResult } from '../../helpers/Participant'; -import i18n from '../../i18n'; +import { maySeeResults } from '../../helpers/permissions'; +import { withUser } from '../../helpers/UserContext'; + +const getClassName = result => { + const classNames = ['status']; + if (result && result.has_finished) { + classNames.push('finished'); + if (result.comment) { + classNames.push('has-comment'); + } + } else { + classNames.push('pending'); + } + return classNames.join(' '); +}; const Item = ({ participant, round, + tournament, + user, }) => { + const [showDialog, setShowDialog] = useState(false); const result = findResult(participant, round); - return ( -
- -
- {result ? - {i18n.t('results.time', { time: formatTime(result) })} - : null} -
-
- ); + const maySee = maySeeResults(user, tournament, round); + return
+ + + setShowDialog(false)} + participant={participant} + round={round} + show={showDialog} + tournament={tournament} + /> +
; }; Item.propTypes = { @@ -37,4 +66,4 @@ Item.propTypes = { }), }; -export default withTranslation()(Item); +export default withUser(Item);