2022-10-24 12:21:36 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
|
|
import Icon from '../../../shared/components/icon'
|
2023-08-22 09:33:19 -04:00
|
|
|
import * as eventTracking from '../../../infrastructure/event-tracking'
|
2023-11-20 09:30:03 -05:00
|
|
|
import { isMobileDevice } from '../../../infrastructure/event-tracking'
|
2022-10-24 12:21:36 -04:00
|
|
|
|
|
|
|
export default function DownloadSource() {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
const { _id: projectId } = useProjectContext()
|
|
|
|
|
2023-08-22 09:33:19 -04:00
|
|
|
function sendDownloadEvent() {
|
|
|
|
eventTracking.sendMB('download-zip-button-click', {
|
|
|
|
projectId,
|
|
|
|
location: 'left-menu',
|
2023-11-20 09:30:03 -05:00
|
|
|
isMobileDevice,
|
2023-08-22 09:33:19 -04:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2022-10-24 12:21:36 -04:00
|
|
|
return (
|
|
|
|
<a
|
|
|
|
href={`/project/${projectId}/download/zip`}
|
|
|
|
target="_blank"
|
|
|
|
rel="noreferrer"
|
2023-08-22 09:33:19 -04:00
|
|
|
onClick={sendDownloadEvent}
|
2022-10-24 12:21:36 -04:00
|
|
|
>
|
|
|
|
<Icon type="file-archive-o" modifier="2x" />
|
|
|
|
<br />
|
|
|
|
{t('source')}
|
|
|
|
</a>
|
|
|
|
)
|
|
|
|
}
|