1
-
2
1
import './PlayerScoreCell.css'
3
2
import React , { useState } from 'react'
4
3
import { Button } from 'react-bootstrap'
@@ -15,7 +14,7 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
15
14
16
15
const handleClose = ( ) => setShow ( false )
17
16
const handleShow = ( ) =>
18
- props . player . scoreDetails == null
17
+ props . player . scoreDetails === undefined
19
18
? apiGet ( `players/${ props . player . userId } /score-details` )
20
19
. then ( res =>
21
20
res . text ( ) . then ( scoreDetails => {
@@ -25,7 +24,8 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
25
24
)
26
25
: setShow ( true )
27
26
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' )
29
29
? < span > { props . player . score } </ span >
30
30
: < >
31
31
< Button
@@ -40,7 +40,11 @@ const PlayerScoreCell = (props: PlayerScoreCellProps) => {
40
40
title = { `Runner: ${ props . player . name } (${ props . player . userId } ), ${ props . player . score } pts` }
41
41
>
42
42
< 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
+ }
44
48
</ div >
45
49
</ GenericModal >
46
50
</ >
0 commit comments