UI: Improve multi OS display #205

Merged
Oleg-Komarov merged 40 commits from ui/multi-os into main 2024-07-16 07:24:07 +02:00
Showing only changes of commit 94beac2cd3 - Show all commits

View File

@ -129,6 +129,21 @@
const activePlatform = navigator.platform.toLowerCase();
const activePlatformPrefix = activePlatform.substring(0, 3);
// Create function to detect architecture ARM
function isArchARM() {
let isARM = false;
// Newer browsers
if (navigator.userAgentData && navigator.userAgentData.platform) {
isARM = navigator.userAgentData.platform.includes('ARM');
} else {
// Fallback for older browsers
isARM = navigator.userAgent.includes('ARM') || navigator.userAgent.includes('arm');
}
return isARM;
}
btnInstallActionItem.forEach(function(item) {
// Hide all items by default
item.classList.add('d-none');
@ -147,6 +162,15 @@
if (itemPlatformBasePrefix.startsWith(activePlatformPrefix)) {
item.classList.add('btn-install-action-item-active');
item.classList.remove('d-none');
// TODO: WIP show only relevant item for active macOS architecture, if architecture detection reliably works
if (activePlatformPrefix.startsWith('mac')) {
if (isArchARM()) {
console.log('Platform: macOS Apple Silicon');
} else {
console.log('Platform: macOS Intel');
}
}
}
});