Skip to content

Commit 5ba4da6

Browse files
committed
Fixed score deails not available
1 parent c6d6c9b commit 5ba4da6

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

global-scoreboard/.eslintrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
}
5757
}
5858
],
59-
"sort-imports": "error"
59+
"sort-imports": "error",
60+
// False positives should be infered from Typescript
61+
"react/prop-types": "off"
6062
}
6163
}

global-scoreboard/src/Dashboard/TableElements/PlayerScoreCell.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import './PlayerScoreCell.css'
32
import React, { useState } from 'react'
43
import { Button } from 'react-bootstrap'
@@ -15,7 +14,7 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
1514

1615
const handleClose = () => setShow(false)
1716
const handleShow = () =>
18-
props.player.scoreDetails == null
17+
props.player.scoreDetails === undefined
1918
? apiGet(`players/${props.player.userId}/score-details`)
2019
.then(res =>
2120
res.text().then(scoreDetails => {
@@ -25,7 +24,8 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
2524
)
2625
: setShow(true)
2726

28-
return !props.player.scoreDetails
27+
// Date is last known update date for a user with details
28+
return props.player.lastUpdate < new Date('2020-05-19')
2929
? <span>{props.player.score}</span>
3030
: <>
3131
<Button
@@ -40,7 +40,11 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
4040
title={`Runner: ${props.player.name} (${props.player.userId}), ${props.player.score} pts`}
4141
>
4242
<div className="alert alert-success">
43-
{props.player.scoreDetails}
43+
{props.player.scoreDetails
44+
? props.player.scoreDetails
45+
: ('No details available. ' +
46+
`You can update ${props.player.name} (${props.player.userId}) to get more details about their runs.`)
47+
}
4448
</div>
4549
</GenericModal>
4650
</>

0 commit comments

Comments
 (0)