pdf-compile-button.tsx 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import { useTranslation } from 'react-i18next'
  2. import { memo } from 'react'
  3. import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
  4. import OLButton from '@/features/ui/components/ol/ol-button'
  5. import OLTooltip from '@/features/ui/components/ol/ol-tooltip'
  6. import MaterialIcon from '@/shared/components/material-icon'
  7. function PdfCompileButton() {
  8. const { compiling, startCompile } = useCompileContext()
  9. const { t } = useTranslation()
  10. return (
  11. <OLTooltip
  12. id="download-pdf"
  13. description={compiling ? t('compiling') : t('recompile')}
  14. overlayProps={{ placement: 'bottom' }}
  15. >
  16. {/* TODO: add some indicator that changes have been made */}
  17. <OLButton
  18. onClick={startCompile}
  19. variant="link"
  20. className="pdf-toolbar-btn"
  21. isLoading={compiling}
  22. style={{ pointerEvents: 'auto' }}
  23. aria-label={t('download_pdf')}
  24. >
  25. <MaterialIcon type="refresh" />
  26. </OLButton>
  27. </OLTooltip>
  28. )
  29. }
  30. export default memo(PdfCompileButton)