Skip to content

Commit da42fb1

Browse files
committed
fix
1 parent cd8a88d commit da42fb1

File tree

1 file changed

+11
-29
lines changed

1 file changed

+11
-29
lines changed

src/dashboard/Settings/KeyboardShortcutsSettings.react.js

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ export default class KeyboardShortcutsSettings extends DashboardView {
2727
dataBrowserReloadData: '',
2828
dataBrowserToggleInfoPanels: '',
2929
hasChanges: false,
30-
message: null,
31-
loading: true,
30+
message: undefined,
3231
};
3332

3433
this.manager = null;
@@ -56,12 +55,10 @@ export default class KeyboardShortcutsSettings extends DashboardView {
5655
dataBrowserReloadData: shortcuts.dataBrowserReloadData?.key || '',
5756
dataBrowserToggleInfoPanels: shortcuts.dataBrowserToggleInfoPanels?.key || '',
5857
hasChanges: false,
59-
loading: false,
6058
});
6159
} catch (error) {
6260
console.error('Failed to load keyboard shortcuts:', error);
6361
this.showNote('Failed to load keyboard shortcuts', true);
64-
this.setState({ loading: false });
6562
}
6663
}
6764

@@ -143,40 +140,25 @@ export default class KeyboardShortcutsSettings extends DashboardView {
143140
this.setState({ message: { text: message, isError } });
144141

145142
this.noteTimeout = setTimeout(() => {
146-
this.setState({ message: null });
143+
this.setState({ message: undefined });
147144
}, 3500);
148145
}
149146

150147
renderContent() {
151-
if (this.state.loading) {
152-
return (
153-
<div>
154-
<Toolbar section="Settings" subsection="Keyboard Shortcuts" />
155-
<div className={styles.settings_page}>
156-
<div>Loading keyboard shortcuts...</div>
157-
</div>
158-
</div>
159-
);
160-
}
148+
// Show error if server config is not enabled
149+
const serverConfigError = this.manager && !this.manager.isServerConfigEnabled()
150+
? 'Server configuration is not enabled for this app. Please add a \'config\' section to your app configuration to use keyboard shortcuts.'
151+
: null;
161152

162-
if (this.manager && !this.manager.isServerConfigEnabled()) {
163-
return (
164-
<div>
165-
<Toolbar section="Settings" subsection="Keyboard Shortcuts" />
166-
<div className={styles.settings_page}>
167-
<Notification
168-
note="Server configuration is not enabled for this app. Please add a 'config' section to your app configuration to use keyboard shortcuts."
169-
isErrorNote={true}
170-
/>
171-
</div>
172-
</div>
173-
);
174-
}
153+
// Show either server config error or user message
154+
const message = this.state.message;
155+
const notificationMessage = serverConfigError || (message && message.text);
156+
const isError = serverConfigError ? true : (message && message.isError);
175157

176158
return (
177159
<div>
178160
<Toolbar section="Settings" subsection="Keyboard Shortcuts" />
179-
<Notification note={this.state.message?.text} isErrorNote={this.state.message?.isError} />
161+
<Notification note={notificationMessage} isErrorNote={isError} />
180162
<div className={styles.settings_page}>
181163
<Fieldset
182164
legend="Data Browser"

0 commit comments

Comments
 (0)