mirror of
https://github.com/Readarr/Readarr
synced 2025-12-20 15:23:55 +01:00
30 lines
530 B
JavaScript
30 lines
530 B
JavaScript
/* eslint max-params: 0 */
|
|
import moment from 'moment';
|
|
|
|
function getStatusStyle(episodeNumber, downloading, startTime, isMonitored, percentOfBooks) {
|
|
const currentTime = moment();
|
|
|
|
if (percentOfBooks === 100) {
|
|
return 'downloaded';
|
|
}
|
|
|
|
if (percentOfBooks > 0) {
|
|
return 'partial';
|
|
}
|
|
|
|
if (downloading) {
|
|
return 'downloading';
|
|
}
|
|
|
|
if (!isMonitored) {
|
|
return 'unmonitored';
|
|
}
|
|
|
|
if (currentTime.isAfter(startTime)) {
|
|
return 'missing';
|
|
}
|
|
|
|
return 'unreleased';
|
|
}
|
|
|
|
export default getStatusStyle;
|