@@ -38,12 +38,12 @@ const GITHUB_API_URL = 'https://api.github.com/repos/remix-project-org/remix-des
3838const CACHE_KEY = 'remix-desktop-release-cache'
3939const CACHE_DURATION = 30 * 60 * 1000 // 30 minutes in milliseconds
4040
41- export const DesktopDownload : React . FC < DesktopDownloadProps > = ( {
42- className = '' ,
43- compact = true ,
44- variant = 'button' ,
41+ export const DesktopDownload : React . FC < DesktopDownloadProps > = ( {
42+ className = '' ,
43+ compact = true ,
44+ variant = 'button' ,
4545 style = { } ,
46- trackingContext = 'unknown'
46+ trackingContext = 'unknown'
4747} ) => {
4848 const [ releaseData , setReleaseData ] = useState < ReleaseData | null > ( null )
4949 const [ loading , setLoading ] = useState ( true )
@@ -63,13 +63,13 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
6363 try {
6464 const cached = localStorage . getItem ( CACHE_KEY )
6565 if ( ! cached ) return null
66-
66+
6767 const { data, timestamp } = JSON . parse ( cached )
6868 if ( Date . now ( ) - timestamp > CACHE_DURATION ) {
6969 localStorage . removeItem ( CACHE_KEY )
7070 return null
7171 }
72-
72+
7373 return data
7474 } catch {
7575 localStorage . removeItem ( CACHE_KEY )
@@ -103,42 +103,42 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
103103 let preferredAsset : ReleaseAsset | null = null
104104
105105 if ( os === 'windows' ) {
106- preferredAsset = assets . find ( asset =>
107- asset . name . toLowerCase ( ) . includes ( 'setup' ) &&
106+ preferredAsset = assets . find ( asset =>
107+ asset . name . toLowerCase ( ) . includes ( 'setup' ) &&
108108 asset . name . toLowerCase ( ) . includes ( '.exe' )
109109 ) || null
110110 } else if ( os === 'macos' ) {
111111 // Check if user is on Apple Silicon (M1/M2/etc.)
112- const isAppleSilicon = navigator . userAgent . includes ( 'Macintosh' ) &&
113- ( navigator . userAgent . includes ( 'ARM' ) ||
112+ const isAppleSilicon = navigator . userAgent . includes ( 'Macintosh' ) &&
113+ ( navigator . userAgent . includes ( 'ARM' ) ||
114114 / M a c O S X 1 0 _ 1 [ 5 - 9 ] | M a c O S X 1 [ 1 - 9 ] | m a c O S / . test ( navigator . userAgent ) )
115-
115+
116116 // Prefer ARM64 version for newer Macs, Intel version for older ones
117117 if ( isAppleSilicon ) {
118- preferredAsset = assets . find ( asset =>
119- asset . name . toLowerCase ( ) . includes ( '.dmg' ) &&
118+ preferredAsset = assets . find ( asset =>
119+ asset . name . toLowerCase ( ) . includes ( '.dmg' ) &&
120120 asset . name . toLowerCase ( ) . includes ( 'arm64' )
121121 ) || null
122122 }
123-
123+
124124 // Fallback to any dmg if ARM64 not found or not Apple Silicon
125125 if ( ! preferredAsset ) {
126- preferredAsset = assets . find ( asset =>
127- asset . name . toLowerCase ( ) . includes ( '.dmg' ) &&
126+ preferredAsset = assets . find ( asset =>
127+ asset . name . toLowerCase ( ) . includes ( '.dmg' ) &&
128128 ! asset . name . toLowerCase ( ) . includes ( 'arm64' )
129- ) || assets . find ( asset =>
129+ ) || assets . find ( asset =>
130130 asset . name . toLowerCase ( ) . includes ( '.dmg' )
131131 ) || null
132132 }
133133 } else if ( os === 'linux' ) {
134134 // Prefer .deb for most Linux distributions
135- preferredAsset = assets . find ( asset =>
135+ preferredAsset = assets . find ( asset =>
136136 asset . name . toLowerCase ( ) . includes ( '.deb' )
137137 ) || null
138-
138+
139139 // Fallback to AppImage if no .deb found
140140 if ( ! preferredAsset ) {
141- preferredAsset = assets . find ( asset =>
141+ preferredAsset = assets . find ( asset =>
142142 asset . name . toLowerCase ( ) . includes ( '.appimage' )
143143 ) || null
144144 }
@@ -173,29 +173,29 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
173173 // Get platform-specific icon
174174 const getPlatformIcon = ( platform : string ) : string => {
175175 switch ( platform ) {
176- case 'windows' : return 'fab fa-windows'
177- case 'macos' : return 'fab fa-apple'
178- case 'linux' : return 'fab fa-linux'
179- default : return 'fas fa-desktop'
176+ case 'windows' : return 'fab fa-windows'
177+ case 'macos' : return 'fab fa-apple'
178+ case 'linux' : return 'fab fa-linux'
179+ default : return 'fas fa-desktop'
180180 }
181181 }
182182
183183 // Get platform display name
184184 const getPlatformName = ( platform : string ) : string => {
185185 switch ( platform ) {
186- case 'windows' : return 'Windows'
187- case 'macos' : return 'macOS'
188- case 'linux' : return 'Linux'
189- default : return platform . charAt ( 0 ) . toUpperCase ( ) + platform . slice ( 1 )
186+ case 'windows' : return 'Windows'
187+ case 'macos' : return 'macOS'
188+ case 'linux' : return 'Linux'
189+ default : return platform . charAt ( 0 ) . toUpperCase ( ) + platform . slice ( 1 )
190190 }
191191 }
192192
193193 // Track download click events
194194 const trackDownloadClick = ( platform ?: string , filename ?: string , variant ?: string ) => {
195195 const trackingData = [
196- 'trackEvent' ,
197- 'desktopDownload' ,
198- `${ trackingContext } -${ variant || 'button' } ` ,
196+ 'trackEvent' ,
197+ 'desktopDownload' ,
198+ `${ trackingContext } -${ variant || 'button' } ` ,
199199 platform ? `${ platform } -${ filename } ` : 'releases-page'
200200 ]
201201 _paq . push ( trackingData )
@@ -257,14 +257,14 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
257257 return (
258258 < div className = { `text-muted ${ className } ` } >
259259 < small >
260- < FormattedMessage
261- id = "desktopDownload.error"
260+ < FormattedMessage
261+ id = "desktopDownload.error"
262262 defaultMessage = "Unable to load desktop app. Check the {link} for downloads."
263263 values = { {
264264 link : (
265- < a
266- href = "https://github.com/remix-project-org/remix-desktop/releases"
267- target = "_blank"
265+ < a
266+ href = "https://github.com/remix-project-org/remix-desktop/releases"
267+ target = "_blank"
268268 rel = "noopener noreferrer"
269269 className = "text-decoration-none"
270270 >
@@ -303,10 +303,10 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
303303 >
304304 < i className = { getPlatformIcon ( detectedDownload . platform ) } > </ i >
305305 < span >
306- < FormattedMessage
307- id = "desktopDownload.downloadSpan"
306+ < FormattedMessage
307+ id = "desktopDownload.downloadSpan"
308308 defaultMessage = "Download Remix Desktop {platform} {version}"
309- values = { {
309+ values = { {
310310 platform : getPlatformName ( detectedDownload . platform ) ,
311311 version : releaseData . tag_name
312312 } }
@@ -333,8 +333,8 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
333333 >
334334 < i className = "far fa-desktop" > </ i >
335335 < span >
336- < FormattedMessage
337- id = "desktopDownload.downloadSpanGeneric"
336+ < FormattedMessage
337+ id = "desktopDownload.downloadSpanGeneric"
338338 defaultMessage = "Download Remix Desktop {version}"
339339 values = { { version : releaseData . tag_name } }
340340 />
@@ -362,10 +362,10 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
362362 >
363363 < i className = { getPlatformIcon ( detectedDownload . platform ) } > </ i >
364364 < span >
365- < FormattedMessage
366- id = "desktopDownload.downloadCompactFull"
365+ < FormattedMessage
366+ id = "desktopDownload.downloadCompactFull"
367367 defaultMessage = "Download Remix Desktop {platform} {version}"
368- values = { {
368+ values = { {
369369 platform : getPlatformName ( detectedDownload . platform ) ,
370370 version : releaseData . tag_name
371371 } }
@@ -375,14 +375,14 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
375375 </ CustomTooltip >
376376 < div className = "text-muted" >
377377 < small >
378- < a
379- href = { releaseData . html_url }
380- target = "_blank"
378+ < a
379+ href = { releaseData . html_url }
380+ target = "_blank"
381381 rel = "noopener noreferrer"
382382 className = "text-decoration-none text-muted"
383383 >
384- < FormattedMessage
385- id = "desktopDownload.otherVersions"
384+ < FormattedMessage
385+ id = "desktopDownload.otherVersions"
386386 defaultMessage = "Other versions and platforms"
387387 />
388388 </ a >
@@ -405,8 +405,8 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
405405 >
406406 < i className = "far fa-desktop" > </ i >
407407 < span >
408- < FormattedMessage
409- id = "desktopDownload.downloadCompactGeneric"
408+ < FormattedMessage
409+ id = "desktopDownload.downloadCompactGeneric"
410410 defaultMessage = "Download Remix Desktop {version}"
411411 values = { { version : releaseData . tag_name } }
412412 />
@@ -415,8 +415,8 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
415415 </ CustomTooltip >
416416 < div className = "text-muted" >
417417 < small >
418- < FormattedMessage
419- id = "desktopDownload.noAutoDetect"
418+ < FormattedMessage
419+ id = "desktopDownload.noAutoDetect"
420420 defaultMessage = "Available for Windows, macOS, and Linux"
421421 />
422422 </ small >
@@ -433,11 +433,11 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
433433 </ h5 >
434434 < span className = "badge bg-primary" > { releaseData . tag_name } </ span >
435435 </ div >
436-
436+
437437 < div className = "text-muted mb-2" >
438438 < small >
439- < FormattedMessage
440- id = "desktopDownload.releaseDate"
439+ < FormattedMessage
440+ id = "desktopDownload.releaseDate"
441441 defaultMessage = "Released {date}"
442442 values = { { date : formatDate ( releaseData . published_at ) } }
443443 />
@@ -460,28 +460,28 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
460460 >
461461 < i className = { getPlatformIcon ( detectedDownload . platform ) } > </ i >
462462 < span >
463- < FormattedMessage
464- id = "desktopDownload.downloadButton"
463+ < FormattedMessage
464+ id = "desktopDownload.downloadButton"
465465 defaultMessage = "Download for {platform}"
466- values = { {
466+ values = { {
467467 platform : getPlatformName ( detectedDownload . platform )
468468 } }
469469 />
470470 </ span >
471471 </ a >
472472 </ CustomTooltip >
473-
473+
474474 < div className = "text-muted" >
475475 < small >
476476 { formatSize ( detectedDownload . size ) } • { ' ' }
477- < a
478- href = { releaseData . html_url }
479- target = "_blank"
477+ < a
478+ href = { releaseData . html_url }
479+ target = "_blank"
480480 rel = "noopener noreferrer"
481481 className = "text-decoration-none text-muted"
482482 >
483- < FormattedMessage
484- id = "desktopDownload.otherVersions"
483+ < FormattedMessage
484+ id = "desktopDownload.otherVersions"
485485 defaultMessage = "Other versions and platforms"
486486 />
487487 </ a >
@@ -502,11 +502,11 @@ export const DesktopDownload: React.FC<DesktopDownloadProps> = ({
502502 < FormattedMessage id = "desktopDownload.viewReleases" defaultMessage = "View Downloads" />
503503 </ span >
504504 </ a >
505-
505+
506506 < div className = "text-muted" >
507507 < small >
508- < FormattedMessage
509- id = "desktopDownload.noAutoDetect"
508+ < FormattedMessage
509+ id = "desktopDownload.noAutoDetect"
510510 defaultMessage = "Available for Windows, macOS, and Linux"
511511 />
512512 </ small >
0 commit comments