import React from 'react'; import Album from 'Album/Album'; import TagListConnector from 'Components/TagListConnector'; import MetadataProfile from 'typings/MetadataProfile'; import QualityProfile from 'typings/QualityProfile'; import formatDateTime from 'Utilities/Date/formatDateTime'; import getRelativeDate from 'Utilities/Date/getRelativeDate'; import formatBytes from 'Utilities/Number/formatBytes'; import translate from 'Utilities/String/translate'; import styles from './ArtistIndexPosterInfo.css'; 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) { const { artistType, qualityProfile, metadataProfile, showQualityProfile, showNextAlbum, nextAlbum, lastAlbum, added, albumCount, path, sizeOnDisk, tags, sortKey, showRelativeDates, shortDateFormat, longDateFormat, timeFormat, } = props; if (sortKey === 'artistType' && artistType) { return (
{artistType}
); } if ( sortKey === 'qualityProfileId' && !showQualityProfile && !!qualityProfile?.name ) { return (
{qualityProfile.name}
); } if (sortKey === 'metadataProfileId' && !!metadataProfile?.name) { return (
{metadataProfile.name}
); } if (sortKey === 'nextAlbum' && !showNextAlbum && !!nextAlbum?.releaseDate) { return (
{getRelativeDate( nextAlbum.releaseDate, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: true, } )}
); } if (sortKey === 'lastAlbum' && !!lastAlbum?.releaseDate) { return (
{getRelativeDate( lastAlbum.releaseDate, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: true, } )}
); } if (sortKey === 'added' && added) { const addedDate = getRelativeDate( added, shortDateFormat, showRelativeDates, { timeFormat, timeForToday: false, } ); return (
{translate('Added')}: {addedDate}
); } if (sortKey === 'albumCount') { let albums = translate('OneAlbum'); if (albumCount === 0) { albums = translate('NoAlbums'); } else if (albumCount > 1) { albums = translate('CountAlbums', { albumCount }); } return
{albums}
; } if (sortKey === 'path') { return (
{path}
); } if (sortKey === 'sizeOnDisk') { return (
{formatBytes(sizeOnDisk)}
); } if (sortKey === 'tags' && tags) { return (
); } return null; } export default ArtistIndexPosterInfo;