Skip to content

Commit

Permalink
setupId now show on game-over modal and included in shareText
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelchadwick committed Nov 7, 2024
1 parent 439f9fe commit 69669fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions assets/css/modal/game-over.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@
display: flex;
justify-content: center;
}
.setupid {
font-size: 0.75rem;
}
9 changes: 3 additions & 6 deletions assets/js/app/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Deckdle.__getParentCard = (el, selector) => {
return parent_container
}

Deckdle.__getSetupId = async (gameMode, qsId) => {
Deckdle.__createSetupId = async (gameMode, qsId) => {
let setupId = null

// 'daily' always uses day hash
Expand Down Expand Up @@ -86,15 +86,12 @@ Deckdle.__getSetupId = async (gameMode, qsId) => {
history.pushState(null, '', url)
}
} else {
setupId = Deckdle.__createRandomSetupId()
setupId = Math.floor(Math.random() * 10000000000)
}
}

return setupId
}
Deckdle.__createRandomSetupId = () => {
return Math.floor(Math.random() * 10000000000)
}
Deckdle.__getGameMode = () => {
return Deckdle.settings ? Deckdle.settings.gameMode : DECKDLE_DEFAULT_GAMEMODE
}
Expand Down Expand Up @@ -194,7 +191,7 @@ Deckdle.__getShareText = (mode = Deckdle.__getGameMode(), type = Deckdle.__getGa
let html = ''

if (mode == 'daily') {
html += `♦️ Deckdle DAILY #${Deckdle.dailyNumber}\n`
html += `♦️ Deckdle DAILY #${Deckdle.dailyNumber} [${Deckdle.__getState().setupId}]\n`
} else {
html += `♦️ Deckdle FREE id:${Deckdle.__getState()['setupId']}\n`
}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Deckdle._createNewSetup = async (gameMode, qsId = null) => {

Deckdle.__setState('gameState', 'IN_PROGRESS', gameMode)

setupId = await Deckdle.__getSetupId(gameMode, qsId)
setupId = await Deckdle.__createSetupId(gameMode, qsId)

Deckdle.__setState('setupId', setupId, gameMode)

Expand Down
1 change: 1 addition & 0 deletions assets/js/app/modals.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ Deckdle.modalOpen = async (type) => {
}
modalText += `
</div>
<div class="setupid">${Deckdle.__getState().setupId}</div>
`

// daily
Expand Down

0 comments on commit 69669fa

Please sign in to comment.