mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix broken hotbar switcher (#5182)
* Getting this context for switch hotbar methods Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com> * Do not convert store methods to arrow functions Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
feb983c42c
commit
66330485b1
@ -44,9 +44,14 @@ const NonInjectedHotbarSelector = observer(({ hotbar, hotbarStore, openCommandOv
|
||||
tooltipTimeout.current = setTimeout(() => setTooltipVisible(false), 1500);
|
||||
}
|
||||
|
||||
function onArrowClick(switchTo: () => void) {
|
||||
function onPrevClick() {
|
||||
onTooltipShow();
|
||||
switchTo();
|
||||
hotbarStore.switchToPrevious();
|
||||
}
|
||||
|
||||
function onNextClick() {
|
||||
onTooltipShow();
|
||||
hotbarStore.switchToNext();
|
||||
}
|
||||
|
||||
function onMouseEvent(event: React.MouseEvent) {
|
||||
@ -56,11 +61,7 @@ const NonInjectedHotbarSelector = observer(({ hotbar, hotbarStore, openCommandOv
|
||||
|
||||
return (
|
||||
<div className={styles.HotbarSelector}>
|
||||
<Icon
|
||||
material="play_arrow"
|
||||
className={cssNames(styles.Icon, styles.previous)}
|
||||
onClick={() => onArrowClick(hotbarStore.switchToPrevious)}
|
||||
/>
|
||||
<Icon material="play_arrow" className={cssNames(styles.Icon, styles.previous)} onClick={onPrevClick}/>
|
||||
<div className={styles.HotbarIndex}>
|
||||
<Badge
|
||||
id="hotbarIndex"
|
||||
@ -79,7 +80,7 @@ const NonInjectedHotbarSelector = observer(({ hotbar, hotbarStore, openCommandOv
|
||||
{hotbar.name}
|
||||
</Tooltip>
|
||||
</div>
|
||||
<Icon material="play_arrow" className={styles.Icon} onClick={() => onArrowClick(hotbarStore.switchToNext)} />
|
||||
<Icon material="play_arrow" className={styles.Icon} onClick={onNextClick} />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user