From a3f7824612f1cee34c2a0f9f6d2840665052ee66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Jovan=C3=AD=20Gonz=C3=A1lez?= <12443324+drackp2m@users.noreply.github.com> Date: Wed, 30 Oct 2024 21:44:16 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(app):=20restored=20ability=20t?= =?UTF-8?q?o=20add=20cards=20to=20the=20board?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/app/eslint.config.mjs | 3 +++ apps/app/src/app/page/game/store/game.store.ts | 14 +++++++++----- libs/api-definitions/eslint.config.mjs | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/app/eslint.config.mjs b/apps/app/eslint.config.mjs index 64486bd7..8ada7e9c 100644 --- a/apps/app/eslint.config.mjs +++ b/apps/app/eslint.config.mjs @@ -44,6 +44,9 @@ export default [ { files: ['**/*.html'], rules: { + 'sonarjs/no-element-overwrite': 'off', + 'sonarjs/no-same-line-conditional': 'off', + 'sonarjs/no-unenclosed-multiline-block': 'off', 'prettier/prettier': 'warn', '@angular-eslint/template/click-events-have-key-events': 'warn', '@angular-eslint/template/interactive-supports-focus': 'warn', diff --git a/apps/app/src/app/page/game/store/game.store.ts b/apps/app/src/app/page/game/store/game.store.ts index d5ad545a..2a7a0fe0 100644 --- a/apps/app/src/app/page/game/store/game.store.ts +++ b/apps/app/src/app/page/game/store/game.store.ts @@ -28,9 +28,9 @@ export const GameStore = signalStore( patchState(store, initialState); }, newGame(): void { - const boardCards = gameService.getNewCards(store.boardCards(), 12); + const boardCards = gameService.getNewCards(store.boardCards(), 9); - patchState(store, { boardCards }); + patchState(store, { ...initialState, boardCards }); this._searchSetOnBoard(); }, @@ -73,9 +73,13 @@ export const GameStore = signalStore( patchState(store, { wrongSetCards: [...wrongSetCards, null, null, null] }); }, addCardsToBoard(): void { - for (let i = 0; i < 3; i++) { - // this.boardCards.update((cards) => [...cards, this.getValidCard()]); - } + const boardCards = store.boardCards(); + + const newCards = gameService.getNewCards(boardCards, 3); + + patchState(store, { boardCards: [...boardCards, ...newCards] }); + + this._searchSetOnBoard(); }, _searchSetOnBoard(): void { const boardCards = store.boardCards(); diff --git a/libs/api-definitions/eslint.config.mjs b/libs/api-definitions/eslint.config.mjs index a1c30ea2..594f1460 100644 --- a/libs/api-definitions/eslint.config.mjs +++ b/libs/api-definitions/eslint.config.mjs @@ -1,4 +1,5 @@ import parser from 'jsonc-eslint-parser'; + import baseConfig from '../../eslint.config.mjs'; export default [ @@ -24,7 +25,6 @@ export default [ languageOptions: { parser: parser, }, - rules: { '@nx/dependency-checks': 'error', },