handle favorite/rating events for all tables

This commit is contained in:
jeffvli
2025-11-18 14:07:46 -08:00
parent 63e6df0481
commit 69f7f5c236
9 changed files with 118 additions and 13 deletions
+10 -1
View File
@@ -1448,7 +1448,6 @@ export const usePlayerData = (): PlayerData => {
export const updateQueueFavorites = (ids: string[], favorite: boolean) => {
usePlayerStoreBase.setState((state) => {
// Update songs in the songs object
Object.values(state.queue.songs).forEach((song) => {
if (ids.includes(song.id)) {
song.userFavorite = favorite;
@@ -1457,6 +1456,16 @@ export const updateQueueFavorites = (ids: string[], favorite: boolean) => {
});
};
export const updateQueueRatings = (ids: string[], rating: null | number) => {
usePlayerStoreBase.setState((state) => {
Object.values(state.queue.songs).forEach((song) => {
if (ids.includes(song.id)) {
song.userRating = rating;
}
});
});
};
export const usePlayerMuted = () => {
return usePlayerStoreBase((state) => state.player.muted);
};