impl star/unstar starred state

This commit is contained in:
austinried
2021-08-09 18:05:20 +09:00
parent 19c862b983
commit 0a3d542156
5 changed files with 145 additions and 38 deletions

View File

@@ -38,6 +38,21 @@ export const usePlaylistWithSongs = (id: string) => {
return playlist
}
export const useStarred = (id: string, type: string) => {
const starred = useStore(
useCallback(
(state: Store) => {
if (!(type in state.starred)) {
return false
}
return !!state.starred[type][id]
},
[type, id],
),
)
return starred
}
export const useCoverArtUri = () => {
const server = useStore(selectSettings.activeServer)