You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
114 lines
2.3 KiB
114 lines
2.3 KiB
7 years ago
|
import PropTypes from 'prop-types';
|
||
|
import React from 'react';
|
||
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||
|
import styles from './ArtistIndexBannerInfo.css';
|
||
|
|
||
|
function ArtistIndexBannerInfo(props) {
|
||
|
const {
|
||
|
qualityProfile,
|
||
|
previousAiring,
|
||
|
added,
|
||
|
albumCount,
|
||
|
path,
|
||
|
sizeOnDisk,
|
||
|
sortKey,
|
||
|
showRelativeDates,
|
||
|
shortDateFormat,
|
||
|
timeFormat
|
||
|
} = props;
|
||
|
|
||
|
if (sortKey === 'qualityProfileId') {
|
||
|
return (
|
||
|
<div className={styles.info}>
|
||
|
{qualityProfile.name}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'previousAiring' && previousAiring) {
|
||
|
return (
|
||
|
<div className={styles.info}>
|
||
|
{
|
||
|
getRelativeDate(
|
||
|
previousAiring,
|
||
|
shortDateFormat,
|
||
|
showRelativeDates,
|
||
|
{
|
||
|
timeFormat,
|
||
|
timeForToday: true
|
||
|
}
|
||
|
)
|
||
|
}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'added' && added) {
|
||
|
const addedDate = getRelativeDate(
|
||
|
added,
|
||
|
shortDateFormat,
|
||
|
showRelativeDates,
|
||
|
{
|
||
|
timeFormat,
|
||
|
timeForToday: false
|
||
|
}
|
||
|
);
|
||
|
|
||
|
return (
|
||
|
<div className={styles.info}>
|
||
|
{`Added ${addedDate}`}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'albumCount') {
|
||
|
let albums = '1 album';
|
||
|
|
||
|
if (albumCount === 0) {
|
||
|
albums = 'No albums';
|
||
|
} else if (albumCount > 1) {
|
||
|
albums = `${albumCount} albums`;
|
||
|
}
|
||
|
|
||
|
return (
|
||
|
<div className={styles.info}>
|
||
|
{albums}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'path') {
|
||
|
return (
|
||
|
<div className={styles.info}>
|
||
|
{path}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'sizeOnDisk') {
|
||
|
return (
|
||
|
<div className={styles.info}>
|
||
|
{formatBytes(sizeOnDisk)}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
ArtistIndexBannerInfo.propTypes = {
|
||
|
qualityProfile: PropTypes.object.isRequired,
|
||
|
previousAiring: PropTypes.string,
|
||
|
added: PropTypes.string,
|
||
|
albumCount: PropTypes.number.isRequired,
|
||
|
path: PropTypes.string.isRequired,
|
||
|
sizeOnDisk: PropTypes.number,
|
||
|
sortKey: PropTypes.string.isRequired,
|
||
|
showRelativeDates: PropTypes.bool.isRequired,
|
||
|
shortDateFormat: PropTypes.string.isRequired,
|
||
|
timeFormat: PropTypes.string.isRequired
|
||
|
};
|
||
|
|
||
|
export default ArtistIndexBannerInfo;
|