import PropTypes from 'prop-types'; import React from 'react'; import FieldSet from 'Components/FieldSet'; import FormGroup from 'Components/Form/FormGroup'; import FormInputGroup from 'Components/Form/FormInputGroup'; import FormLabel from 'Components/Form/FormLabel'; import { inputTypes, sizes } from 'Helpers/Props'; import titleCase from 'Utilities/String/titleCase'; import translate from 'Utilities/String/translate'; function UpdateSettings(props) { const { advancedSettings, settings, isWindows, packageUpdateMechanism, onInputChange } = props; const { branch, updateAutomatically, updateMechanism, updateScriptPath } = settings; if (!advancedSettings) { return null; } const usingExternalUpdateMechanism = packageUpdateMechanism !== 'builtIn'; const updateOptions = []; if (usingExternalUpdateMechanism) { updateOptions.push({ key: packageUpdateMechanism, value: titleCase(packageUpdateMechanism) }); } else { updateOptions.push({ key: 'builtIn', value: 'Built-In' }); } updateOptions.push({ key: 'script', value: 'Script' }); return (
{translate('Branch')} { !isWindows &&
{translate('Automatic')} {translate('Mechanism')} { updateMechanism.value === 'script' && {translate('ScriptPath')} }
}
); } UpdateSettings.propTypes = { advancedSettings: PropTypes.bool.isRequired, settings: PropTypes.object.isRequired, isWindows: PropTypes.bool.isRequired, packageUpdateMechanism: PropTypes.string.isRequired, onInputChange: PropTypes.func.isRequired }; export default UpdateSettings;