import { Dropdown, MenuItem } from 'react-bootstrap' import Icon from '../../../shared/components/icon' import ControlledDropdown from '../../../shared/components/controlled-dropdown' import { useTranslation } from 'react-i18next' import { memo } from 'react' import classnames from 'classnames' import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' import PdfCompileButtonInner from './pdf-compile-button-inner' import getMeta from '../../../utils/meta' function PdfCompileButton() { const { autoCompile, compiling, draft, hasChanges, setAutoCompile, setDraft, setStopOnFirstError, setStopOnValidationError, stopOnFirstError, stopOnValidationError, startCompile, stopCompile, recompileFromScratch, } = useCompileContext() const { t } = useTranslation() const showStopOnFirstError = getMeta('ol-showStopOnFirstError') return ( {t('auto_compile')} setAutoCompile(true)}> {t('on')} setAutoCompile(false)}> {t('off')} {t('compile_mode')} setDraft(false)}> {t('normal')} setDraft(true)}> {t('fast')} [draft] Syntax Checks setStopOnValidationError(true)}> {t('stop_on_validation_error')} setStopOnValidationError(false)}> {t('ignore_validation_errors')} {showStopOnFirstError && ( {t('compile_error_handling')} )} {showStopOnFirstError && ( setStopOnFirstError(true)}> {t('stop_on_first_error')} )} {showStopOnFirstError && ( setStopOnFirstError(false)}> {t('try_to_compile_despite_errors')} )} stopCompile()} disabled={!compiling} aria-disabled={!compiling} > {t('stop_compile')} recompileFromScratch()} disabled={compiling} aria-disabled={compiling} > {t('recompile_from_scratch')} ) } export default memo(PdfCompileButton)