(cherry picked from commit ac806a2933bf2dc0c96d471ec143fca8e1f5282f)pull/4532/head
parent
f1dede240d
commit
af12fad185
@ -0,0 +1,36 @@
|
||||
import { createSelector } from 'reselect';
|
||||
import AppState from 'App/State/AppState';
|
||||
|
||||
export interface ArtistQueueDetails {
|
||||
count: number;
|
||||
tracksWithFiles: number;
|
||||
}
|
||||
|
||||
function createArtistQueueDetailsSelector(artistId: number) {
|
||||
return createSelector(
|
||||
(state: AppState) => state.queue.details.items,
|
||||
(queueItems) => {
|
||||
return queueItems.reduce(
|
||||
(acc: ArtistQueueDetails, item) => {
|
||||
if (item.artistId !== artistId) {
|
||||
return acc;
|
||||
}
|
||||
|
||||
acc.count += item.trackFileCount ?? 0;
|
||||
|
||||
if (item.trackHasFileCount) {
|
||||
acc.tracksWithFiles += item.trackHasFileCount;
|
||||
}
|
||||
|
||||
return acc;
|
||||
},
|
||||
{
|
||||
count: 0,
|
||||
tracksWithFiles: 0,
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export default createArtistQueueDetailsSelector;
|
@ -1,6 +1,15 @@
|
||||
import { kinds } from 'Helpers/Props';
|
||||
|
||||
function getProgressBarKind(status, monitored, progress) {
|
||||
function getProgressBarKind(
|
||||
status: string,
|
||||
monitored: boolean,
|
||||
progress: number,
|
||||
isDownloading: boolean
|
||||
) {
|
||||
if (isDownloading) {
|
||||
return kinds.PURPLE;
|
||||
}
|
||||
|
||||
if (progress === 100) {
|
||||
return status === 'ended' ? kinds.SUCCESS : kinds.PRIMARY;
|
||||
}
|
Loading…
Reference in new issue