X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Fprotocol%2FItem.js;h=74bfa50039cf82ab62c3395d2e2683d2ec1072df;hb=879e02084f2a9a9e049d9b3de8bcc7e30d9c999a;hp=f827f1ab0f9b8409dcbb5f15f5d7f735fefa0cfd;hpb=0f171dfffd9c0c2cc895c9f282c5f4550844cc5a;p=alttp.git
diff --git a/resources/js/components/protocol/Item.js b/resources/js/components/protocol/Item.js
index f827f1a..74bfa50 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,10 +16,36 @@ const getEntryDate = entry => {
: dateStr;
};
+const getEntryRoundNumber = entry =>
+ (entry && entry.details && entry.details.round && entry.details.round.number) || '?';
+
+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
+ {{time}},
+ ;
+ }
case 'round.create':
+ case 'round.lock':
+ case 'round.unlock':
+ return i18n.t(
+ `protocol.description.${entry.type}`,
+ {
+ ...entry,
+ number: getEntryRoundNumber(entry),
+ },
+ );
+ case 'result.comment':
+ case 'tournament.lock':
return i18n.t(
`protocol.description.${entry.type}`,
entry,
@@ -29,6 +57,15 @@ const getEntryDescription = entry => {
const getEntryIcon = entry => {
switch (entry.type) {
+ case 'result.report':
+ return ;
+ case 'round.create':
+ return ;
+ case 'round.lock':
+ case 'tournament.lock':
+ return ;
+ case 'round.unlock':
+ return ;
default:
return ;
}