22 lines
556 B
TypeScript
22 lines
556 B
TypeScript
import { register } from "./register";
|
|
import { CODES, KEYS } from "../keys";
|
|
|
|
export const actionToggleStats = register({
|
|
name: "stats",
|
|
viewMode: true,
|
|
trackEvent: { category: "menu" },
|
|
perform(elements, appState) {
|
|
return {
|
|
appState: {
|
|
...appState,
|
|
showStats: !this.checked!(appState),
|
|
},
|
|
commitToHistory: false,
|
|
};
|
|
},
|
|
checked: (appState) => appState.showStats,
|
|
contextItemLabel: "stats.title",
|
|
keyTest: (event) =>
|
|
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.SLASH,
|
|
});
|