42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
import React from "react"
|
|
import PropTypes from "prop-types"
|
|
|
|
export const TrackingLabel = ({ wishlisted, inLibrary, trackedSeason, trackedEpisode }) => {
|
|
if (wishlisted === false) {
|
|
return null;
|
|
}
|
|
|
|
if (wishlisted === true && inLibrary === true) {
|
|
return null;
|
|
}
|
|
|
|
if (trackedEpisode === null && trackedSeason === null) {
|
|
return null;
|
|
}
|
|
|
|
let str = ""
|
|
if (trackedSeason === 0 && trackedEpisode === 0) {
|
|
str = "All the episodes will be downloaded automatically";
|
|
} else if (trackedSeason > 0 && trackedEpisode > 0) {
|
|
str = `All the episodes will be downloaded automatically starting from
|
|
season ${trackedSeason} episode ${trackedEpisode}`;
|
|
} else {
|
|
str = "This movie will be downloaded automatically"
|
|
}
|
|
|
|
return (
|
|
<span>
|
|
<small>
|
|
<i className="fa fa-cloud-upload mr-1" />
|
|
{str}
|
|
</small>
|
|
</span>
|
|
)
|
|
}
|
|
TrackingLabel.propTypes = {
|
|
wishlisted: PropTypes.bool,
|
|
inLibrary: PropTypes.bool,
|
|
trackedSeason: PropTypes.number,
|
|
trackedEpisode: PropTypes.number,
|
|
};
|