Merge pull request #1389 from luckrnx09/luckrnx09-cmd-k-for-macos-users

Maint: Show `Cmd + K` for macOS users
This commit is contained in:
Jérémie Panzer
2024-05-26 10:14:10 +02:00
committed by GitHub
2 changed files with 7 additions and 4 deletions

View File

@@ -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 (
<Stack gap="xs">
<Table striped highlightOnHover>
@@ -149,7 +151,7 @@ export function KeyboardShortcutsHelp() {
</Table.Td>
<Table.Td>
<Kbd>
<Trans>Ctrl</Trans>
<Trans>{isMacOS ? "Cmd" : "Ctrl"}</Trans>
</Kbd>
<span> + </span>
<Kbd>K</Kbd>

View File

@@ -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"
@@ -14,7 +15,7 @@ export interface TreeSearchProps {
export function TreeSearch(props: TreeSearchProps) {
const dispatch = useAppDispatch()
const isMacOS = useOs() === "macos"
const actions: SpotlightActionData[] = props.feeds
.map(f => ({
id: `${f.id}`,
@@ -27,7 +28,7 @@ export function TreeSearch(props: TreeSearchProps) {
const searchIcon = <TbSearch size={18} />
const rightSection = (
<Center style={{ cursor: "pointer" }} onClick={() => spotlight.open()}>
<Kbd>Ctrl</Kbd>
<Kbd>{isMacOS ? "Cmd" : "Ctrl"}</Kbd>
<Box mx={5}>+</Box>
<Kbd>K</Kbd>
</Center>
@@ -56,7 +57,7 @@ export function TreeSearch(props: TreeSearchProps) {
<Spotlight
actions={actions}
limit={10}
shortcut="ctrl+k"
shortcut="mod+k"
searchProps={{
leftSection: searchIcon,
placeholder: t`Search`,