import { maySeeResults } from '../../helpers/permissions';
import { withUser } from '../../helpers/UserContext';
-const getIcon = (result, index) => {
+const getIcon = (result, index, maySee) => {
if (!result || !result.has_finished) {
return <Icon.PENDING className="text-muted" size="lg" />;
}
- if (result.forfeit) {
+ if (result.forfeit && maySee) {
return <Icon.FORFEIT className="text-danger" size="lg" />;
}
if (index === 0) {
return <Icon.FINISHED className="text-success" size="lg" />;
};
-const getTime = (user, tournament, round, result) => {
- if (!result || !maySeeResults(user, tournament, round)) {
+const getTime = (result, maySee) => {
+ if (!result || !maySee) {
return null;
}
if (result.time) {
user,
}) => {
const result = findResult(participant, round);
+ const maySee = maySeeResults(user, tournament, round);
return <div className="result">
<Box user={participant.user} />
<div className="status">
<span className="time">
- {getTime(user, tournament, round, result)}
+ {getTime(result, maySee)}
</span>
- {getIcon(result, index)}
+ {getIcon(result, index, maySee)}
</div>
</div>;
};