1- import React from "react"
1+ import React , { useState } from "react"
22import Box from "@material-ui/core/Box"
33import MuiButton from "@material-ui/core/Button"
44import { useUpdate } from "react-use"
55import { styled } from "@material-ui/core/styles"
66import usePosthog from "../../utils/use-posthog"
77import { useAppConfig } from "../AppConfig"
8+ import { useHotkeyStorage } from "../HotkeyStorage"
9+ import KeyboardShortcutManagerDialog from "../KeyboardShortcutManagerDialog"
810
911const Button = styled ( MuiButton ) ( {
1012 margin : 8 ,
@@ -14,6 +16,8 @@ export const AdvancedOptionsView = ({ onClickEditJSON, onClearLabelData }) => {
1416 const forceUpdate = useUpdate ( )
1517 const posthog = usePosthog ( )
1618 const { fromConfig, setInConfig } = useAppConfig ( )
19+ const { hotkeys, changeHotkey } = useHotkeyStorage ( )
20+ const [ hotkeyDialogOpen , setHotkeyDialogOpen ] = useState ( false )
1721
1822 return (
1923 < Box padding = { 2 } >
@@ -89,6 +93,22 @@ export const AdvancedOptionsView = ({ onClickEditJSON, onClearLabelData }) => {
8993 Label Help API Key
9094 </ Button >
9195 ) }
96+ < Button
97+ variant = "outlined"
98+ onClick = { ( ) => {
99+ setHotkeyDialogOpen ( true )
100+ } }
101+ >
102+ Change/View Hotkeys
103+ </ Button >
104+ < KeyboardShortcutManagerDialog
105+ open = { hotkeyDialogOpen }
106+ hotkeyList = { hotkeys }
107+ onClose = { ( ) => setHotkeyDialogOpen ( false ) }
108+ onChangeHotkey = { ( hotkey , newBinding ) =>
109+ changeHotkey ( hotkey . id , newBinding )
110+ }
111+ />
92112 </ Box >
93113 )
94114}
0 commit comments