From 787afb5a18ed937650fbd04e9d1518101de7bc10 Mon Sep 17 00:00:00 2001 From: Bartosz Jarocki Date: Tue, 16 Jan 2024 21:48:59 +0100 Subject: [PATCH] Revert "Display the correct button based on the user platform (#46)" This reverts commit 732668a5c223f483144ef99dd775df8a7c174880. --- src/components/command-menu.tsx | 4 +--- src/hooks/useOS.ts | 17 ----------------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 src/hooks/useOS.ts diff --git a/src/components/command-menu.tsx b/src/components/command-menu.tsx index 0ab5856..972605b 100644 --- a/src/components/command-menu.tsx +++ b/src/components/command-menu.tsx @@ -13,7 +13,6 @@ import { } from "@/components/ui/command"; import { Button } from "./ui/button"; import { CommandIcon } from "lucide-react"; -import { useOS } from "@/hooks/useOS"; interface Props { links: { url: string; title: string }[]; @@ -21,7 +20,6 @@ interface Props { export const CommandMenu = ({ links }: Props) => { const [open, setOpen] = React.useState(false); - const os = useOS(); React.useEffect(() => { const down = (e: KeyboardEvent) => { @@ -40,7 +38,7 @@ export const CommandMenu = ({ links }: Props) => {

Press{" "} - {os === "mac" ? "⌘" : "CTRL"}+ J + J {" "} to open the command menu

diff --git a/src/hooks/useOS.ts b/src/hooks/useOS.ts deleted file mode 100644 index 7f21564..0000000 --- a/src/hooks/useOS.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useMemo } from "react"; - -export type OS = "mac" | "windows" | "linux" | "other"; - -export const useOS = (): OS => { - const getOperatingSystem = (): OS => { - const userAgent = window.navigator.userAgent.toLowerCase(); - - if (userAgent.includes("mac")) return "mac"; - if (userAgent.includes("win")) return "windows"; - if (userAgent.includes("linux")) return "linux"; - - return "other"; - }; - - return useMemo(() => getOperatingSystem(), []); -};