forked from Archives/Athou_commafeed
fix: determine os type from useOs hook
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
import { Trans } from "@lingui/macro"
|
import { Trans } from "@lingui/macro"
|
||||||
import { Anchor, Box, Kbd, Stack, Table } from "@mantine/core"
|
import { Anchor, Box, Kbd, Stack, Table } from "@mantine/core"
|
||||||
|
import { useOs } from "@mantine/hooks"
|
||||||
import { Constants } from "app/constants"
|
import { Constants } from "app/constants"
|
||||||
|
|
||||||
export function KeyboardShortcutsHelp() {
|
export function KeyboardShortcutsHelp() {
|
||||||
|
const isMacOS = useOs() === "macos"
|
||||||
return (
|
return (
|
||||||
<Stack gap="xs">
|
<Stack gap="xs">
|
||||||
<Table striped highlightOnHover>
|
<Table striped highlightOnHover>
|
||||||
@@ -149,7 +151,7 @@ export function KeyboardShortcutsHelp() {
|
|||||||
</Table.Td>
|
</Table.Td>
|
||||||
<Table.Td>
|
<Table.Td>
|
||||||
<Kbd>
|
<Kbd>
|
||||||
<Trans>Ctrl</Trans>
|
<Trans>{isMacOS ? "Cmd" : "Ctrl"}</Trans>
|
||||||
</Kbd>
|
</Kbd>
|
||||||
<span> + </span>
|
<span> + </span>
|
||||||
<Kbd>K</Kbd>
|
<Kbd>K</Kbd>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { t, Trans } from "@lingui/macro"
|
import { t, Trans } from "@lingui/macro"
|
||||||
import { Box, Center, Kbd, TextInput } from "@mantine/core"
|
import { Box, Center, Kbd, TextInput } from "@mantine/core"
|
||||||
|
import { useOs } from "@mantine/hooks"
|
||||||
import { Spotlight, spotlight, type SpotlightActionData } from "@mantine/spotlight"
|
import { Spotlight, spotlight, type SpotlightActionData } from "@mantine/spotlight"
|
||||||
import { redirectToFeed } from "app/redirect/thunks"
|
import { redirectToFeed } from "app/redirect/thunks"
|
||||||
import { useAppDispatch } from "app/store"
|
import { useAppDispatch } from "app/store"
|
||||||
@@ -12,13 +13,9 @@ export interface TreeSearchProps {
|
|||||||
feeds: Subscription[]
|
feeds: Subscription[]
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMacOS() {
|
|
||||||
return navigator.platform.toUpperCase().includes("MAC")
|
|
||||||
}
|
|
||||||
|
|
||||||
export function TreeSearch(props: TreeSearchProps) {
|
export function TreeSearch(props: TreeSearchProps) {
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
|
const isMacOS = useOs() === "macos"
|
||||||
const actions: SpotlightActionData[] = props.feeds
|
const actions: SpotlightActionData[] = props.feeds
|
||||||
.map(f => ({
|
.map(f => ({
|
||||||
id: `${f.id}`,
|
id: `${f.id}`,
|
||||||
@@ -31,7 +28,7 @@ export function TreeSearch(props: TreeSearchProps) {
|
|||||||
const searchIcon = <TbSearch size={18} />
|
const searchIcon = <TbSearch size={18} />
|
||||||
const rightSection = (
|
const rightSection = (
|
||||||
<Center style={{ cursor: "pointer" }} onClick={() => spotlight.open()}>
|
<Center style={{ cursor: "pointer" }} onClick={() => spotlight.open()}>
|
||||||
<Kbd>{isMacOS() ? "Cmd" : "Ctrl"}</Kbd>
|
<Kbd>{isMacOS ? "Cmd" : "Ctrl"}</Kbd>
|
||||||
<Box mx={5}>+</Box>
|
<Box mx={5}>+</Box>
|
||||||
<Kbd>K</Kbd>
|
<Kbd>K</Kbd>
|
||||||
</Center>
|
</Center>
|
||||||
|
|||||||
Reference in New Issue
Block a user