diff --git a/src/renderer/src/pages/manager/index.jsx b/src/renderer/src/pages/manager/index.jsx index dede8e3..0e4025b 100644 --- a/src/renderer/src/pages/manager/index.jsx +++ b/src/renderer/src/pages/manager/index.jsx @@ -4,42 +4,36 @@ import classnames from "classnames" import BarLoader from "react-spinners/BarLoader" -import { MdAdd, MdUploadFile, MdFolder, MdDelete, MdPlayArrow, MdUpdate } from "react-icons/md" +import { MdAdd, MdFolder, MdDelete, MdPlayArrow, MdUpdate } from "react-icons/md" import { Context as InstallationsContext, WithContext } from "contexts/installations" import "./index.less" const NewInstallation = (props) => { + const { install } = React.useContext(InstallationsContext) const [manifestUrl, setManifestUrl] = React.useState("") - const handleInstall = (manifest) => { - ipc.exec("bundle:install", manifest) - .then(() => { - props.close() - }) - .catch((error) => { - antd.message.error(error) - }) + function handleClickInstall() { + install(manifestUrl) + props.close() } return
setManifestUrl(e.target.value)} - onPressEnter={() => handleInstall(manifestUrl)} + onChange={(e) => { + setManifestUrl(e.target.value) + }} + onPressEnter={handleClickInstall} /> -

- or -

- } - disabled + type="primary" + onClick={handleClickInstall} > - Local file + Install
} @@ -192,6 +186,7 @@ class InstallationsManager extends React.Component { title="Add new installation" placement="bottom" open={this.state.drawerVisible} + height={"200px"} onClose={() => this.toggleDrawer(false)} >