import { Button, OverlayTrigger, Tooltip } from 'react-bootstrap' import PropTypes from 'prop-types' import Icon from '../../../shared/components/icon' import { useTranslation } from 'react-i18next' import { memo } from 'react' import { useLayoutContext } from '../../../shared/context/layout-context' const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl' function PdfCompileButtonInner({ startCompile, compiling }) { const { detachRole, view, pdfLayout } = useLayoutContext() const { t } = useTranslation() const compileButtonLabel = compiling ? t('compiling') + '…' : t('recompile') // show the compile shortcut when the editor is visible const showCompileShortcut = detachRole !== 'detached' && (view === 'editor' || pdfLayout === 'sideBySide') return ( {t('recompile_pdf')}{' '} {showCompileShortcut && ( ({modifierKey} + Enter) )} } > ) } PdfCompileButtonInner.propTypes = { compiling: PropTypes.bool.isRequired, startCompile: PropTypes.func.isRequired, } export default memo(PdfCompileButtonInner)