Skip to content

Commit 0c0a501

Browse files
fix(web): show homebrew section only on desktop macOS (#2138)
Use usePlatform hook instead of manual UA parsing to properly distinguish desktop macOS from mobile devices (iOS). The previous implementation using navigator.userAgent.includes('mac') would incorrectly show the homebrew section on iOS devices. Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 3624153 commit 0c0a501

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

apps/web/src/routes/_view/download/index.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
11
import { Icon } from "@iconify-icon/react";
22
import { createFileRoute, Link } from "@tanstack/react-router";
33
import { Check, Copy } from "lucide-react";
4-
import { useEffect, useState } from "react";
4+
import { useState } from "react";
55

66
import { cn } from "@hypr/utils";
77

88
import { Image } from "@/components/image";
99
import { SlashSeparator } from "@/components/slash-separator";
10+
import { usePlatform } from "@/hooks/use-platform";
1011

1112
export const Route = createFileRoute("/_view/download/")({
1213
component: Component,
1314
});
1415

1516
function Component() {
16-
const [isMac, setIsMac] = useState(false);
17-
18-
useEffect(() => {
19-
setIsMac(navigator.userAgent.toLowerCase().includes("mac"));
20-
}, []);
17+
const platform = usePlatform();
18+
const isMacDesktop = platform === "mac";
2119

2220
return (
2321
<div
@@ -96,7 +94,7 @@ function Component() {
9694
</div>
9795
</div>
9896

99-
{isMac && (
97+
{isMacDesktop && (
10098
<div className="mb-16">
10199
<h2 className="text-2xl font-serif tracking-tight mb-6 text-center">
102100
Homebrew

0 commit comments

Comments
 (0)