import { useTranslation } from 'react-i18next' import { memo } from 'react' import classnames from 'classnames' import Icon from '../../../shared/components/icon' import { useDetachCompileContext } from '../../../shared/context/detach-compile-context' import OLTooltip from '@/features/ui/components/ol/ol-tooltip' import OLButton from '@/features/ui/components/ol/ol-button' import { bsVersion } from '@/features/utils/bootstrap-5' import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher' const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl' function DetachCompileButton() { const { t } = useTranslation() const { compiling, startCompile, hasChanges } = useDetachCompileContext() const compileButtonLabel = compiling ? `${t('compiling')}…` : t('recompile') const tooltipElement = ( <> {t('recompile_pdf')}{' '} ({modifierKey} + Enter) ) return (
startCompile()} disabled={compiling} className={classnames('detach-compile-button', { 'btn-striped-animated': hasChanges, 'detach-compile-button-disabled': compiling, })} size="sm" isLoading={compiling} bs3Props={{ loading: compiling && ( <> {compileButtonLabel} ), }} > {compileButtonLabel} } bs5={t('recompile')} />
) } export default memo(DetachCompileButton)