Skip to content

Commit

Permalink
feat: also provide stats copy-button when the game is lost
Browse files Browse the repository at this point in the history
  • Loading branch information
spectrachrome committed Jan 19, 2024
1 parent 1172627 commit b5f1075
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/src/components/Modal/MinesweeperDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<span class="name">💣 NUMBER OF MINES</span>
<span class="value">{{ game.game.mineCount }}</span>
</div>

<v-btn style="font-weight: bold;" ref="copy-btn" color="secondary" text @click="copyStatsToClipboard()">Copy to Clipboard</v-btn>

Check failure on line 50 in app/src/components/Modal/MinesweeperDialog.vue

View workflow job for this annotation

GitHub Actions / deploy

This line has a length of 141. Maximum allowed is 100
</div>
</v-card-text>

Expand Down Expand Up @@ -124,11 +126,21 @@ export default {
copyStatsToClipboard() {
const date = new Date();
let string = `✨ #EOxMinesweeper Challenge ${date.getDate()}.${date.getMonth() + 1}.${date.getFullYear()}
var string;

Check failure on line 129 in app/src/components/Modal/MinesweeperDialog.vue

View workflow job for this annotation

GitHub Actions / deploy

Unexpected var, use let or const instead
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);
Expand Down

0 comments on commit b5f1075

Please sign in to comment.