mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
tweaks to hotbarDisplayLabel()
Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
parent
06ca020c61
commit
793da54763
@ -21,15 +21,16 @@
|
|||||||
|
|
||||||
import { HotbarStore } from "../../../common/hotbar-store";
|
import { HotbarStore } from "../../../common/hotbar-store";
|
||||||
|
|
||||||
export function hotbarDisplayLabel(id: string, withName = true) : string {
|
function hotbarIndex(id: string) {
|
||||||
const hotbarStore = HotbarStore.getInstance();
|
return HotbarStore.getInstance().hotbarIndex(id) + 1;
|
||||||
const index = hotbarStore.hotbarIndex(id) + 1;
|
}
|
||||||
|
|
||||||
if (withName) {
|
export function hotbarDisplayLabel(id: string) : string {
|
||||||
const hotbar = hotbarStore.getById(id);
|
const hotbar = HotbarStore.getInstance().getById(id);
|
||||||
|
|
||||||
return `${index}: ${hotbar.name}`;
|
return `${hotbarIndex(id)}: ${hotbar.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return index.toString();
|
export function hotbarDisplayIndex(id: string) : string {
|
||||||
|
return hotbarIndex(id).toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import { Badge } from "../badge";
|
|||||||
import { Hotbar, HotbarStore } from "../../../common/hotbar-store";
|
import { Hotbar, HotbarStore } from "../../../common/hotbar-store";
|
||||||
import { CommandOverlay } from "../command-palette";
|
import { CommandOverlay } from "../command-palette";
|
||||||
import { HotbarSwitchCommand } from "./hotbar-switch-command";
|
import { HotbarSwitchCommand } from "./hotbar-switch-command";
|
||||||
import { hotbarDisplayLabel } from "./hotbar-display-label";
|
import { hotbarDisplayIndex } from "./hotbar-display-label";
|
||||||
import { MaterialTooltip } from "../+catalog/material-tooltip/material-tooltip";
|
import { MaterialTooltip } from "../+catalog/material-tooltip/material-tooltip";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -44,7 +44,7 @@ export function HotbarSelector({ hotbar }: Props) {
|
|||||||
<Badge
|
<Badge
|
||||||
id="hotbarIndex"
|
id="hotbarIndex"
|
||||||
small
|
small
|
||||||
label={hotbarDisplayLabel(store.activeHotbarId, false)}
|
label={hotbarDisplayIndex(store.activeHotbarId)}
|
||||||
onClick={() => CommandOverlay.open(<HotbarSwitchCommand />)}
|
onClick={() => CommandOverlay.open(<HotbarSwitchCommand />)}
|
||||||
/>
|
/>
|
||||||
</MaterialTooltip>
|
</MaterialTooltip>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user