mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[web] download-pdf-button-click
event tracking (#12059)
* [web] `download-pdf-button-click` event tracking GitOrigin-RevId: 20baae4fff989b5120ae03f81cc47f7d6874dd7b
This commit is contained in:
parent
720475a482
commit
9ecc84f0b0
1 changed files with 9 additions and 0 deletions
|
@ -3,15 +3,23 @@ import { Button } from 'react-bootstrap'
|
|||
import Tooltip from '../../../shared/components/tooltip'
|
||||
import Icon from '../../../shared/components/icon'
|
||||
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
||||
import { useProjectContext } from '../../../shared/context/project-context'
|
||||
import * as eventTracking from '../../../infrastructure/event-tracking'
|
||||
|
||||
function PdfHybridDownloadButton() {
|
||||
const { pdfDownloadUrl } = useCompileContext()
|
||||
|
||||
const { _id: projectId } = useProjectContext()
|
||||
|
||||
const { t } = useTranslation()
|
||||
const description = pdfDownloadUrl
|
||||
? t('download_pdf')
|
||||
: t('please_compile_pdf_before_download')
|
||||
|
||||
function handleOnClick() {
|
||||
eventTracking.sendMB('download-pdf-button-click', { projectId })
|
||||
}
|
||||
|
||||
return (
|
||||
<Tooltip
|
||||
id="logs-toggle"
|
||||
|
@ -19,6 +27,7 @@ function PdfHybridDownloadButton() {
|
|||
overlayProps={{ placement: 'bottom' }}
|
||||
>
|
||||
<Button
|
||||
onClick={handleOnClick}
|
||||
bsStyle="link"
|
||||
disabled={!pdfDownloadUrl}
|
||||
download
|
||||
|
|
Loading…
Reference in a new issue