Skip to content

Commit

Permalink
Merge pull request #115 from daithihearn/leaderboard-and-bugfix
Browse files Browse the repository at this point in the history
Leaderboard and bugfix
  • Loading branch information
daithihearn authored Feb 2, 2023
2 parents e27ab15 + c01daac commit 7bc419c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
25 changes: 10 additions & 15 deletions src/components/Leaderboard/SinglesLeaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ const SinglesLeaderboard = () => {
() => [
{
name: "Avatar",
cell: row => (
<img alt={row.name} src={row.picture} className="avatar" />
),
},
{
cell: row => (
<img
alt="Image Preview"
src={row.picture}
className="avatar"
alt={row.previousCard}
src={"/cards/thumbnails/" + row.previousCard + ".png"}
className="thumbnail_size_small cardNotSelected"
/>
),
center: true,
omit: gameOver || !previousHand,
},
{ name: "Player", selector: row => row.name, sortable: true },
{
name: "Score",
selector: row => row.score,
Expand Down Expand Up @@ -105,17 +111,6 @@ const SinglesLeaderboard = () => {
center: true,
omit: !gameOver,
},
{
cell: row => (
<img
alt={row.previousCard}
src={"/cards/thumbnails/" + row.previousCard + ".png"}
className="thumbnail_size_small cardNotSelected"
/>
),
center: true,
omit: gameOver || !previousHand,
},
],
[gameOver, previousHand],
)
Expand Down
10 changes: 6 additions & 4 deletions src/pages/Game/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,20 @@ const Game = () => {
await dispatch(GameService.getAllPlayers()).catch((e: Error) =>
enqueueSnackbar(parseError(e), { variant: "error" }),
)
}, [iamSpectator])
}, [id, iamSpectator])

useEffect(() => {
fetchData()
}, [id, iamSpectator])

useEffect(() => {
return () => {
console.log("Resetting game")
dispatch(resetGame())
console.log("Clearing game")
dispatch(clearMyCards())
dispatch(clearAutoPlay())
dispatch(resetGame())
}
}, [id, iamSpectator])
}, [])

return (
<PullToRefresh
Expand Down

0 comments on commit 7bc419c

Please sign in to comment.