1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

address review comments for hotbarDisplayLabel()

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann 2021-05-14 10:26:40 -04:00
parent 87f583cbb4
commit 06ca020c61
4 changed files with 5 additions and 5 deletions

View File

@ -21,14 +21,14 @@
import { HotbarStore } from "../../../common/hotbar-store";
export function hotbarDisplayLabel(id: string, withName = false) : string {
export function hotbarDisplayLabel(id: string, withName = true) : string {
const hotbarStore = HotbarStore.getInstance();
const index = hotbarStore.hotbarIndex(id) + 1;
if (withName) {
const hotbar = hotbarStore.getById(id);
return [ index, ": ", hotbar.name ].join("");
return `${index}: ${hotbar.name}`;
}
return index.toString();

View File

@ -32,7 +32,7 @@ import { ConfirmDialog } from "../confirm-dialog";
export class HotbarRemoveCommand extends React.Component {
@computed get options() {
return HotbarStore.getInstance().hotbars.map((hotbar) => {
return { value: hotbar.id, label: hotbarDisplayLabel(hotbar.id, true) };
return { value: hotbar.id, label: hotbarDisplayLabel(hotbar.id) };
});
}

View File

@ -44,7 +44,7 @@ export function HotbarSelector({ hotbar }: Props) {
<Badge
id="hotbarIndex"
small
label={hotbarDisplayLabel(store.activeHotbarId)}
label={hotbarDisplayLabel(store.activeHotbarId, false)}
onClick={() => CommandOverlay.open(<HotbarSwitchCommand />)}
/>
</MaterialTooltip>

View File

@ -37,7 +37,7 @@ export class HotbarSwitchCommand extends React.Component {
@computed get options() {
const hotbarStore = HotbarStore.getInstance();
const options = hotbarStore.hotbars.map((hotbar) => {
return { value: hotbar.id, label: hotbarDisplayLabel(hotbar.id, true) };
return { value: hotbar.id, label: hotbarDisplayLabel(hotbar.id) };
});
options.push({ value: HotbarSwitchCommand.addActionId, label: "Add hotbar ..." });