X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fprotocol%2FItem.js;h=3337d04621cbd4ae7380c2f0fb880e7ee8535145;hb=eebc6384e56336b66ec250fc2aea3be6171d53ff;hp=6127a92958ec1b4769442c5546efe903212a1391;hpb=c30ac282dde3d746d6a7762ee18c70b4416500b5;p=alttp.git diff --git a/resources/js/components/protocol/Item.js b/resources/js/components/protocol/Item.js index 6127a92..3337d04 100644 --- a/resources/js/components/protocol/Item.js +++ b/resources/js/components/protocol/Item.js @@ -2,9 +2,11 @@ import moment from 'moment'; import PropTypes from 'prop-types'; import React from 'react'; import { ListGroup } from 'react-bootstrap'; -import { withTranslation } from 'react-i18next'; +import { Trans, withTranslation } from 'react-i18next'; import Icon from '../common/Icon'; +import Spoiler from '../common/Spoiler'; +import { formatTime } from '../../helpers/Result'; import i18n from '../../i18n'; const getEntryDate = entry => { @@ -14,9 +16,24 @@ const getEntryDate = entry => { : dateStr; }; +const getEntryResultTime = entry => { + if (!entry || !entry.details || !entry.details.result) return 'ERROR'; + const result = entry.details.result; + if (result.forfeit) return 'DNF XX'; + return formatTime(result); +}; + const getEntryDescription = entry => { switch (entry.type) { + case 'result.report': { + const time = getEntryResultTime(entry); + return + {{time}}, + ; + } case 'round.create': + case 'round.lock': + case 'tournament.lock': return i18n.t( `protocol.description.${entry.type}`, entry,