Skip to content

Commit

Permalink
feat(client): show installed popup on manual installation
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin Guidée <[email protected]>
  • Loading branch information
quentinguidee committed Mar 10, 2024
1 parent ce5d345 commit e24cb5d
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { DownloadSimple } from "@phosphor-icons/react";
import * as yup from "yup";
import { useForm } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import { Container } from "../../backend/models";
import { useState } from "react";
import ContainerInstalledPopup from "../../components/ContainerInstalledPopup/ContainerInstalledPopup";

type Props = {
dismiss: () => void;
Expand All @@ -30,11 +33,24 @@ export default function ManualInstallPopup(props: Readonly<Props>) {
resolver: yupResolver(schema),
});

const [container, setContainer] = useState<Container>(null);

const { createContainer, isCreatingContainer, errorCreatingContainer } =
useCreateContainer({
onSuccess: dismiss,
onSuccess: (data) => {
setContainer(data as Container);
},
});

if (container) {
return (
<ContainerInstalledPopup
container={container}
onDismiss={dismiss}
/>
);
}

const onSubmit = handleSubmit((data) => {
const req = formattedImage(data.image);
createContainer(req);
Expand Down

0 comments on commit e24cb5d

Please sign in to comment.