Files
twenty_crm/packages/twenty-ui/src/utilities/device/getUserDevice.ts
Raphaël Bosi ff93fd3c74 190 display ctrl instead of for windows users (#9617)
Closes https://github.com/twentyhq/core-team-issues/issues/190

<img width="226" alt="Capture d’écran 2025-01-15 à 12 07 12"
src="https://github.com/user-attachments/assets/b9a13746-2629-477a-9795-cda03c63f8f6"
/>

To test, update the user agent in your browser dev tools:
<img width="459" alt="Capture d’écran 2025-01-15 à 12 14 29"
src="https://github.com/user-attachments/assets/4371d5fc-fd3c-403d-beaa-7ba58019d3c9"
/>
2025-01-15 12:53:18 +00:00

27 lines
524 B
TypeScript

export const getUserDevice = () => {
const userAgent = navigator.userAgent.toLowerCase();
if (userAgent.includes('mac os x') || userAgent.includes('macos')) {
return 'mac';
}
if (userAgent.includes('windows')) {
return 'windows';
}
if (userAgent.includes('linux')) {
return 'linux';
}
if (userAgent.includes('android')) return 'android';
if (
userAgent.includes('ios') ||
userAgent.includes('iphone') ||
userAgent.includes('ipad')
)
return 'ios';
return 'unknown';
};