import PropTypes from 'prop-types'; import React, { Component } from 'react'; import Label from 'Components/Label'; import IconButton from 'Components/Link/IconButton'; 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 DeleteIndexerModal from 'Indexer/Delete/DeleteIndexerModal'; import EditIndexerModalConnector from 'Indexer/Edit/EditIndexerModalConnector'; import IndexerInfoModal from 'Indexer/Info/IndexerInfoModal'; import titleCase from 'Utilities/String/titleCase'; import translate from 'Utilities/String/translate'; import CapabilitiesLabel from './CapabilitiesLabel'; import IndexerStatusCell from './IndexerStatusCell'; import ProtocolLabel from './ProtocolLabel'; import styles from './IndexerIndexRow.css'; class IndexerIndexRow extends Component { // // Lifecycle constructor(props, context) { super(props, context); this.state = { isEditIndexerModalOpen: false, isDeleteMovieModalOpen: false, isIndexerInfoModalOpen: false }; } onEditIndexerPress = () => { this.setState({ isEditIndexerModalOpen: true }); }; onIndexerInfoPress = () => { this.setState({ isIndexerInfoModalOpen: true }); }; onEditIndexerModalClose = () => { this.setState({ isEditIndexerModalOpen: false }); }; onIndexerInfoModalClose = () => { this.setState({ isIndexerInfoModalOpen: false }); }; onDeleteMoviePress = () => { this.setState({ isEditIndexerModalOpen: false, isDeleteMovieModalOpen: true }); }; onDeleteMovieModalClose = () => { this.setState({ isDeleteMovieModalOpen: false }); }; onUseSceneNumberingChange = () => { // Mock handler to satisfy `onChange` being required for `CheckInput`. // }; // // Render render() { const { id, name, indexerUrls, enable, redirect, tags, protocol, privacy, priority, status, appProfile, added, capabilities, columns, longDateFormat, timeFormat, isMovieEditorActive, isSelected, onSelectedChange } = this.props; const { isEditIndexerModalOpen, isDeleteMovieModalOpen, isIndexerInfoModalOpen } = this.state; return ( <> { columns.map((column) => { const { isVisible } = column; if (!isVisible) { return null; } if (isMovieEditorActive && column.name === 'select') { return ( ); } if (column.name === 'status') { return ( ); } if (column.name === 'sortName') { return ( {name} ); } if (column.name === 'privacy') { return ( ); } if (column.name === 'priority') { return ( {priority} ); } if (column.name === 'protocol') { return ( ); } if (column.name === 'appProfileId') { return ( {appProfile?.name || ''} ); } if (column.name === 'capabilities') { return ( ); } if (column.name === 'added') { return ( ); } if (column.name === 'tags') { return ( ); } if (column.name === 'actions') { return ( { indexerUrls ? : null } ); } return null; }) } ); } } IndexerIndexRow.propTypes = { id: PropTypes.number.isRequired, indexerUrls: PropTypes.arrayOf(PropTypes.string), protocol: PropTypes.string.isRequired, privacy: PropTypes.string.isRequired, priority: PropTypes.number.isRequired, name: PropTypes.string.isRequired, enable: PropTypes.bool.isRequired, redirect: PropTypes.bool.isRequired, appProfile: PropTypes.object.isRequired, status: PropTypes.object, capabilities: PropTypes.object, added: PropTypes.string.isRequired, tags: PropTypes.arrayOf(PropTypes.number).isRequired, columns: PropTypes.arrayOf(PropTypes.object).isRequired, isMovieEditorActive: PropTypes.bool.isRequired, isSelected: PropTypes.bool, onSelectedChange: PropTypes.func.isRequired, longDateFormat: PropTypes.string.isRequired, timeFormat: PropTypes.string.isRequired }; IndexerIndexRow.defaultProps = { tags: [] }; export default IndexerIndexRow;