fix: show both Mac options (not Windows) for undetected Mac arch

Add 'macos' platform type for Macs where WebGL can't determine
Apple Silicon vs Intel. Shows both Mac download buttons without
the irrelevant Windows option.
This commit is contained in:
Elie Habib
2026-02-17 19:03:42 +04:00
parent b508db26bd
commit de88ef8719

View File

@@ -28,7 +28,7 @@ function dismiss(panel: HTMLElement): void {
panel.addEventListener('transitionend', () => panel.remove(), { once: true });
}
type Platform = 'macos-arm64' | 'macos-x64' | 'windows' | 'unknown';
type Platform = 'macos-arm64' | 'macos-x64' | 'macos' | 'windows' | 'unknown';
function detectPlatform(): Platform {
const ua = navigator.userAgent;
@@ -48,7 +48,7 @@ function detectPlatform(): Platform {
}
} catch { /* ignore */ }
// Can't determine architecture — show both Mac options
return 'unknown';
return 'macos';
}
return 'unknown';
}
@@ -65,6 +65,7 @@ function buttonsForPlatform(p: Platform): DlButton[] {
switch (p) {
case 'macos-arm64': return ALL_BUTTONS.filter(b => b.href.includes('macos-arm64'));
case 'macos-x64': return ALL_BUTTONS.filter(b => b.href.includes('macos-x64'));
case 'macos': return ALL_BUTTONS.filter(b => b.cls === 'mac');
case 'windows': return ALL_BUTTONS.filter(b => b.cls === 'win');
default: return ALL_BUTTONS;
}