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 => {
: 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':
+ case 'result.report': {
+ const time = getEntryResultTime(entry);
+ return <Trans i18nKey={`protocol.description.${entry.type}`}>
+ <Spoiler>{{time}}</Spoiler>,
+ </Trans>;
+ }
case 'round.create':
+ case 'round.lock':
+ case 'tournament.lock':
return i18n.t(
`protocol.description.${entry.type}`,
entry,
protocol: {
description: {
result: {
- report: 'Ergebnis eingetragen',
+ report: 'Ergebnis von <0>{{time}}</0> eingetragen',
},
round: {
create: 'Runde hinzugefĆ¼gt',
+ lock: 'Runde festgesetzt',
+ },
+ tournament: {
+ lock: 'Turnier festgesetzt',
},
unknown: 'Unbekannter Protokolleintrag vom Typ {{type}}.',
},
protocol: {
description: {
result: {
- report: 'Result reported',
+ report: 'Result of {{time}} reported',
},
round: {
create: 'Round added',
+ lock: 'Round locked',
+ },
+ tournament: {
+ lock: 'Tournament locked',
},
unknown: 'Unknown protocol entry of type {{type}}.',
},