Skip to content

Commit

Permalink
Merge pull request #93 from daithihearn/select-cards2
Browse files Browse the repository at this point in the history
Removing logging
  • Loading branch information
daithihearn authored Jan 19, 2023
2 parents f4c7b18 + ae549e4 commit 81310b6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion src/components/Game/Buying.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ const Buying = () => {
)

const buyCards = (id: string, sel: SelectableCard[]) => {
console.log(`Keeping cards: ${JSON.stringify(sel)}`)
dispatch(GameService.buyCards(id, sel)).catch(e =>
enqueueSnackbar(e.message, { variant: "error" }),
)
Expand Down
7 changes: 1 addition & 6 deletions src/utils/GameUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,13 @@ export const processOrderedCardsAfterGameUpdate = (
if (
delta.length === 0 &&
currentCardsNoBlanks.length === updatedCardNames.length
) {
console.log("1. returning cards as they are")
)
return currentCards
}
// 2. If a card was removed then replace it with a Blank card in orderedCards
else if (
currentCardsNoBlanks.length === updatedCardNames.length + 1 &&
delta.length === 1
) {
console.log("2. a card was removed, so replacing it with a blank")
const updatedCurrentCards = [...currentCards]
const idx = updatedCurrentCards.findIndex(c => c.name === delta[0].name)
updatedCurrentCards[idx] = { ...BLANK_CARD, selected: false }
Expand All @@ -72,8 +69,6 @@ export const processOrderedCardsAfterGameUpdate = (

// 3. Else send back a fresh hand constructed from the API data
} else {
console.log(`3. refreshing cards entirely currentCards`)

const updatedCards = updatedCardNames.map<SelectableCard>(name => {
const card = CARDS.find(c => c.name === name)!
return { ...card, selected: false }
Expand Down

0 comments on commit 81310b6

Please sign in to comment.