Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Electron game plugin, Orbit Sprite Memory, integrating with the existing game registry/plugin architecture and progress system, plus updates the game selection card to display broader progress stats.
Changes:
- Introduces the
orbit-sprite-memorygame plugin (UI/controller, pure game logic, manifest, HTML, CSS, image assets). - Adds Jest coverage for the new game’s logic and plugin lifecycle/helpers.
- Updates
createGameCard()to display saved stats for more games (e.g., highest level), with corresponding test updates.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/games/orbit-sprite-memory/index.js | New plugin controller/UI layer, lifecycle, timers, accessibility announcements, and progress persistence |
| app/games/orbit-sprite-memory/game.js | New pure logic module for round generation, scoring, and difficulty |
| app/games/orbit-sprite-memory/interface.html | New accessible UI markup for the game |
| app/games/orbit-sprite-memory/style.css | New scoped styling for the game UI |
| app/games/orbit-sprite-memory/manifest.json | Registers the new game (id, entry point, thumbnail, metadata) |
| app/games/orbit-sprite-memory/tests/index.test.js | Plugin contract + helper/UI behavior tests (with mocked game logic) |
| app/games/orbit-sprite-memory/tests/game.test.js | Unit tests for pure logic module |
| app/components/gameCard.js | Expands displayed progress stats on game cards |
| app/components/gameCard.test.js | Updates/extends tests for the new card stats behavior |
| showRoundReveal(_currentRound); | ||
|
|
||
| clearTimers(); | ||
| _timers.push(setTimeout(() => { | ||
| clearRevealSprites(); |
There was a problem hiding this comment.
In submitSelection(), clearTimers() is called after flashBoard(), which cancels the timeout that removes the success/failure class. This makes the board highlight persist until the next round resets it rather than flashing briefly. Consider clearing existing playback timers before calling flashBoard(), or keeping flash cleanup timers separate so they aren’t cleared here.
| * Initializes the plugin and wires UI events. | ||
| * | ||
| * @param {HTMLElement} gameContainer - Injected game container. | ||
| */ | ||
| function init(gameContainer) { | ||
| _container = gameContainer; | ||
| game.initGame(); | ||
| clearTimers(); | ||
|
|
||
| if (!_container) return; |
There was a problem hiding this comment.
The init() JSDoc says the parameter is an HTMLElement, but the implementation explicitly supports null/undefined (and there is a test covering init(null)). Update the JSDoc type to reflect that (e.g., HTMLElement|null) to keep docs consistent with behavior.
| // Show saved stats when available. | ||
| let scoreElem = null; | ||
| if (manifest.id === 'fast-piggie' && progress) { | ||
| if (progress) { | ||
| scoreElem = document.createElement('p'); | ||
| scoreElem.className = 'game-high-score'; | ||
| const details = []; | ||
| if (typeof progress.highScore === 'number') details.push(`Top Score: ${progress.highScore}`); | ||
| if (typeof progress.highestLevel === 'number') details.push(`Max Level: ${progress.highestLevel + 1}`); | ||
| if (typeof progress.maxLevel === 'number') details.push(`Max Level: ${progress.maxLevel}`); | ||
| if (typeof progress.maxPiggies === 'number') details.push(`Max Piggies: ${progress.maxPiggies}`); | ||
| if (typeof progress.lowestDisplayTime === 'number') details.push(`Lowest Display Time: ${progress.lowestDisplayTime}ms`); | ||
| scoreElem.textContent = details.join(' | '); | ||
| scoreElem.setAttribute('aria-label', `Stats for ${manifest.name}: ${scoreElem.textContent}`); | ||
| if (details.length > 0) { | ||
| scoreElem.textContent = details.join(' | '); | ||
| scoreElem.setAttribute('aria-label', `Stats for ${manifest.name}: ${scoreElem.textContent}`); | ||
| } else { | ||
| scoreElem = null; | ||
| } |
There was a problem hiding this comment.
createGameCard() now renders additional progress details (e.g., highestLevel, maxPiggies, lowestDisplayTime), but the function JSDoc only documents progress.highScore. Please update the JSDoc for the progress parameter to include the additional supported fields so callers know what is displayed.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
…teGameCard Co-authored-by: acrosman <2972053+acrosman@users.noreply.github.com> Agent-Logs-Url: https://github.com/acrosman/BrainSpeedExercises/sessions/c59600aa-4016-4483-8135-bbf8b78db514
Fix flash timer cancellation, update JSDoc for init and createGameCard
Uses rabbits as images in another memory style game.