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 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 }; } onEditIndexerPress = () => { this.setState({ isEditIndexerModalOpen: true }); } onEditIndexerModalClose = () => { this.setState({ isEditIndexerModalOpen: 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, baseUrl, enable, redirect, tags, protocol, privacy, priority, status, added, capabilities, columns, longDateFormat, timeFormat, isMovieEditorActive, isSelected, onSelectedChange } = this.props; const { isEditIndexerModalOpen, isDeleteMovieModalOpen } = 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 === 'name') { return ( {name} ); } if (column.name === 'privacy') { return ( ); } if (column.name === 'priority') { return ( {priority} ); } if (column.name === 'protocol') { return ( ); } if (column.name === 'capabilities') { return ( ); } if (column.name === 'added') { return ( ); } if (column.name === 'tags') { return ( ); } if (column.name === 'actions') { return ( ); } return null; }) } ); } } IndexerIndexRow.propTypes = { id: PropTypes.number.isRequired, baseUrl: PropTypes.string.isRequired, protocol: PropTypes.string.isRequired, privacy: PropTypes.string.isRequired, priority: PropTypes.number.isRequired, name: PropTypes.string.isRequired, enable: PropTypes.bool.isRequired, redirect: PropTypes.bool.isRequired, status: PropTypes.object, capabilities: PropTypes.object.isRequired, 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;