import React from 'react'; import PropTypes from 'prop-types'; import { Trans } from 'react-i18next'; import { useSelector } from 'react-redux'; import { Field, reduxForm } from 'redux-form'; import i18next from 'i18next'; import cn from 'classnames'; import { getPathWithQueryString } from '../../../helpers/helpers'; import { FORM_NAME, MOBILE_CONFIG_LINKS } from '../../../helpers/constants'; import { renderInputField, renderSelectField, } from '../../../helpers/form'; import { validateClientId, validateServerName, } from '../../../helpers/validators'; const getDownloadLink = (host, clientId, protocol, invalid) => { if (!host || invalid) { return ( ); } const linkParams = { host }; if (clientId) { linkParams.client_id = clientId; } return ( download_mobileconfig ); }; const MobileConfigForm = ({ invalid }) => { const formValues = useSelector((state) => state.form[FORM_NAME.MOBILE_CONFIG]?.values); if (!formValues) { return null; } const { host, clientId, protocol } = formValues; const githubLink = ( text ); return (
e.preventDefault()}>
client_id_desc
{getDownloadLink(host, clientId, protocol, invalid)}
); }; MobileConfigForm.propTypes = { invalid: PropTypes.bool.isRequired, }; export default reduxForm({ form: FORM_NAME.MOBILE_CONFIG })(MobileConfigForm);