return <Icon.FINISHED className="text-success" size="lg" />;
};
+const getTime = (user, tournament, round, result) => {
+ if (!result || !maySeeResults(user, tournament, round)) {
+ return null;
+ }
+ if (result.time) {
+ return formatTime(result);
+ }
+ if (result.forfeit) {
+ return 'DNF';
+ }
+ return '?';
+};
+
const Item = ({
index,
participant,
user,
}) => {
const result = findResult(participant, round);
- return (
- <div className="result">
- <Box user={participant.user} />
- <div className="status">
- <span className="time">
- {result && maySeeResults(user, tournament, round) ?
- formatTime(result)
- : null}
- </span>
- {getIcon(result, index)}
- </div>
+ return <div className="result">
+ <Box user={participant.user} />
+ <div className="status">
+ <span className="time">
+ {getTime(user, tournament, round, result)}
+ </span>
+ {getIcon(result, index)}
</div>
- );
+ </div>;
};
Item.propTypes = {