diff options
author | 2023-12-07 22:37:37 -0700 | |
---|---|---|
committer | 2023-12-07 22:37:37 -0700 | |
commit | a774c879d4cf08a76fc404771883807d27465265 (patch) | |
tree | 202c9afdeb4830d417e0ec7137a01e7981c8651c /src/features/quickSwitch/Component.tsx | |
parent | 6.6.1-nightly.17 [skip ci] (diff) | |
download | ferdium-app-a774c879d4cf08a76fc404771883807d27465265.tar.gz ferdium-app-a774c879d4cf08a76fc404771883807d27465265.tar.zst ferdium-app-a774c879d4cf08a76fc404771883807d27465265.zip |
refactor: code cleanup (#1476)
- auto update `settings.json` due to new vscode version
- replace deprecated `e.keyCode` with `e.key`
- fix various code snippets with sonarlint and other lint plugins
Diffstat (limited to 'src/features/quickSwitch/Component.tsx')
-rw-r--r-- | src/features/quickSwitch/Component.tsx | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/features/quickSwitch/Component.tsx b/src/features/quickSwitch/Component.tsx index ab07e5d4d..7f6ad6432 100644 --- a/src/features/quickSwitch/Component.tsx +++ b/src/features/quickSwitch/Component.tsx | |||
@@ -88,14 +88,6 @@ interface IState { | |||
88 | @inject('stores', 'actions') | 88 | @inject('stores', 'actions') |
89 | @observer | 89 | @observer |
90 | class QuickSwitchModal extends Component<IProps, IState> { | 90 | class QuickSwitchModal extends Component<IProps, IState> { |
91 | ARROW_DOWN = 40; | ||
92 | |||
93 | ARROW_UP = 38; | ||
94 | |||
95 | ENTER = 13; | ||
96 | |||
97 | TAB = 9; | ||
98 | |||
99 | inputRef = createRef<HTMLDivElement>(); | 91 | inputRef = createRef<HTMLDivElement>(); |
100 | 92 | ||
101 | serviceElements = {}; | 93 | serviceElements = {}; |
@@ -214,12 +206,12 @@ class QuickSwitchModal extends Component<IProps, IState> { | |||
214 | // Handle global key presses to change the selection | 206 | // Handle global key presses to change the selection |
215 | _handleKeyDown(event: KeyboardEvent): void { | 207 | _handleKeyDown(event: KeyboardEvent): void { |
216 | if (ModalState.isModalVisible) { | 208 | if (ModalState.isModalVisible) { |
217 | switch (event.keyCode) { | 209 | switch (event.key) { |
218 | case this.ARROW_DOWN: { | 210 | case 'ArrowDown': { |
219 | this.changeSelected(1); | 211 | this.changeSelected(1); |
220 | break; | 212 | break; |
221 | } | 213 | } |
222 | case this.TAB: { | 214 | case 'Tab': { |
223 | if (event.shiftKey) { | 215 | if (event.shiftKey) { |
224 | this.changeSelected(-1); | 216 | this.changeSelected(-1); |
225 | } else { | 217 | } else { |
@@ -227,11 +219,11 @@ class QuickSwitchModal extends Component<IProps, IState> { | |||
227 | } | 219 | } |
228 | break; | 220 | break; |
229 | } | 221 | } |
230 | case this.ARROW_UP: { | 222 | case 'ArrowUp': { |
231 | this.changeSelected(-1); | 223 | this.changeSelected(-1); |
232 | break; | 224 | break; |
233 | } | 225 | } |
234 | case this.ENTER: { | 226 | case 'Enter': { |
235 | this.openService(this.state.selected); | 227 | this.openService(this.state.selected); |
236 | break; | 228 | break; |
237 | } | 229 | } |