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 AddDownloadClientItem from './AddDownloadClientItem'; import styles from './AddDownloadClientModalContent.css'; function mapDownloadClients(clients, onDownloadClientSelect) { return clients.map((downloadClient) => { return ( ); }); } class AddDownloadClientModalContent extends Component { // // Render render() { const { isSchemaFetching, isSchemaPopulated, schemaError, usenetDownloadClients, torrentDownloadClients, otherDownloadClients, onDownloadClientSelect, onModalClose } = this.props; return ( Add Download Client { isSchemaFetching && } { !isSchemaFetching && !!schemaError &&
{translate('UnableToAddANewDownloadClientPleaseTryAgain')}
} { isSchemaPopulated && !schemaError &&
{translate('LidarrSupportsAnyDownloadClientThatUsesTheNewznabStandardAsWellAsOtherDownloadClientsListedBelow')}
{translate('ForMoreInformationOnTheIndividualDownloadClientsClickOnTheInfoButtons')}
{ mapDownloadClients(usenetDownloadClients, onDownloadClientSelect) }
{ mapDownloadClients(torrentDownloadClients, onDownloadClientSelect) }
{ otherDownloadClients.length ?
{ mapDownloadClients(otherDownloadClients, onDownloadClientSelect) }
: null }
}
); } } AddDownloadClientModalContent.propTypes = { isSchemaFetching: PropTypes.bool.isRequired, isSchemaPopulated: PropTypes.bool.isRequired, schemaError: PropTypes.object, usenetDownloadClients: PropTypes.arrayOf(PropTypes.object).isRequired, torrentDownloadClients: PropTypes.arrayOf(PropTypes.object).isRequired, otherDownloadClients: PropTypes.arrayOf(PropTypes.object).isRequired, onDownloadClientSelect: PropTypes.func.isRequired, onModalClose: PropTypes.func.isRequired }; export default AddDownloadClientModalContent;