import PropTypes from 'prop-types'; import React, { Component } from 'react'; import Alert from 'Components/Alert'; import FieldSet from 'Components/FieldSet'; import Button from 'Components/Link/Button'; import LoadingIndicator from 'Components/Loading/LoadingIndicator'; import ModalBody from 'Components/Modal/ModalBody'; import ModalContent from 'Components/Modal/ModalContent'; import ModalFooter from 'Components/Modal/ModalFooter'; import ModalHeader from 'Components/Modal/ModalHeader'; import { kinds } from 'Helpers/Props'; import translate from 'Utilities/String/translate'; import AddIndexerItem from './AddIndexerItem'; import styles from './AddIndexerModalContent.css'; function mapIndexers(indexers, onIndexerSelect) { return indexers.map((indexer) => { return ( ); }); } class AddIndexerModalContent extends Component { // // Render render() { const { isSchemaFetching, isSchemaPopulated, schemaError, usenetIndexers, torrentIndexers, otherIndexers, onIndexerSelect, onModalClose } = this.props; return ( Add Indexer { isSchemaFetching && } { !isSchemaFetching && !!schemaError &&
{translate('UnableToAddANewIndexerPleaseTryAgain')}
} { isSchemaPopulated && !schemaError &&
{translate('LidarrSupportsAnyIndexerThatUsesTheNewznabStandardAsWellAsOtherIndexersListedBelow')}
{translate('ForMoreInformationOnTheIndividualIndexersClickOnTheInfoButtons')}
{ mapIndexers(usenetIndexers, onIndexerSelect) }
{ mapIndexers(torrentIndexers, onIndexerSelect) }
{ otherIndexers.length ?
{ mapIndexers(otherIndexers, onIndexerSelect) }
: null }
}
); } } AddIndexerModalContent.propTypes = { isSchemaFetching: PropTypes.bool.isRequired, isSchemaPopulated: PropTypes.bool.isRequired, schemaError: PropTypes.object, usenetIndexers: PropTypes.arrayOf(PropTypes.object).isRequired, torrentIndexers: PropTypes.arrayOf(PropTypes.object).isRequired, otherIndexers: PropTypes.arrayOf(PropTypes.object).isRequired, onIndexerSelect: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired }; export default AddIndexerModalContent;