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.
188 lines
4.2 KiB
188 lines
4.2 KiB
7 years ago
|
import React from 'react';
|
||
2 years ago
|
import Album from 'Album/Album';
|
||
1 year ago
|
import TagListConnector from 'Components/TagListConnector';
|
||
2 years ago
|
import MetadataProfile from 'typings/MetadataProfile';
|
||
|
import QualityProfile from 'typings/QualityProfile';
|
||
1 year ago
|
import formatDateTime from 'Utilities/Date/formatDateTime';
|
||
7 years ago
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
||
|
import formatBytes from 'Utilities/Number/formatBytes';
|
||
1 year ago
|
import translate from 'Utilities/String/translate';
|
||
7 years ago
|
import styles from './ArtistIndexPosterInfo.css';
|
||
|
|
||
2 years ago
|
interface ArtistIndexPosterInfoProps {
|
||
|
artistType?: string;
|
||
|
showQualityProfile: boolean;
|
||
|
qualityProfile?: QualityProfile;
|
||
|
metadataProfile?: MetadataProfile;
|
||
|
showNextAlbum: boolean;
|
||
|
nextAlbum?: Album;
|
||
|
lastAlbum?: Album;
|
||
|
added?: string;
|
||
|
albumCount: number;
|
||
|
path: string;
|
||
|
sizeOnDisk?: number;
|
||
|
tags?: number[];
|
||
|
sortKey: string;
|
||
|
showRelativeDates: boolean;
|
||
|
shortDateFormat: string;
|
||
|
longDateFormat: string;
|
||
|
timeFormat: string;
|
||
|
}
|
||
|
|
||
|
function ArtistIndexPosterInfo(props: ArtistIndexPosterInfoProps) {
|
||
7 years ago
|
const {
|
||
1 year ago
|
artistType,
|
||
7 years ago
|
qualityProfile,
|
||
2 years ago
|
metadataProfile,
|
||
7 years ago
|
showQualityProfile,
|
||
1 year ago
|
showNextAlbum,
|
||
|
nextAlbum,
|
||
|
lastAlbum,
|
||
7 years ago
|
added,
|
||
7 years ago
|
albumCount,
|
||
7 years ago
|
path,
|
||
7 years ago
|
sizeOnDisk,
|
||
1 year ago
|
tags,
|
||
7 years ago
|
sortKey,
|
||
|
showRelativeDates,
|
||
|
shortDateFormat,
|
||
1 year ago
|
longDateFormat,
|
||
2 years ago
|
timeFormat,
|
||
7 years ago
|
} = props;
|
||
|
|
||
1 year ago
|
if (sortKey === 'artistType' && artistType) {
|
||
|
return (
|
||
|
<div className={styles.info} title={translate('ArtistType')}>
|
||
|
{artistType}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
2 years ago
|
if (
|
||
|
sortKey === 'qualityProfileId' &&
|
||
|
!showQualityProfile &&
|
||
|
!!qualityProfile?.name
|
||
|
) {
|
||
7 years ago
|
return (
|
||
1 year ago
|
<div className={styles.info} title={translate('QualityProfile')}>
|
||
7 years ago
|
{qualityProfile.name}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
2 years ago
|
if (sortKey === 'metadataProfileId' && !!metadataProfile?.name) {
|
||
|
return (
|
||
|
<div className={styles.info} title={translate('MetadataProfile')}>
|
||
|
{metadataProfile.name}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
1 year ago
|
if (sortKey === 'nextAlbum' && !showNextAlbum && !!nextAlbum?.releaseDate) {
|
||
7 years ago
|
return (
|
||
1 year ago
|
<div
|
||
|
className={styles.info}
|
||
|
title={`${translate('NextAlbum')}: ${formatDateTime(
|
||
|
nextAlbum.releaseDate,
|
||
|
longDateFormat,
|
||
|
timeFormat
|
||
|
)}`}
|
||
|
>
|
||
2 years ago
|
{getRelativeDate(
|
||
|
nextAlbum.releaseDate,
|
||
|
shortDateFormat,
|
||
|
showRelativeDates,
|
||
|
{
|
||
|
timeFormat,
|
||
|
timeForToday: true,
|
||
|
}
|
||
|
)}
|
||
1 year ago
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'lastAlbum' && !!lastAlbum?.releaseDate) {
|
||
|
return (
|
||
|
<div
|
||
|
className={styles.info}
|
||
|
title={`${translate('LastAlbum')}: ${formatDateTime(
|
||
|
lastAlbum.releaseDate,
|
||
|
longDateFormat,
|
||
|
timeFormat
|
||
|
)}`}
|
||
|
>
|
||
2 years ago
|
{getRelativeDate(
|
||
|
lastAlbum.releaseDate,
|
||
|
shortDateFormat,
|
||
|
showRelativeDates,
|
||
|
{
|
||
|
timeFormat,
|
||
|
timeForToday: true,
|
||
|
}
|
||
|
)}
|
||
7 years ago
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'added' && added) {
|
||
|
const addedDate = getRelativeDate(
|
||
|
added,
|
||
|
shortDateFormat,
|
||
|
showRelativeDates,
|
||
|
{
|
||
|
timeFormat,
|
||
2 years ago
|
timeForToday: false,
|
||
7 years ago
|
}
|
||
|
);
|
||
|
|
||
|
return (
|
||
1 year ago
|
<div
|
||
|
className={styles.info}
|
||
|
title={formatDateTime(added, longDateFormat, timeFormat)}
|
||
|
>
|
||
|
{translate('Added')}: {addedDate}
|
||
7 years ago
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'albumCount') {
|
||
1 year ago
|
let albums = translate('OneAlbum');
|
||
7 years ago
|
|
||
|
if (albumCount === 0) {
|
||
1 year ago
|
albums = translate('NoAlbums');
|
||
7 years ago
|
} else if (albumCount > 1) {
|
||
1 year ago
|
albums = translate('CountAlbums', { albumCount });
|
||
7 years ago
|
}
|
||
|
|
||
2 years ago
|
return <div className={styles.info}>{albums}</div>;
|
||
7 years ago
|
}
|
||
|
|
||
|
if (sortKey === 'path') {
|
||
|
return (
|
||
1 year ago
|
<div className={styles.info} title={translate('Path')}>
|
||
7 years ago
|
{path}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
if (sortKey === 'sizeOnDisk') {
|
||
|
return (
|
||
1 year ago
|
<div className={styles.info} title={translate('SizeOnDisk')}>
|
||
7 years ago
|
{formatBytes(sizeOnDisk)}
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
2 years ago
|
if (sortKey === 'tags' && tags) {
|
||
1 year ago
|
return (
|
||
|
<div className={styles.info} title={translate('Tags')}>
|
||
2 years ago
|
<TagListConnector tags={tags} />
|
||
1 year ago
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
7 years ago
|
return null;
|
||
|
}
|
||
|
|
||
|
export default ArtistIndexPosterInfo;
|