2021-09-30 07:29:25 -04:00
|
|
|
import Icon from '../../../shared/components/icon'
|
2024-10-23 03:32:40 -04:00
|
|
|
import OLButton from '@/features/ui/components/ol/ol-button'
|
2021-09-30 07:29:25 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { memo } from 'react'
|
2022-03-31 07:22:36 -04:00
|
|
|
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
2024-10-23 03:32:40 -04:00
|
|
|
import BootstrapVersionSwitcher from '@/features/ui/components/bootstrap-5/bootstrap-version-switcher'
|
2021-09-30 07:29:25 -04:00
|
|
|
|
|
|
|
function PdfClearCacheButton() {
|
2021-10-15 05:39:56 -04:00
|
|
|
const { compiling, clearCache, clearingCache } = useCompileContext()
|
2021-09-30 07:29:25 -04:00
|
|
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
2024-10-23 03:32:40 -04:00
|
|
|
<OLButton
|
|
|
|
size="sm"
|
|
|
|
variant="danger"
|
2021-09-30 07:29:25 -04:00
|
|
|
className="logs-pane-actions-clear-cache"
|
2022-03-31 07:22:36 -04:00
|
|
|
onClick={() => clearCache()}
|
2024-10-23 03:32:40 -04:00
|
|
|
isLoading={clearingCache}
|
2021-09-30 07:29:25 -04:00
|
|
|
disabled={clearingCache || compiling}
|
2024-10-23 03:32:40 -04:00
|
|
|
leadingIcon="delete"
|
2021-09-30 07:29:25 -04:00
|
|
|
>
|
2024-10-23 03:32:40 -04:00
|
|
|
<BootstrapVersionSwitcher
|
|
|
|
bs3={
|
|
|
|
<>
|
|
|
|
{clearingCache ? (
|
|
|
|
<Icon type="refresh" spin />
|
|
|
|
) : (
|
|
|
|
<Icon type="trash-o" />
|
|
|
|
)}
|
|
|
|
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
2021-09-30 07:29:25 -04:00
|
|
|
<span>{t('clear_cached_files')}</span>
|
2024-10-23 03:32:40 -04:00
|
|
|
</OLButton>
|
2021-09-30 07:29:25 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(PdfClearCacheButton)
|