show modal

This commit is contained in:
srgooglo 2023-11-14 22:46:37 +01:00
parent 2f486c25d4
commit 4c3956ade3

View File

@ -4,42 +4,36 @@ import classnames from "classnames"
import BarLoader from "react-spinners/BarLoader" 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 { Context as InstallationsContext, WithContext } from "contexts/installations"
import "./index.less" import "./index.less"
const NewInstallation = (props) => { const NewInstallation = (props) => {
const { install } = React.useContext(InstallationsContext)
const [manifestUrl, setManifestUrl] = React.useState("") const [manifestUrl, setManifestUrl] = React.useState("")
const handleInstall = (manifest) => { function handleClickInstall() {
ipc.exec("bundle:install", manifest) install(manifestUrl)
.then(() => { props.close()
props.close()
})
.catch((error) => {
antd.message.error(error)
})
} }
return <div className="new_installation_prompt"> return <div className="new_installation_prompt">
<antd.Input <antd.Input
placeholder="Manifest URL" placeholder="Manifest URL"
value={manifestUrl} value={manifestUrl}
onChange={(e) => setManifestUrl(e.target.value)} onChange={(e) => {
onPressEnter={() => handleInstall(manifestUrl)} setManifestUrl(e.target.value)
}}
onPressEnter={handleClickInstall}
/> />
<h2>
or
</h2>
<antd.Button <antd.Button
icon={<MdUploadFile />} type="primary"
disabled onClick={handleClickInstall}
> >
Local file Install
</antd.Button> </antd.Button>
</div> </div>
} }
@ -192,6 +186,7 @@ class InstallationsManager extends React.Component {
title="Add new installation" title="Add new installation"
placement="bottom" placement="bottom"
open={this.state.drawerVisible} open={this.state.drawerVisible}
height={"200px"}
onClose={() => this.toggleDrawer(false)} onClose={() => this.toggleDrawer(false)}
> >
<NewInstallation <NewInstallation