Skip to content

Commit

Permalink
Allowing enable auto play when waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
daithihearn committed Jul 8, 2023
1 parent 1f3d7e8 commit ab221d4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/components/Game/Actions/PlayCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useCallback, useEffect, useMemo, useState } from "react"

import GameService from "services/GameService"
import { useAppDispatch, useAppSelector } from "caches/hooks"
import { useSnackbar } from "notistack"
import { getMyCardsWithoutBlanks, getSelectedCards } from "caches/MyCardsSlice"
import { getGameId, getIsMyGo, getRound } from "caches/GameSlice"
import { BLANK_CARD } from "model/Cards"
Expand All @@ -21,7 +20,6 @@ const WaitingForYourTurn = () => (
const PlayCard = () => {
const dispatch = useAppDispatch()
const round = useAppSelector(getRound)
const { enqueueSnackbar } = useSnackbar()
const [autoPlay, setAutoPlay] = useState(false)
const gameId = useAppSelector(getGameId)
const myCards = useAppSelector(getMyCardsWithoutBlanks)
Expand Down Expand Up @@ -82,7 +80,19 @@ const PlayCard = () => {
<b>Disable Auto Play</b>
</Button>
)
} else if (!playButtonEnabled) return <WaitingForYourTurn />
} else if (!playButtonEnabled)
return (
<>
<WaitingForYourTurn />
<Button
id="autoPlayCardButton"
type="button"
onClick={togglePlayCard}
color="warning">
<b>Enable Auto Play</b>
</Button>
</>
)
return (
<>
<Button
Expand Down

0 comments on commit ab221d4

Please sign in to comment.