Skip to content

Commit 0811a45

Browse files
committed
fix: do not display shortcut if it is not initialized
1 parent e9a2317 commit 0811a45

File tree

1 file changed

+28
-23
lines changed

1 file changed

+28
-23
lines changed

code/core/src/manager/settings/shortcuts.tsx

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class ShortcutsScreen extends Component<ShortcutsScreenProps, ShortcutsScreenSta
230230

231231
onBlur = async () => {
232232
const { shortcutKeys, activeFeature } = this.state;
233-
233+
234234
if (shortcutKeys[activeFeature]) {
235235
const { shortcut, error } = shortcutKeys[activeFeature];
236236
if (!shortcut || error) {
@@ -288,28 +288,33 @@ class ShortcutsScreen extends Component<ShortcutsScreenProps, ShortcutsScreenSta
288288
renderKeyInput = () => {
289289
const { shortcutKeys, addonsShortcutLabels } = this.state;
290290
// @ts-expect-error (non strict)
291-
const arr = Object.entries(shortcutKeys).map(([feature, { shortcut }]: [Feature, any]) => (
292-
<Row key={feature}>
293-
{/* @ts-expect-error (non strict) */}
294-
<Description>{shortcutLabels[feature] || addonsShortcutLabels[feature]}</Description>
295-
296-
<TextInput
297-
spellCheck="false"
298-
valid={this.displayError(feature)}
299-
className="modalInput"
300-
onBlur={this.onBlur}
301-
onFocus={this.onFocus(feature)}
302-
// @ts-expect-error (Converted from ts-ignore)
303-
onKeyDown={this.onKeyDown}
304-
value={shortcut ? shortcutToHumanString(shortcut) : ''}
305-
placeholder="Type keys"
306-
readOnly
307-
/>
308-
309-
{/* @ts-expect-error (non strict) */}
310-
<SuccessIcon valid={this.displaySuccessMessage(feature)} />
311-
</Row>
312-
));
291+
const arr = Object.entries(shortcutKeys).map(([feature, { shortcut }]: [Feature, any]) => {
292+
if (shortcutLabels[feature] === undefined && (!addonsShortcutLabels || !addonsShortcutLabels[feature])) {
293+
return;
294+
}
295+
return (
296+
<Row key={feature}>
297+
{/* @ts-expect-error (non strict) */}
298+
<Description>{shortcutLabels[feature] || addonsShortcutLabels[feature]}</Description>
299+
300+
<TextInput
301+
spellCheck="false"
302+
valid={this.displayError(feature)}
303+
className="modalInput"
304+
onBlur={this.onBlur}
305+
onFocus={this.onFocus(feature)}
306+
// @ts-expect-error (Converted from ts-ignore)
307+
onKeyDown={this.onKeyDown}
308+
value={shortcut ? shortcutToHumanString(shortcut) : ''}
309+
placeholder="Type keys"
310+
readOnly
311+
/>
312+
313+
{/* @ts-expect-error (non strict) */}
314+
<SuccessIcon valid={this.displaySuccessMessage(feature)} />
315+
</Row>
316+
);
317+
});
313318

314319
return arr;
315320
};

0 commit comments

Comments
 (0)