New: Combine mass editor and author editor, enable book editor

This commit is contained in:
ta264
2021-11-21 18:31:03 +00:00
parent d460cbf319
commit 615acdaebe
45 changed files with 1122 additions and 931 deletions
@@ -5,6 +5,7 @@ import IconButton from 'Components/Link/IconButton';
import TableOptionsModalWrapper from 'Components/Table/TableOptions/TableOptionsModalWrapper';
import VirtualTableHeader from 'Components/Table/VirtualTableHeader';
import VirtualTableHeaderCell from 'Components/Table/VirtualTableHeaderCell';
import VirtualTableSelectAllHeaderCell from 'Components/Table/VirtualTableSelectAllHeaderCell';
import { icons } from 'Helpers/Props';
import AuthorIndexTableOptionsConnector from './AuthorIndexTableOptionsConnector';
import hasGrowableColumns from './hasGrowableColumns';
@@ -15,6 +16,10 @@ function AuthorIndexHeader(props) {
showBanners,
columns,
onTableOptionChange,
allSelected,
allUnselected,
onSelectAllChange,
isEditorActive,
...otherProps
} = props;
@@ -33,6 +38,21 @@ function AuthorIndexHeader(props) {
return null;
}
if (name === 'select') {
if (isEditorActive) {
return (
<VirtualTableSelectAllHeaderCell
key={name}
allSelected={allSelected}
allUnselected={allUnselected}
onSelectAllChange={onSelectAllChange}
/>
);
}
return null;
}
if (name === 'actions') {
return (
<VirtualTableHeaderCell
@@ -80,6 +100,10 @@ function AuthorIndexHeader(props) {
AuthorIndexHeader.propTypes = {
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
onTableOptionChange: PropTypes.func.isRequired,
allSelected: PropTypes.bool.isRequired,
allUnselected: PropTypes.bool.isRequired,
onSelectAllChange: PropTypes.func.isRequired,
isEditorActive: PropTypes.bool.isRequired,
showBanners: PropTypes.bool.isRequired
};
@@ -13,6 +13,7 @@ import SpinnerIconButton from 'Components/Link/SpinnerIconButton';
import ProgressBar from 'Components/ProgressBar';
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
import VirtualTableRowCell from 'Components/Table/Cells/VirtualTableRowCell';
import VirtualTableSelectCell from 'Components/Table/Cells/VirtualTableSelectCell';
import TagListConnector from 'Components/TagListConnector';
import { icons } from 'Helpers/Props';
import getProgressBarKind from 'Utilities/Author/getProgressBarKind';
@@ -101,8 +102,11 @@ class AuthorIndexRow extends Component {
columns,
isRefreshingAuthor,
isSearchingAuthor,
isEditorActive,
isSelected,
onRefreshAuthorPress,
onSearchPress
onSearchPress,
onSelectedChange
} = this.props;
const {
@@ -131,6 +135,19 @@ class AuthorIndexRow extends Component {
return null;
}
if (isEditorActive && name === 'select') {
return (
<VirtualTableSelectCell
inputClassName={styles.checkInput}
id={id}
key={name}
isSelected={isSelected}
isDisabled={false}
onSelectedChange={onSelectedChange}
/>
);
}
if (name === 'status') {
return (
<AuthorStatusCell
@@ -431,7 +448,10 @@ AuthorIndexRow.propTypes = {
isRefreshingAuthor: PropTypes.bool.isRequired,
isSearchingAuthor: PropTypes.bool.isRequired,
onRefreshAuthorPress: PropTypes.func.isRequired,
onSearchPress: PropTypes.func.isRequired
onSearchPress: PropTypes.func.isRequired,
isEditorActive: PropTypes.bool.isRequired,
isSelected: PropTypes.bool,
onSelectedChange: PropTypes.func.isRequired
};
AuthorIndexRow.defaultProps = {
@@ -48,6 +48,9 @@ class AuthorIndexTable extends Component {
const {
items,
columns,
selectedState,
onSelectedChange,
isEditorActive,
showBanners,
showTitle
} = this.props;
@@ -67,6 +70,9 @@ class AuthorIndexTable extends Component {
authorId={author.id}
qualityProfileId={author.qualityProfileId}
metadataProfileId={author.metadataProfileId}
isSelected={selectedState[author.id]}
onSelectedChange={onSelectedChange}
isEditorActive={isEditorActive}
showBanners={showBanners}
showTitle={showTitle}
/>
@@ -87,7 +93,12 @@ class AuthorIndexTable extends Component {
isSmallScreen,
onSortPress,
scroller,
scrollTop
scrollTop,
allSelected,
allUnselected,
onSelectAllChange,
isEditorActive,
selectedState
} = this.props;
return (
@@ -108,8 +119,13 @@ class AuthorIndexTable extends Component {
sortKey={sortKey}
sortDirection={sortDirection}
onSortPress={onSortPress}
allSelected={allSelected}
allUnselected={allUnselected}
onSelectAllChange={onSelectAllChange}
isEditorActive={isEditorActive}
/>
}
selectedState={selectedState}
columns={columns}
sortKey={sortKey}
sortDirection={sortDirection}
@@ -129,7 +145,13 @@ AuthorIndexTable.propTypes = {
scrollTop: PropTypes.number,
scroller: PropTypes.instanceOf(Element).isRequired,
isSmallScreen: PropTypes.bool.isRequired,
onSortPress: PropTypes.func.isRequired
onSortPress: PropTypes.func.isRequired,
allSelected: PropTypes.bool.isRequired,
allUnselected: PropTypes.bool.isRequired,
selectedState: PropTypes.object.isRequired,
onSelectedChange: PropTypes.func.isRequired,
onSelectAllChange: PropTypes.func.isRequired,
isEditorActive: PropTypes.bool.isRequired
};
export default AuthorIndexTable;