mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-11 07:12:44 +01:00
impl starring everywhere
This commit is contained in:
@@ -39,18 +39,23 @@ export const usePlaylistWithSongs = (id: string) => {
|
||||
}
|
||||
|
||||
export const useStarred = (id: string, type: string) => {
|
||||
const starred = useStore(
|
||||
return useStore(
|
||||
useCallback(
|
||||
(state: Store) => {
|
||||
if (!(type in state.starred)) {
|
||||
return false
|
||||
switch (type) {
|
||||
case 'song':
|
||||
return state.starredSongs[id]
|
||||
case 'album':
|
||||
return state.starredAlbums[id]
|
||||
case 'artist':
|
||||
return state.starredArtists[id]
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return !!state.starred[type][id]
|
||||
},
|
||||
[type, id],
|
||||
),
|
||||
)
|
||||
return starred
|
||||
}
|
||||
|
||||
export const useCoverArtUri = () => {
|
||||
|
||||
Reference in New Issue
Block a user