Procházet zdrojové kódy

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>
vanilla_orig
Gurkiran Singh před 4 roky
rodič
revize
bec34f2d57
Žádný účet není propojen s e-mailovou adresou tvůrce revize

+ 3
- 0
src/actions/actionToggleStats.tsx Zobrazit soubor

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

+ 1
- 1
src/actions/shortcuts.ts Zobrazit soubor

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

+ 4
- 0
src/components/HelpDialog.tsx Zobrazit soubor

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

+ 1
- 0
src/keys.ts Zobrazit soubor

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

Načítá se…
Zrušit
Uložit