mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 12:30:06 +02:00
handle favorite/rating events for all tables
This commit is contained in:
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user