From 884516be28e4978fb057cdcf910e25e5f3adfd02 Mon Sep 17 00:00:00 2001 From: luckrnx09 Date: Wed, 15 May 2024 21:22:53 +0800 Subject: [PATCH 1/3] Maint: Show `Cmd + K` for macOS users --- commafeed-client/src/components/sidebar/TreeSearch.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/commafeed-client/src/components/sidebar/TreeSearch.tsx b/commafeed-client/src/components/sidebar/TreeSearch.tsx index 72368c6b..6a24d069 100644 --- a/commafeed-client/src/components/sidebar/TreeSearch.tsx +++ b/commafeed-client/src/components/sidebar/TreeSearch.tsx @@ -12,6 +12,10 @@ export interface TreeSearchProps { feeds: Subscription[] } +function isMacOS() { + return navigator.platform.toUpperCase().includes("MAC") +} + export function TreeSearch(props: TreeSearchProps) { const dispatch = useAppDispatch() @@ -27,7 +31,7 @@ export function TreeSearch(props: TreeSearchProps) { const searchIcon = const rightSection = (
spotlight.open()}> - Ctrl + {isMacOS() ? "Cmd" : "Ctrl"} + K
From ab86247c8c20fccb0ed5a62812315ee3c4578a9c Mon Sep 17 00:00:00 2001 From: luckrnx09 Date: Wed, 15 May 2024 21:47:34 +0800 Subject: [PATCH 2/3] update the hot key to `mod+k` for call spotlight --- commafeed-client/src/components/sidebar/TreeSearch.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commafeed-client/src/components/sidebar/TreeSearch.tsx b/commafeed-client/src/components/sidebar/TreeSearch.tsx index 6a24d069..7f5dbc4a 100644 --- a/commafeed-client/src/components/sidebar/TreeSearch.tsx +++ b/commafeed-client/src/components/sidebar/TreeSearch.tsx @@ -60,7 +60,7 @@ export function TreeSearch(props: TreeSearchProps) { Date: Sat, 25 May 2024 21:35:10 +0800 Subject: [PATCH 3/3] fix: determine os type from useOs hook --- .../src/components/KeyboardShortcutsHelp.tsx | 4 +++- commafeed-client/src/components/sidebar/TreeSearch.tsx | 9 +++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/commafeed-client/src/components/KeyboardShortcutsHelp.tsx b/commafeed-client/src/components/KeyboardShortcutsHelp.tsx index d33d0302..be04c2cf 100644 --- a/commafeed-client/src/components/KeyboardShortcutsHelp.tsx +++ b/commafeed-client/src/components/KeyboardShortcutsHelp.tsx @@ -1,8 +1,10 @@ import { Trans } from "@lingui/macro" import { Anchor, Box, Kbd, Stack, Table } from "@mantine/core" +import { useOs } from "@mantine/hooks" import { Constants } from "app/constants" export function KeyboardShortcutsHelp() { + const isMacOS = useOs() === "macos" return ( @@ -149,7 +151,7 @@ export function KeyboardShortcutsHelp() { - Ctrl + {isMacOS ? "Cmd" : "Ctrl"} + K diff --git a/commafeed-client/src/components/sidebar/TreeSearch.tsx b/commafeed-client/src/components/sidebar/TreeSearch.tsx index 7f5dbc4a..f804665b 100644 --- a/commafeed-client/src/components/sidebar/TreeSearch.tsx +++ b/commafeed-client/src/components/sidebar/TreeSearch.tsx @@ -1,5 +1,6 @@ import { t, Trans } from "@lingui/macro" import { Box, Center, Kbd, TextInput } from "@mantine/core" +import { useOs } from "@mantine/hooks" import { Spotlight, spotlight, type SpotlightActionData } from "@mantine/spotlight" import { redirectToFeed } from "app/redirect/thunks" import { useAppDispatch } from "app/store" @@ -12,13 +13,9 @@ export interface TreeSearchProps { feeds: Subscription[] } -function isMacOS() { - return navigator.platform.toUpperCase().includes("MAC") -} - export function TreeSearch(props: TreeSearchProps) { const dispatch = useAppDispatch() - + const isMacOS = useOs() === "macos" const actions: SpotlightActionData[] = props.feeds .map(f => ({ id: `${f.id}`, @@ -31,7 +28,7 @@ export function TreeSearch(props: TreeSearchProps) { const searchIcon = const rightSection = (
spotlight.open()}> - {isMacOS() ? "Cmd" : "Ctrl"} + {isMacOS ? "Cmd" : "Ctrl"} + K