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 { EnhancedSelectInputValue } from 'Components/Form/Select/EnhancedSelectInput'; import useShowAdvancedSettings from 'Helpers/Hooks/useShowAdvancedSettings'; import { inputTypes, sizes } from 'Helpers/Props'; import useSystemStatus from 'System/useSystemStatus'; import { InputChanged } from 'typings/inputs'; import { PendingSection } from 'typings/pending'; import General from 'typings/Settings/General'; import titleCase from 'Utilities/String/titleCase'; import translate from 'Utilities/String/translate'; const branchValues = ['main', 'develop']; interface UpdateSettingsProps { branch: PendingSection['branch']; updateAutomatically: PendingSection['updateAutomatically']; updateMechanism: PendingSection['updateMechanism']; updateScriptPath: PendingSection['updateScriptPath']; onInputChange: (change: InputChanged) => void; } function UpdateSettings({ branch, updateAutomatically, updateMechanism, updateScriptPath, onInputChange, }: UpdateSettingsProps) { const showAdvancedSettings = useShowAdvancedSettings(); const { packageUpdateMechanism } = useSystemStatus(); if (!showAdvancedSettings) { return null; } const usingExternalUpdateMechanism = packageUpdateMechanism !== 'builtIn'; const updateOptions: EnhancedSelectInputValue[] = []; if (usingExternalUpdateMechanism) { updateOptions.push({ key: packageUpdateMechanism, value: titleCase(packageUpdateMechanism), }); } else { updateOptions.push({ key: 'builtIn', value: translate('BuiltIn') }); } updateOptions.push({ key: 'script', value: translate('Script') }); return (
{translate('Branch')}
{translate('Automatic')} {translate('Mechanism')} {updateMechanism.value === 'script' ? ( {translate('ScriptPath')} ) : null}
); } export default UpdateSettings;