From c7d2545ec7bbcdba30b775453d53df5a359410bd Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 21 Sep 2023 15:35:27 +0800 Subject: Revert dialog. --- FrontEnd/src/components/dialog/OperationDialog.tsx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'FrontEnd/src/components/dialog/OperationDialog.tsx') diff --git a/FrontEnd/src/components/dialog/OperationDialog.tsx b/FrontEnd/src/components/dialog/OperationDialog.tsx index 6ca4d0a0..feaf5c79 100644 --- a/FrontEnd/src/components/dialog/OperationDialog.tsx +++ b/FrontEnd/src/components/dialog/OperationDialog.tsx @@ -11,7 +11,6 @@ import { import { ButtonRowV2 } from "../button"; import Dialog from "./Dialog"; import DialogContainer from "./DialogContainer"; -import { useDialogController } from "./DialogProvider"; import "./OperationDialog.css"; @@ -36,6 +35,8 @@ function OperationDialogPrompt(props: OperationDialogPromptProps) { } export interface OperationDialogProps { + open: boolean; + onClose: () => void; color?: ThemeColor; inputColor?: ThemeColor; title: Text; @@ -54,6 +55,8 @@ export interface OperationDialogProps { function OperationDialog(props: OperationDialogProps) { const { + open, + onClose, color, inputColor, title, @@ -92,8 +95,6 @@ function OperationDialog(props: OperationDialogProps) { data: unknown; }; - const dialogController = useDialogController(); - const [step, setStep] = useState({ type: "input" }); const { inputGroupProps, hasErrorAndDirty, setAllDisabled, confirm } = @@ -103,7 +104,7 @@ function OperationDialog(props: OperationDialogProps) { function close() { if (step.type !== "process") { - dialogController.closeDialog(); + onClose(); if (step.type === "success" && onSuccessAndClose) { onSuccessAndClose?.(step.data); } @@ -116,7 +117,6 @@ function OperationDialog(props: OperationDialogProps) { const result = confirm(); if (result.type === "ok") { setStep({ type: "process" }); - dialogController.setCanSwitchDialog(false); setAllDisabled(true); onProcess(result.values) .then( @@ -133,9 +133,6 @@ function OperationDialog(props: OperationDialogProps) { }); }, ) - .finally(() => { - dialogController.setCanSwitchDialog(true); - }); } } @@ -210,7 +207,7 @@ function OperationDialog(props: OperationDialogProps) { } return ( - + {body} -- cgit v1.2.3