mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
adding missing mobx.makeObservable(this) -- part 1
Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
parent
671e7c26ca
commit
484ab443a2
@ -1,13 +1,18 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { Select } from "../select";
|
import { Select } from "../select";
|
||||||
import { computed } from "mobx";
|
import { computed, makeObservable } from "mobx";
|
||||||
import { HotbarStore } from "../../../common/hotbar-store";
|
import { HotbarStore } from "../../../common/hotbar-store";
|
||||||
import { CommandOverlay } from "../command-palette";
|
import { CommandOverlay } from "../command-palette";
|
||||||
import { ConfirmDialog } from "../confirm-dialog";
|
import { ConfirmDialog } from "../confirm-dialog";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class HotbarRemoveCommand extends React.Component {
|
export class HotbarRemoveCommand extends React.Component {
|
||||||
|
constructor(props: object) {
|
||||||
|
super(props);
|
||||||
|
makeObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
@computed get options() {
|
@computed get options() {
|
||||||
return HotbarStore.getInstance().hotbars.map((hotbar) => {
|
return HotbarStore.getInstance().hotbars.map((hotbar) => {
|
||||||
return { value: hotbar.id, label: hotbar.name };
|
return { value: hotbar.id, label: hotbar.name };
|
||||||
@ -51,7 +56,7 @@ export class HotbarRemoveCommand extends React.Component {
|
|||||||
options={this.options}
|
options={this.options}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
escapeClearsValue={false}
|
escapeClearsValue={false}
|
||||||
placeholder="Remove hotbar" />
|
placeholder="Remove hotbar"/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { Select } from "../select";
|
import { Select } from "../select";
|
||||||
import { computed } from "mobx";
|
import { computed, makeObservable } from "mobx";
|
||||||
import { HotbarStore } from "../../../common/hotbar-store";
|
import { HotbarStore } from "../../../common/hotbar-store";
|
||||||
import { CommandOverlay } from "../command-palette";
|
import { CommandOverlay } from "../command-palette";
|
||||||
import { HotbarAddCommand } from "./hotbar-add-command";
|
import { HotbarAddCommand } from "./hotbar-add-command";
|
||||||
@ -12,6 +12,11 @@ export class HotbarSwitchCommand extends React.Component {
|
|||||||
private static addActionId = "__add__";
|
private static addActionId = "__add__";
|
||||||
private static removeActionId = "__remove__";
|
private static removeActionId = "__remove__";
|
||||||
|
|
||||||
|
constructor(props: object) {
|
||||||
|
super(props);
|
||||||
|
makeObservable(this);
|
||||||
|
}
|
||||||
|
|
||||||
@computed get options() {
|
@computed get options() {
|
||||||
const hotbarStore = HotbarStore.getInstance();
|
const hotbarStore = HotbarStore.getInstance();
|
||||||
const options = hotbarStore.hotbars.map((hotbar) => {
|
const options = hotbarStore.hotbars.map((hotbar) => {
|
||||||
@ -28,13 +33,13 @@ export class HotbarSwitchCommand extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChange(idOrAction: string): void {
|
onChange(idOrAction: string): void {
|
||||||
switch(idOrAction) {
|
switch (idOrAction) {
|
||||||
case HotbarSwitchCommand.addActionId:
|
case HotbarSwitchCommand.addActionId:
|
||||||
CommandOverlay.open(<HotbarAddCommand />);
|
CommandOverlay.open(<HotbarAddCommand/>);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
case HotbarSwitchCommand.removeActionId:
|
case HotbarSwitchCommand.removeActionId:
|
||||||
CommandOverlay.open(<HotbarRemoveCommand />);
|
CommandOverlay.open(<HotbarRemoveCommand/>);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
@ -52,7 +57,7 @@ export class HotbarSwitchCommand extends React.Component {
|
|||||||
options={this.options}
|
options={this.options}
|
||||||
autoFocus={true}
|
autoFocus={true}
|
||||||
escapeClearsValue={false}
|
escapeClearsValue={false}
|
||||||
placeholder="Switch to hotbar" />
|
placeholder="Switch to hotbar"/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import debounce from "lodash/debounce";
|
import debounce from "lodash/debounce";
|
||||||
import { autorun, observable, makeObservable } from "mobx";
|
import { autorun, makeObservable, observable } from "mobx";
|
||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { InputProps } from "./input";
|
import { InputProps } from "./input";
|
||||||
import { SearchInput } from "./search-input";
|
import { SearchInput } from "./search-input";
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import "./search-input.scss";
|
import "./search-input.scss";
|
||||||
|
|
||||||
import React, { createRef } from "react";
|
import React, { createRef } from "react";
|
||||||
import { makeObservable } from "mobx";
|
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { autobind, cssNames } from "../../utils";
|
import { autobind, cssNames } from "../../utils";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
@ -29,11 +28,6 @@ export class SearchInput extends React.Component<Props> {
|
|||||||
|
|
||||||
private inputRef = createRef<Input>();
|
private inputRef = createRef<Input>();
|
||||||
|
|
||||||
constructor(props: Props) {
|
|
||||||
super(props);
|
|
||||||
makeObservable(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (!this.props.bindGlobalFocusHotkey) return;
|
if (!this.props.bindGlobalFocusHotkey) return;
|
||||||
window.addEventListener("keydown", this.onGlobalKey);
|
window.addEventListener("keydown", this.onGlobalKey);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user