import React from 'react'; import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import { Trans, withNamespaces } from 'react-i18next'; import flow from 'lodash/flow'; import { renderSelectField, renderRadioField, toNumber } from '../../../helpers/form'; import { QUERY_LOG_INTERVALS_DAYS } from '../../../helpers/constants'; const getIntervalFields = (processing, t, handleChange, toNumber) => QUERY_LOG_INTERVALS_DAYS.map((interval) => { const title = interval === 1 ? t('interval_24_hour') : t('interval_days', { count: interval }); return ( ); }); const Form = (props) => { const { handleSubmit, handleChange, processing, t, } = props; return (
{getIntervalFields(processing, t, handleChange, toNumber)}
); }; Form.propTypes = { handleSubmit: PropTypes.func.isRequired, handleChange: PropTypes.func, change: PropTypes.func.isRequired, submitting: PropTypes.bool.isRequired, invalid: PropTypes.bool.isRequired, processing: PropTypes.bool.isRequired, t: PropTypes.func.isRequired, }; export default flow([ withNamespaces(), reduxForm({ form: 'logConfigForm', }), ])(Form);