2021-10-12 04:47:46 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { Button, OverlayTrigger, Tooltip } from 'react-bootstrap'
|
|
|
|
import Icon from '../../../shared/components/icon'
|
|
|
|
import { memo } from 'react'
|
2021-10-15 05:39:56 -04:00
|
|
|
import { useCompileContext } from '../../../shared/context/compile-context'
|
2021-10-12 04:47:46 -04:00
|
|
|
|
|
|
|
function PdfHybridDownloadButton() {
|
2021-10-15 05:39:56 -04:00
|
|
|
const { pdfDownloadUrl } = useCompileContext()
|
2021-10-12 04:47:46 -04:00
|
|
|
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<OverlayTrigger
|
|
|
|
placement="bottom"
|
|
|
|
overlay={
|
|
|
|
<Tooltip id="tooltip-logs-toggle">
|
|
|
|
{pdfDownloadUrl
|
|
|
|
? t('download_pdf')
|
|
|
|
: t('please_compile_pdf_before_download')}
|
|
|
|
</Tooltip>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<Button
|
|
|
|
bsStyle="link"
|
|
|
|
disabled={!pdfDownloadUrl}
|
|
|
|
download
|
|
|
|
href={pdfDownloadUrl || '#'}
|
|
|
|
target="_blank"
|
2021-12-07 05:06:38 -05:00
|
|
|
style={{ pointerEvents: 'auto' }}
|
2021-10-12 04:47:46 -04:00
|
|
|
>
|
|
|
|
<Icon type="download" modifier="fw" />
|
|
|
|
</Button>
|
|
|
|
</OverlayTrigger>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default memo(PdfHybridDownloadButton)
|