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:
parent
87f583cbb4
commit
06ca020c61
@ -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();
|
||||
|
||||
@ -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) };
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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 ..." });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user