Add ability to rename hotbars (#3469)

Signed-off-by: vshakirova <vshakirova@mirantis.com>
This commit is contained in:
Violetta Shakirova authored and GitHub committed 2021-07-27 08:54:41 -04:00
1 parent f507ec9e6c
commit 1b11433bca
6 files changed
+147 -4

No files matched your search

@@ -28,11 +28,13 @@ import { CommandOverlay } from "../command-palette";
import { HotbarAddCommand } from "./hotbar-add-command";
import { HotbarRemoveCommand } from "./hotbar-remove-command";
import { hotbarDisplayLabel } from "./hotbar-display-label";
import { HotbarRenameCommand } from "./hotbar-rename-command";
@observer
export class HotbarSwitchCommand extends React.Component {
private static addActionId = "__add__";
private static removeActionId = "__remove__";
private static renameActionId = "__rename__";
constructor(props: {}) {
super(props);
@@ -51,11 +53,13 @@ export class HotbarSwitchCommand extends React.Component {
options.push({ value: HotbarSwitchCommand.removeActionId, label: "Remove hotbar ..." });
}
options.push({ value: HotbarSwitchCommand.renameActionId, label: "Rename hotbar ..." });
return options;
}
onChange(idOrAction: string): void {
switch(idOrAction) {
switch (idOrAction) {
case HotbarSwitchCommand.addActionId:
CommandOverlay.open(<HotbarAddCommand />);
@@ -63,6 +67,10 @@ export class HotbarSwitchCommand extends React.Component {
case HotbarSwitchCommand.removeActionId:
CommandOverlay.open(<HotbarRemoveCommand />);
return;
case HotbarSwitchCommand.renameActionId:
CommandOverlay.open(<HotbarRenameCommand />);
return;
default:
HotbarStore.getInstance().activeHotbarId = idOrAction;