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.
Lidarr/frontend/src/Wanted/Missing/MissingRow.js

127 lines
3.2 KiB

import PropTypes from 'prop-types';
import React from 'react';
import albumEntities from 'Album/albumEntities';
import AlbumTitleLink from 'Album/AlbumTitleLink';
import EpisodeStatusConnector from 'Album/EpisodeStatusConnector';
import AlbumSearchCellConnector from 'Album/AlbumSearchCellConnector';
import ArtistNameLink from 'Artist/ArtistNameLink';
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
import TableRow from 'Components/Table/TableRow';
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
import styles from './MissingRow.css';
function MissingRow(props) {
const {
id,
// trackFileId,
artist,
releaseDate,
albumType,
foreignAlbumId,
title,
disambiguation,
isSelected,
columns,
onSelectedChange
} = props;
if (!artist) {
return null;
}
return (
<TableRow>
<TableSelectCell
id={id}
isSelected={isSelected}
onSelectedChange={onSelectedChange}
/>
{
columns.map((column) => {
const {
name,
isVisible
} = column;
if (!isVisible) {
return null;
}
if (name === 'artist.sortName') {
return (
<TableRowCell key={name}>
<ArtistNameLink
foreignArtistId={artist.foreignArtistId}
artistName={artist.artistName}
/>
</TableRowCell>
);
}
if (name === 'albumTitle') {
return (
<TableRowCell key={name}>
<AlbumTitleLink
foreignAlbumId={foreignAlbumId}
title={title}
disambiguation={disambiguation}
/>
</TableRowCell>
);
}
if (name === 'albumType') {
return (
<TableRowCell key={name}>
{albumType}
</TableRowCell>
);
}
if (name === 'releaseDate') {
return (
<RelativeDateCellConnector
key={name}
date={releaseDate}
/>
);
}
if (name === 'actions') {
return (
<AlbumSearchCellConnector
key={name}
albumId={id}
artistId={artist.id}
albumTitle={title}
albumEntity={albumEntities.WANTED_MISSING}
showOpenArtistButton={true}
/>
);
}
return null;
})
}
</TableRow>
);
}
MissingRow.propTypes = {
id: PropTypes.number.isRequired,
// trackFileId: PropTypes.number,
artist: PropTypes.object.isRequired,
releaseDate: PropTypes.string.isRequired,
foreignAlbumId: PropTypes.string.isRequired,
albumType: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
disambiguation: PropTypes.string,
isSelected: PropTypes.bool,
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
onSelectedChange: PropTypes.func.isRequired
};
export default MissingRow;