X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=resources%2Fjs%2Fcomponents%2Fresults%2FItem.js;h=2a1fc8c07f4cbb404be0f030b0315e274720dc33;hb=2110d91bc5016fd78aec02578b09506b6d67f45e;hp=5cdd3be42751c1b678508a1e3800a065b080bf93;hpb=06fd14404164904304a20e2280037e83299247fa;p=alttp.git
diff --git a/resources/js/components/results/Item.js b/resources/js/components/results/Item.js
index 5cdd3be..2a1fc8c 100644
--- a/resources/js/components/results/Item.js
+++ b/resources/js/components/results/Item.js
@@ -9,33 +9,60 @@ import { findResult } from '../../helpers/Participant';
import { maySeeResults } from '../../helpers/permissions';
import { withUser } from '../../helpers/UserContext';
+const getIcon = (result, index, maySee) => {
+ if (!result || !result.has_finished) {
+ return ;
+ }
+ if (result.forfeit && maySee) {
+ return ;
+ }
+ if (index === 0) {
+ return ;
+ }
+ if (index === 1) {
+ return ;
+ }
+ if (index === 2) {
+ return ;
+ }
+ return ;
+};
+
+const getTime = (result, maySee) => {
+ if (!result || !maySee) {
+ return null;
+ }
+ if (result.time) {
+ return formatTime(result);
+ }
+ if (result.forfeit) {
+ return 'DNF';
+ }
+ return '?';
+};
+
const Item = ({
+ index,
participant,
round,
tournament,
user,
}) => {
const result = findResult(participant, round);
- return (
-
-
-
-
- {result && maySeeResults(user, tournament, round) ?
- formatTime(result)
- : null}
-
- {result && result.has_finished ?
-
- :
-
- }
-
+ const maySee = maySeeResults(user, tournament, round);
+ return
+
+
+
+ {getTime(result, maySee)}
+
+ {getIcon(result, index, maySee)}
- );
+
;
};
Item.propTypes = {
+ index: PropTypes.number,
participant: PropTypes.shape({
user: PropTypes.shape({
}),