|
|
@@ -1,11 +1,8 @@
|
|
|
import { Button } from 'react-bootstrap'
|
|
|
-import PropTypes from 'prop-types'
|
|
|
import Tooltip from '../../../shared/components/tooltip'
|
|
|
import Icon from '../../../shared/components/icon'
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
-import { memo, useCallback } from 'react'
|
|
|
-import { useSplitTestContext } from '../../../shared/context/split-test-context'
|
|
|
-import * as eventTracking from '../../../infrastructure/event-tracking'
|
|
|
+import { memo } from 'react'
|
|
|
|
|
|
const modifierKey = /Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl'
|
|
|
|
|
|
@@ -20,28 +17,7 @@ function PdfCompileButtonInner({
|
|
|
}: PdfCompileButtonInnerProps) {
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
- const { splitTestVariants } = useSplitTestContext({
|
|
|
- splitTestVariants: PropTypes.object,
|
|
|
- })
|
|
|
- const recompileButtonTextVariant = splitTestVariants['recompile-button-text']
|
|
|
-
|
|
|
- let compileButtonLabel
|
|
|
- if (compiling) {
|
|
|
- compileButtonLabel = t('compiling') + '…'
|
|
|
- } else if (splitTestVariants['recompile-button-text'] === 'recompile-pdf') {
|
|
|
- compileButtonLabel = t('recompile') + ' PDF'
|
|
|
- } else {
|
|
|
- compileButtonLabel = t('recompile')
|
|
|
- }
|
|
|
-
|
|
|
- const handleRecompileButtonClick = useCallback(() => {
|
|
|
- if (recompileButtonTextVariant != null) {
|
|
|
- // Only send the event when the user is targeted by the
|
|
|
- // recompile-button-text split test
|
|
|
- eventTracking.sendMB('recompile-pdf-clicked')
|
|
|
- }
|
|
|
- startCompile()
|
|
|
- }, [recompileButtonTextVariant, startCompile])
|
|
|
+ const compileButtonLabel = compiling ? `${t('compiling')}…` : t('recompile')
|
|
|
|
|
|
return (
|
|
|
<Tooltip
|
|
|
@@ -58,7 +34,7 @@ function PdfCompileButtonInner({
|
|
|
<Button
|
|
|
className="btn-recompile"
|
|
|
bsStyle="primary"
|
|
|
- onClick={handleRecompileButtonClick}
|
|
|
+ onClick={() => startCompile()}
|
|
|
aria-label={compileButtonLabel}
|
|
|
disabled={compiling}
|
|
|
data-ol-loading={compiling}
|