overleaf/services/web/frontend/js/features/pdf-preview/components/pdf-clear-cache-button.js
Timothée Alby 3c01402bbd Merge pull request #7034 from overleaf/ta-pdf-detach-full
PDF Detach v2

GitOrigin-RevId: 3deb76474185f9176cde23ab32ef51b90df6e8e9
2022-04-05 12:19:23 +00:00

27 lines
817 B
JavaScript

import Icon from '../../../shared/components/icon'
import { Button } from 'react-bootstrap'
import { useTranslation } from 'react-i18next'
import { memo } from 'react'
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
function PdfClearCacheButton() {
const { compiling, clearCache, clearingCache } = useCompileContext()
const { t } = useTranslation()
return (
<Button
bsSize="small"
bsStyle="danger"
className="logs-pane-actions-clear-cache"
onClick={() => clearCache()}
disabled={clearingCache || compiling}
>
{clearingCache ? <Icon type="refresh" spin /> : <Icon type="trash-o" />}
&nbsp;
<span>{t('clear_cached_files')}</span>
</Button>
)
}
export default memo(PdfClearCacheButton)