-
Notifications
You must be signed in to change notification settings - Fork 225
Various Architecture Improvements #913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9c2193c to
f894138
Compare
f894138 to
2e790c5
Compare
810a512 to
58d4ed1
Compare
889bdc4 to
c7603ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR performs a significant architectural refactoring that consolidates player state management by moving queue and playback state from Zustand store into the Player class itself, and replacing the MediaSessionEvents component with integrated MediaSession logic directly in the player.
Key changes:
- Merged player state management into a single
Playerclass using EventEmitter for React integration - Removed
usePlayerStoreZustand store andPlayerStatusenum in favor of direct player instance usage - Consolidated MediaSession event handling into the Player class constructor
Reviewed Changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/player.ts | Significantly expanded to include queue management, state emission via EventEmitter, and MediaSession integration |
| src/stores/usePlayerStore.ts | Completely removed - all functionality moved to player.ts |
| src/hooks/usePlayer.ts | New hook file providing usePlayerState and related hooks using useSyncExternalStore |
| src/components/MediaSessionEvents.tsx | Removed - MediaSession logic moved into Player class |
| src/types/museeks.ts | Removed PlayerStatus enum (replaced with isPaused boolean) |
| src/components/*.tsx | Updated to use player instance and usePlayerState hook instead of Zustand store |
| src/routes/*.tsx | Updated to use player.getQueueOrigin() instead of accessing store state |
| package.json | Replaced lefthook with simple-git-hooks, added eventemitter3 dependency |
| src/translations/*.po | Updated line number references due to code reorganization |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Big refactoring done using Claude. Will take some time to review later, but the nature of the change is great.