Fix macOS detect for docsite (#1314)

This commit is contained in:
Evan Simkowitz 2024-11-16 15:40:01 -08:00 committed by GitHub
parent 79f516d473
commit 31975983c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,14 +16,14 @@ export const PlatformContext = createContext<PlatformContextProps | undefined>(u
const detectPlatform = (): Platform => {
const savedPlatform = localStorage.getItem("platform") as Platform | null;
if (savedPlatform && (savedPlatform === "mac" || savedPlatform === "linux")) {
if (savedPlatform) {
return savedPlatform;
}
const { os } = UAParser(navigator.userAgent);
if (/Windows/.test(os.name)) {
return "windows";
} else if (/macOS|iOS/.test(os.name)) {
} else if (/Mac OS|iOS/.test(os.name)) {
return "mac";
} else {
return "linux";