pdf-clear-cache-button.js 817 B

123456789101112131415161718192021222324252627
  1. import Icon from '../../../shared/components/icon'
  2. import { Button } from 'react-bootstrap'
  3. import { useTranslation } from 'react-i18next'
  4. import { memo } from 'react'
  5. import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
  6. function PdfClearCacheButton() {
  7. const { compiling, clearCache, clearingCache } = useCompileContext()
  8. const { t } = useTranslation()
  9. return (
  10. <Button
  11. bsSize="small"
  12. bsStyle="danger"
  13. className="logs-pane-actions-clear-cache"
  14. onClick={() => clearCache()}
  15. disabled={clearingCache || compiling}
  16. >
  17. {clearingCache ? <Icon type="refresh" spin /> : <Icon type="trash-o" />}
  18. &nbsp;
  19. <span>{t('clear_cached_files')}</span>
  20. </Button>
  21. )
  22. }
  23. export default memo(PdfClearCacheButton)