overleaf/services/web/frontend/js/features/editor-left-menu/components/download-source.tsx
Jakob Ackermann 6b2daed903 Merge pull request #15843 from overleaf/jpa-download-events
[web] add additional event tracking

GitOrigin-RevId: 877f92db41efff017db370ec75b8d1f861eed4f2
2023-11-21 09:04:28 +00:00

31 lines
866 B
TypeScript

import { useTranslation } from 'react-i18next'
import { useProjectContext } from '../../../shared/context/project-context'
import Icon from '../../../shared/components/icon'
import * as eventTracking from '../../../infrastructure/event-tracking'
import { isMobileDevice } from '../../../infrastructure/event-tracking'
export default function DownloadSource() {
const { t } = useTranslation()
const { _id: projectId } = useProjectContext()
function sendDownloadEvent() {
eventTracking.sendMB('download-zip-button-click', {
projectId,
location: 'left-menu',
isMobileDevice,
})
}
return (
<a
href={`/project/${projectId}/download/zip`}
target="_blank"
rel="noreferrer"
onClick={sendDownloadEvent}
>
<Icon type="file-archive-o" modifier="2x" />
<br />
{t('source')}
</a>
)
}