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.
115 lines
2.9 KiB
115 lines
2.9 KiB
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import AuthorNameLink from 'Author/AuthorNameLink';
|
|
import bookEntities from 'Book/bookEntities';
|
|
import BookSearchCellConnector from 'Book/BookSearchCellConnector';
|
|
import BookTitleLink from 'Book/BookTitleLink';
|
|
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
|
|
import TableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
import TableSelectCell from 'Components/Table/Cells/TableSelectCell';
|
|
import TableRow from 'Components/Table/TableRow';
|
|
|
|
function CutoffUnmetRow(props) {
|
|
const {
|
|
id,
|
|
author,
|
|
releaseDate,
|
|
titleSlug,
|
|
title,
|
|
disambiguation,
|
|
isSelected,
|
|
columns,
|
|
onSelectedChange
|
|
} = props;
|
|
|
|
if (!author) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<TableRow>
|
|
<TableSelectCell
|
|
id={id}
|
|
isSelected={isSelected}
|
|
onSelectedChange={onSelectedChange}
|
|
/>
|
|
|
|
{
|
|
columns.map((column) => {
|
|
const {
|
|
name,
|
|
isVisible
|
|
} = column;
|
|
|
|
if (!isVisible) {
|
|
return null;
|
|
}
|
|
|
|
if (name === 'authorMetadata.sortName') {
|
|
return (
|
|
<TableRowCell key={name}>
|
|
<AuthorNameLink
|
|
titleSlug={author.titleSlug}
|
|
authorName={author.authorName}
|
|
/>
|
|
</TableRowCell>
|
|
);
|
|
}
|
|
|
|
if (name === 'books.title') {
|
|
return (
|
|
<TableRowCell key={name}>
|
|
<BookTitleLink
|
|
titleSlug={titleSlug}
|
|
title={title}
|
|
disambiguation={disambiguation}
|
|
/>
|
|
</TableRowCell>
|
|
);
|
|
}
|
|
|
|
if (name === 'releaseDate') {
|
|
return (
|
|
<RelativeDateCellConnector
|
|
key={name}
|
|
date={releaseDate}
|
|
/>
|
|
);
|
|
}
|
|
|
|
if (name === 'actions') {
|
|
return (
|
|
<BookSearchCellConnector
|
|
key={name}
|
|
bookId={id}
|
|
authorId={author.id}
|
|
bookTitle={title}
|
|
authorName={author.authorName}
|
|
bookEntity={bookEntities.WANTED_CUTOFF_UNMET}
|
|
showOpenAuthorButton={true}
|
|
/>
|
|
);
|
|
}
|
|
|
|
return null;
|
|
})
|
|
}
|
|
</TableRow>
|
|
);
|
|
}
|
|
|
|
CutoffUnmetRow.propTypes = {
|
|
id: PropTypes.number.isRequired,
|
|
bookFileId: PropTypes.number,
|
|
author: PropTypes.object.isRequired,
|
|
releaseDate: PropTypes.string.isRequired,
|
|
titleSlug: 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 CutoffUnmetRow;
|