2022-05-18 09:46:10 -04:00
|
|
|
import { Button } from 'react-bootstrap'
|
|
|
|
import Tooltip from '../../../shared/components/tooltip'
|
2021-11-30 09:54:14 -05:00
|
|
|
import Icon from '../../../shared/components/icon'
|
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { memo } from 'react'
|
|
|
|
|
|
|
|
const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl'
|
|
|
|
|
2022-05-18 09:46:10 -04:00
|
|
|
type PdfCompileButtonInnerProps = {
|
|
|
|
startCompile: () => void
|
|
|
|
compiling: boolean
|
|
|
|
}
|
|
|
|
|
|
|
|
function PdfCompileButtonInner({
|
|
|
|
startCompile,
|
|
|
|
compiling,
|
|
|
|
}: PdfCompileButtonInnerProps) {
|
2021-11-30 09:54:14 -05:00
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
const compileButtonLabel = compiling ? t('compiling') + '…' : t('recompile')
|
|
|
|
|
|
|
|
return (
|
2022-05-18 09:46:10 -04:00
|
|
|
<Tooltip
|
|
|
|
id="logs-toggle"
|
|
|
|
description={
|
|
|
|
<>
|
2021-11-30 09:54:14 -05:00
|
|
|
{t('recompile_pdf')}{' '}
|
2022-05-18 06:35:18 -04:00
|
|
|
<span className="keyboard-shortcut">({modifierKey} + Enter)</span>
|
2022-05-18 09:46:10 -04:00
|
|
|
</>
|
2021-11-30 09:54:14 -05:00
|
|
|
}
|
2022-05-18 09:46:10 -04:00
|
|
|
tooltipProps={{ className: 'keyboard-tooltip' }}
|
|
|
|
overlayProps={{ delayShow: 500 }}
|
2021-11-30 09:54:14 -05:00
|
|
|
>
|
|
|
|
<Button
|
|
|
|
className="btn-recompile"
|
2022-10-18 04:45:56 -04:00
|
|
|
bsStyle="primary"
|
2021-11-30 09:54:14 -05:00
|
|
|
onClick={() => startCompile()}
|
|
|
|
aria-label={compileButtonLabel}
|
2022-03-03 11:28:12 -05:00
|
|
|
disabled={compiling}
|
2023-01-09 11:20:42 -05:00
|
|
|
data-ol-loading={compiling}
|
2021-11-30 09:54:14 -05:00
|
|
|
>
|
|
|
|
<Icon type="refresh" spin={compiling} />
|
|
|
|
<span className="toolbar-hide-medium toolbar-hide-small btn-recompile-label">
|
|
|
|
{compileButtonLabel}
|
|
|
|
</span>
|
|
|
|
</Button>
|
2022-05-18 09:46:10 -04:00
|
|
|
</Tooltip>
|
2021-11-30 09:54:14 -05:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(PdfCompileButtonInner)
|