pdf-clear-cache-button.tsx 792 B

123456789101112131415161718192021222324252627
  1. import OLButton from '@/shared/components/ol/ol-button'
  2. import { useTranslation } from 'react-i18next'
  3. import { memo } from 'react'
  4. import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
  5. function PdfClearCacheButton() {
  6. const { compiling, clearCache, clearingCache } = useCompileContext()
  7. const { t } = useTranslation()
  8. return (
  9. <OLButton
  10. size="sm"
  11. variant="danger"
  12. className="logs-pane-actions-clear-cache"
  13. onClick={() => clearCache()}
  14. isLoading={clearingCache}
  15. disabled={clearingCache || compiling}
  16. leadingIcon="delete"
  17. loadingLabel={t('clear_cached_files')}
  18. >
  19. <span>{t('clear_cached_files')}</span>
  20. </OLButton>
  21. )
  22. }
  23. export default memo(PdfClearCacheButton)