mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Temporarily set noop for UpdateButton update()
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
ab51b6068c
commit
e6c8e41033
@ -8,20 +8,18 @@ import styles from "./styles.module.scss";
|
|||||||
import type { HTMLAttributes } from "react";
|
import type { HTMLAttributes } from "react";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Menu, MenuItem } from "../menu";
|
import { Menu, MenuItem } from "../menu";
|
||||||
import { cssNames } from "../../utils";
|
import { cssNames, noop } from "../../utils";
|
||||||
import type { IconProps } from "../icon";
|
import type { IconProps } from "../icon";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import appUpdateWarningLevelInjectable from "../../app-update-warning/app-update-warning-level.injectable";
|
import updateWarningLevelInjectable from "../../../main/application-update/update-warning-level/update-warning-level.injectable";
|
||||||
import type { IComputedValue } from "mobx";
|
|
||||||
import quitAndInstallUpdateInjectable from "../../../main/electron-app/features/quit-and-install-update.injectable";
|
|
||||||
|
|
||||||
interface UpdateButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
interface UpdateButtonProps extends HTMLAttributes<HTMLButtonElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
warningLevel?: IComputedValue<"light" | "medium" | "high" | "">;
|
warningLevel: "light" | "medium" | "high" | "";
|
||||||
update: () => void;
|
update: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +32,7 @@ export const NonInjectedUpdateButton = observer(({ warningLevel, update, id }: U
|
|||||||
setOpened(!opened);
|
setOpened(!opened);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!warningLevel || !warningLevel.get()) {
|
if (!warningLevel) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,11 +40,11 @@ export const NonInjectedUpdateButton = observer(({ warningLevel, update, id }: U
|
|||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
data-testid="update-button"
|
data-testid="update-button"
|
||||||
data-warning-level={warningLevel.get()}
|
data-warning-level={warningLevel}
|
||||||
id={buttonId}
|
id={buttonId}
|
||||||
className={cssNames(styles.updateButton, {
|
className={cssNames(styles.updateButton, {
|
||||||
[styles.warningHigh]: warningLevel.get() === "high",
|
[styles.warningHigh]: warningLevel === "high",
|
||||||
[styles.warningMedium]: warningLevel.get() === "medium",
|
[styles.warningMedium]: warningLevel === "medium",
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
Update
|
Update
|
||||||
@ -73,10 +71,15 @@ export const NonInjectedUpdateButton = observer(({ warningLevel, update, id }: U
|
|||||||
|
|
||||||
export const UpdateButton = withInjectables<Dependencies, UpdateButtonProps>(NonInjectedUpdateButton, {
|
export const UpdateButton = withInjectables<Dependencies, UpdateButtonProps>(NonInjectedUpdateButton, {
|
||||||
getProps: (di, props) => {
|
getProps: (di, props) => {
|
||||||
|
const warnignLevel = di.inject(updateWarningLevelInjectable);
|
||||||
|
|
||||||
|
// TODO: quit and install on update();
|
||||||
|
const update = noop;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...props,
|
...props,
|
||||||
warningLevel: di.inject(appUpdateWarningLevelInjectable),
|
warningLevel: warnignLevel.value.get(),
|
||||||
update: di.inject(quitAndInstallUpdateInjectable),
|
update,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user