feat: Shortcut key for nerd stats (#3552)

* added alt+/ as the shortcut key for nerd stats

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>

* added shortcut info in HelpDialog.ts

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>

* resolved conflicts

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>

* added shortcut info in HelpDialog.ts

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
This commit is contained in:
Gurkiran Singh 2021-05-12 04:57:35 -04:00 committed by GitHub
parent 07839f8d20
commit bec34f2d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { register } from "./register"; import { register } from "./register";
import { CODES, KEYS } from "../keys";
export const actionToggleStats = register({ export const actionToggleStats = register({
name: "stats", name: "stats",
@ -13,4 +14,6 @@ export const actionToggleStats = register({
}, },
checked: (appState) => appState.showStats, checked: (appState) => appState.showStats,
contextItemLabel: "stats.title", contextItemLabel: "stats.title",
keyTest: (event) =>
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.SLASH,
}); });

View File

@ -57,7 +57,7 @@ const shortcutMap: Record<ShortcutName, string[]> = {
ungroup: [getShortcutKey("CtrlOrCmd+Shift+G")], ungroup: [getShortcutKey("CtrlOrCmd+Shift+G")],
gridMode: [getShortcutKey("CtrlOrCmd+'")], gridMode: [getShortcutKey("CtrlOrCmd+'")],
zenMode: [getShortcutKey("Alt+Z")], zenMode: [getShortcutKey("Alt+Z")],
stats: [], stats: [getShortcutKey("Alt+/")],
addToLibrary: [], addToLibrary: [],
flipHorizontal: [getShortcutKey("Shift+H")], flipHorizontal: [getShortcutKey("Shift+H")],
flipVertical: [getShortcutKey("Shift+V")], flipVertical: [getShortcutKey("Shift+V")],

View File

@ -235,6 +235,10 @@ export const HelpDialog = ({ onClose }: { onClose?: () => void }) => {
label={t("labels.toggleTheme")} label={t("labels.toggleTheme")}
shortcuts={[getShortcutKey("Alt+Shift+D")]} shortcuts={[getShortcutKey("Alt+Shift+D")]}
/> />
<Shortcut
label={t("stats.title")}
shortcuts={[getShortcutKey("Alt+/")]}
/>
</ShortcutIsland> </ShortcutIsland>
</Column> </Column>
<Column> <Column>

View File

@ -14,6 +14,7 @@ export const CODES = {
NINE: "Digit9", NINE: "Digit9",
QUOTE: "Quote", QUOTE: "Quote",
ZERO: "Digit0", ZERO: "Digit0",
SLASH: "Slash",
C: "KeyC", C: "KeyC",
D: "KeyD", D: "KeyD",
G: "KeyG", G: "KeyG",