From 06ca020c618ad5e7a53b8b47b121834f4437dce4 Mon Sep 17 00:00:00 2001 From: Jim Ehrismann Date: Fri, 14 May 2021 10:26:40 -0400 Subject: [PATCH] address review comments for hotbarDisplayLabel() Signed-off-by: Jim Ehrismann --- src/renderer/components/hotbar/hotbar-display-label.ts | 4 ++-- src/renderer/components/hotbar/hotbar-remove-command.tsx | 2 +- src/renderer/components/hotbar/hotbar-selector.tsx | 2 +- src/renderer/components/hotbar/hotbar-switch-command.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/hotbar/hotbar-display-label.ts b/src/renderer/components/hotbar/hotbar-display-label.ts index 55adeca522..6f7506af6e 100644 --- a/src/renderer/components/hotbar/hotbar-display-label.ts +++ b/src/renderer/components/hotbar/hotbar-display-label.ts @@ -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(); diff --git a/src/renderer/components/hotbar/hotbar-remove-command.tsx b/src/renderer/components/hotbar/hotbar-remove-command.tsx index a81c8c2234..e60dc2bfaf 100644 --- a/src/renderer/components/hotbar/hotbar-remove-command.tsx +++ b/src/renderer/components/hotbar/hotbar-remove-command.tsx @@ -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) }; }); } diff --git a/src/renderer/components/hotbar/hotbar-selector.tsx b/src/renderer/components/hotbar/hotbar-selector.tsx index 6c1869199e..6d713749ec 100644 --- a/src/renderer/components/hotbar/hotbar-selector.tsx +++ b/src/renderer/components/hotbar/hotbar-selector.tsx @@ -44,7 +44,7 @@ export function HotbarSelector({ hotbar }: Props) { CommandOverlay.open()} /> diff --git a/src/renderer/components/hotbar/hotbar-switch-command.tsx b/src/renderer/components/hotbar/hotbar-switch-command.tsx index a4e8acde39..1d11a02c80 100644 --- a/src/renderer/components/hotbar/hotbar-switch-command.tsx +++ b/src/renderer/components/hotbar/hotbar-switch-command.tsx @@ -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 ..." });