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.
126 lines
2.8 KiB
126 lines
2.8 KiB
import React from 'react';
|
|
import getProgressBarKind from 'Utilities/Series/getProgressBarKind';
|
|
import ProgressBar from 'Components/ProgressBar';
|
|
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
|
|
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
|
import QualityProfileNameConnector from 'Settings/Profiles/Quality/QualityProfileNameConnector';
|
|
import ArtistNameLink from 'Artist/ArtistNameLink';
|
|
import ArtistIndexItemConnector from 'Artist/Index/ArtistIndexItemConnector';
|
|
import ArtistIndexActionsCell from './ArtistIndexActionsCell';
|
|
import ArtistStatusCell from './ArtistStatusCell';
|
|
|
|
export default function artistIndexCellRenderers(cellProps) {
|
|
const {
|
|
cellKey,
|
|
dataKey,
|
|
rowData,
|
|
...otherProps
|
|
} = cellProps;
|
|
|
|
const {
|
|
id,
|
|
monitored,
|
|
status,
|
|
name,
|
|
nameSlug,
|
|
qualityProfileId,
|
|
nextAiring,
|
|
previousAiring,
|
|
albumCount,
|
|
trackCount,
|
|
trackFileCount
|
|
} = rowData;
|
|
|
|
const progress = trackCount ? trackFileCount / trackCount * 100 : 100;
|
|
|
|
if (dataKey === 'status') {
|
|
return (
|
|
<ArtistStatusCell
|
|
key={cellKey}
|
|
monitored={monitored}
|
|
status={status}
|
|
component={VirtualTableRowCell}
|
|
{...otherProps}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (dataKey === 'sortName') {
|
|
return (
|
|
<VirtualTableRowCell
|
|
key={cellKey}
|
|
{...otherProps}
|
|
>
|
|
<ArtistNameLink
|
|
nameSlug={nameSlug}
|
|
name={name}
|
|
/>
|
|
</VirtualTableRowCell>
|
|
|
|
);
|
|
}
|
|
|
|
if (dataKey === 'qualityProfileId') {
|
|
return (
|
|
<VirtualTableRowCell
|
|
key={cellKey}
|
|
{...otherProps}
|
|
>
|
|
<QualityProfileNameConnector
|
|
qualityProfileId={qualityProfileId}
|
|
/>
|
|
</VirtualTableRowCell>
|
|
);
|
|
}
|
|
|
|
if (dataKey === 'nextAiring') {
|
|
return (
|
|
<RelativeDateCellConnector
|
|
key={cellKey}
|
|
date={nextAiring}
|
|
component={VirtualTableRowCell}
|
|
{...otherProps}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (dataKey === 'albumCount') {
|
|
return (
|
|
<VirtualTableRowCell
|
|
key={cellKey}
|
|
{...otherProps}
|
|
>
|
|
{albumCount}
|
|
</VirtualTableRowCell>
|
|
);
|
|
}
|
|
|
|
if (dataKey === 'trackProgress') {
|
|
return (
|
|
<VirtualTableRowCell
|
|
key={cellKey}
|
|
{...otherProps}
|
|
>
|
|
<ProgressBar
|
|
progress={progress}
|
|
kind={getProgressBarKind(status, monitored, progress)}
|
|
showText={true}
|
|
text={`${trackFileCount} / ${trackCount}`}
|
|
width={125}
|
|
/>
|
|
</VirtualTableRowCell>
|
|
);
|
|
}
|
|
|
|
if (dataKey === 'actions') {
|
|
return (
|
|
<ArtistIndexItemConnector
|
|
key={cellKey}
|
|
component={ArtistIndexActionsCell}
|
|
id={id}
|
|
{...otherProps}
|
|
/>
|
|
);
|
|
}
|
|
}
|