From b5f1075ca45e6e86163f931884227f8158e3eaf5 Mon Sep 17 00:00:00 2001 From: Moritz Riede Date: Fri, 19 Jan 2024 13:30:14 +0100 Subject: [PATCH] feat: also provide stats copy-button when the game is lost --- app/src/components/Modal/MinesweeperDialog.vue | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/components/Modal/MinesweeperDialog.vue b/app/src/components/Modal/MinesweeperDialog.vue index d81e7f4b6a..5305c3a5e9 100644 --- a/app/src/components/Modal/MinesweeperDialog.vue +++ b/app/src/components/Modal/MinesweeperDialog.vue @@ -46,6 +46,8 @@ 💣 NUMBER OF MINES {{ game.game.mineCount }} + + Copy to Clipboard @@ -124,11 +126,21 @@ export default { copyStatsToClipboard() { const date = new Date(); - let string = `✨ #EOxMinesweeper Challenge ${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()} + var string; + + if (this.mode === 'win') { + string = `✨ #EOxMinesweeper Challenge ${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()} 🌟 TOTAL ELAPSED TIME: ${this.elapsedSeconds} seconds 🔳 NUMBER OF CELLS: ${this.game.game.fieldCount} 💣 NUMBER OF MINES: ${this.game.game.mineCount}`; + } else if (this.mode === 'gameover') { + string = `✨ #EOxMinesweeper Challenge ${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()} + +🌟 TOTAL UNCOVERED AREA: ${Math.round(this.game.game.getUncoveredAreaPercent() * 100)}% +🔳 NUMBER OF CELLS: ${this.game.game.fieldCount} +💣 NUMBER OF MINES: ${this.game.game.mineCount}`; + } navigator.clipboard.writeText(string);