X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=resources%2Fjs%2Fcomponents%2Fresults%2FItem.js;h=0d73105edd21ac13268223742196ca9bbdfe3daa;hb=dd283dc4c2004cbeb36d17b878bb67f94d75d06a;hp=2a1fc8c07f4cbb404be0f030b0315e274720dc33;hpb=8078d2d7e3363679874caaa571a1c138438c95e2;p=alttp.git
diff --git a/resources/js/components/results/Item.js b/resources/js/components/results/Item.js
index 2a1fc8c..0d73105 100644
--- a/resources/js/components/results/Item.js
+++ b/resources/js/components/results/Item.js
@@ -9,20 +9,20 @@ import { findResult } from '../../helpers/Participant';
import { maySeeResults } from '../../helpers/permissions';
import { withUser } from '../../helpers/UserContext';
-const getIcon = (result, index, maySee) => {
+const getIcon = (result, maySee) => {
if (!result || !result.has_finished) {
return ;
}
if (result.forfeit && maySee) {
return ;
}
- if (index === 0) {
+ if (result.placement === 1 && maySee) {
return ;
}
- if (index === 1) {
+ if (result.placement === 2 && maySee) {
return ;
}
- if (index === 2) {
+ if (result.placement === 3 && maySee) {
return ;
}
return ;
@@ -41,8 +41,20 @@ const getTime = (result, maySee) => {
return '?';
};
+const getClassName = result => {
+ const classNames = ['status'];
+ if (result && result.has_finished) {
+ classNames.push('finished');
+ if (result.comment) {
+ classNames.push('has-comment');
+ }
+ } else {
+ classNames.push('pending');
+ }
+ return classNames.join(' ');
+};
+
const Item = ({
- index,
participant,
round,
tournament,
@@ -52,17 +64,19 @@ const Item = ({
const maySee = maySeeResults(user, tournament, round);
return
-
+
{getTime(result, maySee)}
- {getIcon(result, index, maySee)}
+ {getIcon(result, maySee)}
;
};
Item.propTypes = {
- index: PropTypes.number,
participant: PropTypes.shape({
user: PropTypes.shape({
}),