mirror of https://github.com/lidarr/Lidarr
126 lines
2.6 KiB
JavaScript
126 lines
2.6 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import isBefore from 'Utilities/Date/isBefore';
|
|
import { icons, kinds, sizes } from 'Helpers/Props';
|
|
import Icon from 'Components/Icon';
|
|
import ProgressBar from 'Components/ProgressBar';
|
|
import QueueDetails from 'Activity/Queue/QueueDetails';
|
|
// import TrackQuality from './TrackQuality';
|
|
import styles from './AlbumStatus.css';
|
|
|
|
function AlbumStatus(props) {
|
|
const {
|
|
releaseDate,
|
|
monitored,
|
|
grabbed,
|
|
queueItem
|
|
} = props;
|
|
|
|
// const hasTrackFile = !!trackFile;
|
|
const isQueued = !!queueItem;
|
|
const hasReleased = isBefore(releaseDate);
|
|
|
|
if (isQueued) {
|
|
const {
|
|
sizeleft,
|
|
size
|
|
} = queueItem;
|
|
|
|
const progress = (100 - sizeleft / size * 100);
|
|
|
|
return (
|
|
<div className={styles.center}>
|
|
<QueueDetails
|
|
{...queueItem}
|
|
progressBar={
|
|
<ProgressBar
|
|
title={`Album is downloading - ${progress.toFixed(1)}% ${queueItem.title}`}
|
|
progress={progress}
|
|
kind={kinds.PURPLE}
|
|
size={sizes.MEDIUM}
|
|
/>
|
|
}
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (grabbed) {
|
|
return (
|
|
<div className={styles.center}>
|
|
<Icon
|
|
name={icons.DOWNLOADING}
|
|
title="Album is downloading"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// if (hasTrackFile) {
|
|
// const quality = trackFile.quality;
|
|
// const isCutoffNotMet = trackFile.qualityCutoffNotMet;
|
|
|
|
// return (
|
|
// <div className={styles.center}>
|
|
// <TrackQuality
|
|
// quality={quality}
|
|
// size={trackFile.size}
|
|
// isCutoffNotMet={isCutoffNotMet}
|
|
// title="Track Downloaded"
|
|
// />
|
|
// </div>
|
|
// );
|
|
// }
|
|
|
|
if (!releaseDate) {
|
|
return (
|
|
<div className={styles.center}>
|
|
<Icon
|
|
name={icons.TBA}
|
|
title="TBA"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (!monitored) {
|
|
return (
|
|
<div className={styles.center}>
|
|
<Icon
|
|
name={icons.UNMONITORED}
|
|
title="Album is not monitored"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (hasReleased) {
|
|
return (
|
|
<div className={styles.center}>
|
|
<Icon
|
|
name={icons.MISSING}
|
|
title="Album missing from disk"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={styles.center}>
|
|
<Icon
|
|
name={icons.NOT_AIRED}
|
|
title="Album has not released"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
AlbumStatus.propTypes = {
|
|
releaseDate: PropTypes.string,
|
|
monitored: PropTypes.bool,
|
|
grabbed: PropTypes.bool,
|
|
queueItem: PropTypes.object
|
|
};
|
|
|
|
export default AlbumStatus;
|