feat: shortcut h to show shortcuts modal (#361)
This commit is contained in:
parent
a2457a7789
commit
e9dc7b2f4c
|
|
@ -20,6 +20,10 @@ export const shortcuts = {
|
|||
name: "Show/Hide Feed Sidebar",
|
||||
key: "Meta+B",
|
||||
},
|
||||
showShortcuts: {
|
||||
name: "Show Shortcuts",
|
||||
key: "H",
|
||||
},
|
||||
},
|
||||
entries: {
|
||||
refetch: {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { CornerPlayer } from "@renderer/modules/feed-column/corner-player"
|
|||
import { CmdF } from "@renderer/modules/panel/cmdf"
|
||||
import { SearchCmdK } from "@renderer/modules/panel/cmdk"
|
||||
import { CmdNTrigger } from "@renderer/modules/panel/cmdn"
|
||||
import { useSettingModal } from "@renderer/modules/settings/modal/hooks"
|
||||
import { throttle } from "lodash-es"
|
||||
import type { PropsWithChildren } from "react"
|
||||
import React, { useEffect, useRef, useState } from "react"
|
||||
|
|
@ -168,6 +169,16 @@ const FeedResponsiveResizerContainer = ({
|
|||
scopes: HotKeyScopeMap.Home,
|
||||
},
|
||||
)
|
||||
const settingModalPresent = useSettingModal()
|
||||
useHotkeys(
|
||||
shortcuts.layout.showShortcuts.key,
|
||||
() => {
|
||||
settingModalPresent("shortcuts")
|
||||
},
|
||||
{
|
||||
scopes: HotKeyScopeMap.Home,
|
||||
},
|
||||
)
|
||||
|
||||
const [delayShowSplitter, setDelayShowSplitter] = useState(feedColumnShow)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { KbdCombined } from "@renderer/components/ui/kbd/Kbd"
|
||||
import { Kbd, KbdCombined } from "@renderer/components/ui/kbd/Kbd"
|
||||
import { shortcuts } from "@renderer/constants/shortcuts"
|
||||
import { cn } from "@renderer/lib/utils"
|
||||
import { SettingsTitle } from "@renderer/modules/settings/title"
|
||||
|
|
@ -17,6 +17,9 @@ export function Component() {
|
|||
return (
|
||||
<>
|
||||
<SettingsTitle />
|
||||
<p className="text-sm">
|
||||
Press <Kbd>H</Kbd> to show this Shortcuts modal.
|
||||
</p>
|
||||
<div className="mt-4 space-y-6">
|
||||
{Object.keys(shortcuts).map((type) => (
|
||||
<section key={type}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue