Skip to content

Commit

Permalink
Fixed score deails not available
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Jul 24, 2020
1 parent c6d6c9b commit 5ba4da6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion global-scoreboard/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
}
}
],
"sort-imports": "error"
"sort-imports": "error",
// False positives should be infered from Typescript
"react/prop-types": "off"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import './PlayerScoreCell.css'
import React, { useState } from 'react'
import { Button } from 'react-bootstrap'
Expand All @@ -15,7 +14,7 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {

const handleClose = () => setShow(false)
const handleShow = () =>
props.player.scoreDetails == null
props.player.scoreDetails === undefined
? apiGet(`players/${props.player.userId}/score-details`)
.then(res =>
res.text().then(scoreDetails => {
Expand All @@ -25,7 +24,8 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
)
: setShow(true)

return !props.player.scoreDetails
// Date is last known update date for a user with details
return props.player.lastUpdate < new Date('2020-05-19')
? <span>{props.player.score}</span>
: <>
<Button
Expand All @@ -40,7 +40,11 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
title={`Runner: ${props.player.name} (${props.player.userId}), ${props.player.score} pts`}
>
<div className="alert alert-success">
{props.player.scoreDetails}
{props.player.scoreDetails
? props.player.scoreDetails
: ('No details available. ' +
`You can update ${props.player.name} (${props.player.userId}) to get more details about their runs.`)
}
</div>
</GenericModal>
</>
Expand Down

0 comments on commit 5ba4da6

Please sign in to comment.