Skip to content

feat(react-chess-game): introduce typed game events and AudioManager for sound system#81

Merged
dancamma merged 7 commits into
mainfrom
feat/audio-manager-refactor
Jul 11, 2026
Merged

feat(react-chess-game): introduce typed game events and AudioManager for sound system#81
dancamma merged 7 commits into
mainfrom
feat/audio-manager-refactor

Conversation

@dancamma

@dancamma dancamma commented Mar 10, 2026

Copy link
Copy Markdown
Owner

Summary

Redesigns the sound system with a typed event architecture and centralized audio management:

  • Typed game events: New ChessGameEvent discriminated union with detailed event payloads (move-made, illegal-move, clock-timeout) including check/checkmate/draw state, move details, and timeout player info

  • AudioManager utility: Centralized audio handling with preloaded HTMLAudioElement instances for each sound type, proper cleanup via destroy(), and graceful fallback for SSR/test environments

  • Smart sound mapping: Maps game events to appropriate audio events with priority-based logic (checkmate → draw → promotion → castling → capture → check → move)

  • Bundled audio assets: Includes OGG sound files for capture, move, notify, timeout, and silence (for illegal moves)

Test plan

  • npm test passes
  • npm run build succeeds
  • AudioManager tests cover play, destroy, SSR fallback
  • useBoardSounds tests cover event-to-sound mapping

🤖 Generated with Claude Code

@vercel

vercel Bot commented Mar 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-chess-tools Ready Ready Preview, Comment Mar 11, 2026 3:49pm

@changeset-bot

changeset-bot Bot commented Mar 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7a4efdb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@react-chess-tools/react-chess-game Major
@react-chess-tools/react-chess-puzzle Major
@react-chess-tools/react-chess-bot Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

The error sound was replaced with silence for illegal moves,
but the test wasn't updated to reflect this change.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dancamma dancamma changed the title feat(react-chess-game): redesign sound system with AudioManager feat(react-chess-game): introduce typed game events and AudioManager for sound system Mar 11, 2026
The file was causing a lint error because it's not part of the
TypeScript project but was being parsed by the TypeScript parser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dancamma
dancamma merged commit da6ce4d into main Jul 11, 2026
3 checks passed
@dancamma
dancamma deleted the feat/audio-manager-refactor branch July 11, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant