@@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next"
77
88const downloads = [
99 {
10+ id : "mac_intel" ,
1011 icon : Package ,
1112 key : "macIntel" ,
1213 defaultPlatform : "macOS Intel processors" ,
@@ -16,6 +17,7 @@ const downloads = [
1617 link : "https://dashai.nyc3.cdn.digitaloceanspaces.com/executables/DashAI-launcher-cpu-x86_64" ,
1718 } ,
1819 {
20+ id : "mac_arm" ,
1921 icon : Package ,
2022 key : "macArm" ,
2123 defaultPlatform : "macOS ARM processors" ,
@@ -25,6 +27,7 @@ const downloads = [
2527 link : "https://dashai.nyc3.cdn.digitaloceanspaces.com/executables/DashAI-launcher-cpu-arm64" ,
2628 } ,
2729 {
30+ id : "windows" ,
2831 icon : Package ,
2932 key : "windows" ,
3033 defaultPlatform : "Windows" ,
@@ -35,6 +38,19 @@ const downloads = [
3538 } ,
3639]
3740
41+ const TRACKER_URL = process . env . NEXT_PUBLIC_TRACKER_URL
42+
43+ async function trackClick ( buttonId : string ) {
44+ if ( ! TRACKER_URL ) return
45+ try {
46+ await fetch ( `${ TRACKER_URL } /click/${ buttonId } ` , {
47+ method : "POST" ,
48+ } )
49+ } catch {
50+ // non-blocking — don't let tracking errors affect the download
51+ }
52+ }
53+
3854export function DownloadSection ( ) {
3955 const { t } = useTranslation ( )
4056 return (
@@ -57,7 +73,7 @@ export function DownloadSection() {
5773
5874 < div className = "max-w-5xl mx-auto" >
5975 < div className = "grid grid-cols-1 md:grid-cols-3 gap-6 mb-12" >
60- { downloads . map ( ( download , index ) => {
76+ { downloads . map ( ( download ) => {
6177 const Icon = download . icon
6278 const platform = t ( `download:cards.${ download . key } .platform` , {
6379 defaultValue : download . defaultPlatform ,
@@ -81,12 +97,12 @@ export function DownloadSection() {
8197 </ p >
8298 < p className = "text-xs text-muted-foreground font-mono" > { format } </ p >
8399 </ div >
84- < Button
85- className = "w-full bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer"
100+ < Button
101+ className = "w-full bg-primary hover:bg-primary/90 text-primary-foreground cursor-pointer"
86102 size = "sm"
87103 asChild
88104 >
89- < a href = { download . link } download >
105+ < a href = { download . link } download onClick = { ( ) => trackClick ( download . id ) } >
90106 < Download className = "mr-2 h-4 w-4" />
91107 { t ( "download:button" , { defaultValue : "Download" } ) }
92108 </ a >
@@ -124,4 +140,4 @@ export function DownloadSection() {
124140 </ div >
125141 </ section >
126142 )
127- }
143+ }
0 commit comments