Add buttons for deleting downloaded tracks from playlist or album
This commit is contained in:
13
src/store/downloads/selectors.ts
Normal file
13
src/store/downloads/selectors.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { createSelector, EntityId } from '@reduxjs/toolkit';
|
||||
import { intersection } from 'lodash';
|
||||
import { AppState } from 'store';
|
||||
|
||||
export const selectDownloadedTracks = (trackIds: EntityId[]) => (
|
||||
createSelector(
|
||||
(state: AppState) => state.downloads,
|
||||
({ entities, ids }) => {
|
||||
return intersection(trackIds, ids)
|
||||
.filter((id) => entities[id]?.isComplete);
|
||||
}
|
||||
)
|
||||
);
|
||||
Reference in New Issue
Block a user