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

Do not convert store methods to arrow functions

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2022-04-06 12:44:08 +03:00
parent f5b10f2a38
commit 3fc72ebd9e
2 changed files with 13 additions and 12 deletions

View File

@ -285,7 +285,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
}
switchToPrevious = () => {
switchToPrevious() {
let index = this.activeHotbarIndex - 1;
if (index < 0) {
@ -293,9 +293,9 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
this.setActiveHotbar(index);
};
}
switchToNext = () => {
switchToNext() {
let index = this.activeHotbarIndex + 1;
if (index >= this.hotbars.length) {
@ -303,7 +303,7 @@ export class HotbarStore extends BaseStore<HotbarStoreModel> {
}
this.setActiveHotbar(index);
};
}
/**
* Checks if entity already pinned to the active hotbar

View File

@ -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>
);
});