mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
32741c07e0
PDF Detach Safari Warning GitOrigin-RevId: e6f8942d8c8c141d887c44921a09716c4e4c85ae
38 lines
984 B
TypeScript
38 lines
984 B
TypeScript
import { useTranslation } from 'react-i18next'
|
|
import { Button } from 'react-bootstrap'
|
|
import Tooltip from '../../../shared/components/tooltip'
|
|
import Icon from '../../../shared/components/icon'
|
|
import { useLayoutContext } from '../../../shared/context/layout-context'
|
|
|
|
const BROWSER_IS_SAFARI =
|
|
navigator.userAgent &&
|
|
/.*Safari\/.*/.test(navigator.userAgent) &&
|
|
!/.*Chrome\/.*/.test(navigator.userAgent) &&
|
|
!/.*Chromium\/.*/.test(navigator.userAgent)
|
|
|
|
function PdfHybridSafariWarning() {
|
|
const { t } = useTranslation()
|
|
const { detachRole } = useLayoutContext()
|
|
|
|
if (!BROWSER_IS_SAFARI) {
|
|
return null
|
|
}
|
|
|
|
if (detachRole !== 'detached') {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Tooltip
|
|
id="safari-pdf-detach-warning"
|
|
description={t('pdf_detach_safari_issues')}
|
|
overlayProps={{ placement: 'bottom' }}
|
|
>
|
|
<Button bsStyle="link">
|
|
<Icon type="warning" fw />
|
|
</Button>
|
|
</Tooltip>
|
|
)
|
|
}
|
|
|
|
export default PdfHybridSafariWarning
|