|
|
@ -1,15 +1,51 @@
|
|
|
|
|
|
|
|
import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
|
|
|
|
import React, { useMemo } from 'react';
|
|
|
|
import React, { useMemo } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import Album from 'Album/Album';
|
|
|
|
import Album from 'Album/Album';
|
|
|
|
import { icons } from 'Helpers/Props';
|
|
|
|
import { icons } from 'Helpers/Props';
|
|
|
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
|
|
import createUISettingsSelector from 'Store/Selectors/createUISettingsSelector';
|
|
|
|
import dimensions from 'Styles/Variables/dimensions';
|
|
|
|
import dimensions from 'Styles/Variables/dimensions';
|
|
|
|
|
|
|
|
import QualityProfile from 'typings/QualityProfile';
|
|
|
|
|
|
|
|
import { UiSettings } from 'typings/UiSettings';
|
|
|
|
import formatDateTime from 'Utilities/Date/formatDateTime';
|
|
|
|
import formatDateTime from 'Utilities/Date/formatDateTime';
|
|
|
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
|
|
|
import getRelativeDate from 'Utilities/Date/getRelativeDate';
|
|
|
|
import formatBytes from 'Utilities/Number/formatBytes';
|
|
|
|
import formatBytes from 'Utilities/Number/formatBytes';
|
|
|
|
|
|
|
|
import translate from 'Utilities/String/translate';
|
|
|
|
import ArtistIndexOverviewInfoRow from './ArtistIndexOverviewInfoRow';
|
|
|
|
import ArtistIndexOverviewInfoRow from './ArtistIndexOverviewInfoRow';
|
|
|
|
import styles from './ArtistIndexOverviewInfo.css';
|
|
|
|
import styles from './ArtistIndexOverviewInfo.css';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface RowProps {
|
|
|
|
|
|
|
|
name: string;
|
|
|
|
|
|
|
|
showProp: string;
|
|
|
|
|
|
|
|
valueProp: string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface RowInfoProps {
|
|
|
|
|
|
|
|
title: string;
|
|
|
|
|
|
|
|
iconName: IconDefinition;
|
|
|
|
|
|
|
|
label: string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface ArtistIndexOverviewInfoProps {
|
|
|
|
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
showMonitored: boolean;
|
|
|
|
|
|
|
|
showQualityProfile: boolean;
|
|
|
|
|
|
|
|
showLastAlbum: boolean;
|
|
|
|
|
|
|
|
showAdded: boolean;
|
|
|
|
|
|
|
|
showAlbumCount: boolean;
|
|
|
|
|
|
|
|
showPath: boolean;
|
|
|
|
|
|
|
|
showSizeOnDisk: boolean;
|
|
|
|
|
|
|
|
monitored: boolean;
|
|
|
|
|
|
|
|
nextAlbum?: Album;
|
|
|
|
|
|
|
|
qualityProfile?: QualityProfile;
|
|
|
|
|
|
|
|
lastAlbum?: Album;
|
|
|
|
|
|
|
|
added?: string;
|
|
|
|
|
|
|
|
albumCount: number;
|
|
|
|
|
|
|
|
path: string;
|
|
|
|
|
|
|
|
sizeOnDisk?: number;
|
|
|
|
|
|
|
|
sortKey: string;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const infoRowHeight = parseInt(dimensions.artistIndexOverviewInfoRowHeight);
|
|
|
|
const infoRowHeight = parseInt(dimensions.artistIndexOverviewInfoRowHeight);
|
|
|
|
|
|
|
|
|
|
|
|
const rows = [
|
|
|
|
const rows = [
|
|
|
@ -50,11 +86,17 @@ const rows = [
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
function getInfoRowProps(
|
|
|
|
|
|
|
|
row: RowProps,
|
|
|
|
|
|
|
|
props: ArtistIndexOverviewInfoProps,
|
|
|
|
|
|
|
|
uiSettings: UiSettings
|
|
|
|
|
|
|
|
): RowInfoProps | null {
|
|
|
|
const { name } = row;
|
|
|
|
const { name } = row;
|
|
|
|
|
|
|
|
|
|
|
|
if (name === 'monitored') {
|
|
|
|
if (name === 'monitored') {
|
|
|
|
const monitoredText = props.monitored ? 'Monitored' : 'Unmonitored';
|
|
|
|
const monitoredText = props.monitored
|
|
|
|
|
|
|
|
? translate('Monitored')
|
|
|
|
|
|
|
|
: translate('Unmonitored');
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: monitoredText,
|
|
|
|
title: monitoredText,
|
|
|
@ -63,9 +105,9 @@ function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (name === 'qualityProfileId') {
|
|
|
|
if (name === 'qualityProfileId' && !!props.qualityProfile?.name) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: 'Quality Profile',
|
|
|
|
title: translate('QualityProfile'),
|
|
|
|
iconName: icons.PROFILE,
|
|
|
|
iconName: icons.PROFILE,
|
|
|
|
label: props.qualityProfile.name,
|
|
|
|
label: props.qualityProfile.name,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -78,15 +120,16 @@ function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: `Last Album: ${lastAlbum.title}`,
|
|
|
|
title: `Last Album: ${lastAlbum.title}`,
|
|
|
|
iconName: icons.CALENDAR,
|
|
|
|
iconName: icons.CALENDAR,
|
|
|
|
label: getRelativeDate(
|
|
|
|
label:
|
|
|
|
lastAlbum.releaseDate,
|
|
|
|
getRelativeDate(
|
|
|
|
shortDateFormat,
|
|
|
|
lastAlbum.releaseDate,
|
|
|
|
showRelativeDates,
|
|
|
|
shortDateFormat,
|
|
|
|
{
|
|
|
|
showRelativeDates,
|
|
|
|
timeFormat,
|
|
|
|
{
|
|
|
|
timeForToday: true,
|
|
|
|
timeFormat,
|
|
|
|
}
|
|
|
|
timeForToday: true,
|
|
|
|
),
|
|
|
|
}
|
|
|
|
|
|
|
|
) ?? '',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -98,10 +141,11 @@ function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: `Added: ${formatDateTime(added, longDateFormat, timeFormat)}`,
|
|
|
|
title: `Added: ${formatDateTime(added, longDateFormat, timeFormat)}`,
|
|
|
|
iconName: icons.ADD,
|
|
|
|
iconName: icons.ADD,
|
|
|
|
label: getRelativeDate(added, shortDateFormat, showRelativeDates, {
|
|
|
|
label:
|
|
|
|
timeFormat,
|
|
|
|
getRelativeDate(added, shortDateFormat, showRelativeDates, {
|
|
|
|
timeForToday: true,
|
|
|
|
timeFormat,
|
|
|
|
}),
|
|
|
|
timeForToday: true,
|
|
|
|
|
|
|
|
}) ?? '',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -116,7 +160,7 @@ function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: 'Album Count',
|
|
|
|
title: translate('AlbumCount'),
|
|
|
|
iconName: icons.CIRCLE,
|
|
|
|
iconName: icons.CIRCLE,
|
|
|
|
label: albums,
|
|
|
|
label: albums,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -124,7 +168,7 @@ function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
|
|
|
|
|
|
|
|
if (name === 'path') {
|
|
|
|
if (name === 'path') {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: 'Path',
|
|
|
|
title: translate('Path'),
|
|
|
|
iconName: icons.FOLDER,
|
|
|
|
iconName: icons.FOLDER,
|
|
|
|
label: props.path,
|
|
|
|
label: props.path,
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -132,31 +176,13 @@ function getInfoRowProps(row, props, uiSettings) {
|
|
|
|
|
|
|
|
|
|
|
|
if (name === 'sizeOnDisk') {
|
|
|
|
if (name === 'sizeOnDisk') {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
title: 'Size on Disk',
|
|
|
|
title: translate('SizeOnDisk'),
|
|
|
|
iconName: icons.DRIVE,
|
|
|
|
iconName: icons.DRIVE,
|
|
|
|
label: formatBytes(props.sizeOnDisk),
|
|
|
|
label: formatBytes(props.sizeOnDisk),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface ArtistIndexOverviewInfoProps {
|
|
|
|
return null;
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
showMonitored: boolean;
|
|
|
|
|
|
|
|
showQualityProfile: boolean;
|
|
|
|
|
|
|
|
showLastAlbum: boolean;
|
|
|
|
|
|
|
|
showAdded: boolean;
|
|
|
|
|
|
|
|
showAlbumCount: boolean;
|
|
|
|
|
|
|
|
showPath: boolean;
|
|
|
|
|
|
|
|
showSizeOnDisk: boolean;
|
|
|
|
|
|
|
|
monitored: boolean;
|
|
|
|
|
|
|
|
nextAlbum?: Album;
|
|
|
|
|
|
|
|
qualityProfile: object;
|
|
|
|
|
|
|
|
lastAlbum?: Album;
|
|
|
|
|
|
|
|
added?: string;
|
|
|
|
|
|
|
|
albumCount: number;
|
|
|
|
|
|
|
|
path: string;
|
|
|
|
|
|
|
|
sizeOnDisk?: number;
|
|
|
|
|
|
|
|
sortKey: string;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function ArtistIndexOverviewInfo(props: ArtistIndexOverviewInfoProps) {
|
|
|
|
function ArtistIndexOverviewInfo(props: ArtistIndexOverviewInfoProps) {
|
|
|
@ -175,6 +201,8 @@ function ArtistIndexOverviewInfo(props: ArtistIndexOverviewInfoProps) {
|
|
|
|
const { name, showProp, valueProp } = row;
|
|
|
|
const { name, showProp, valueProp } = row;
|
|
|
|
|
|
|
|
|
|
|
|
const isVisible =
|
|
|
|
const isVisible =
|
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
|
|
|
|
|
|
// @ts-ignore ts(7053)
|
|
|
|
props[valueProp] != null && (props[showProp] || props.sortKey === name);
|
|
|
|
props[valueProp] != null && (props[showProp] || props.sortKey === name);
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -219,6 +247,10 @@ function ArtistIndexOverviewInfo(props: ArtistIndexOverviewInfoProps) {
|
|
|
|
|
|
|
|
|
|
|
|
const infoRowProps = getInfoRowProps(row, props, uiSettings);
|
|
|
|
const infoRowProps = getInfoRowProps(row, props, uiSettings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (infoRowProps == null) {
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return <ArtistIndexOverviewInfoRow key={row.name} {...infoRowProps} />;
|
|
|
|
return <ArtistIndexOverviewInfoRow key={row.name} {...infoRowProps} />;
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|