aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/components/dialog/OperationDialog.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-09-21 15:35:27 +0800
committercrupest <crupest@outlook.com>2023-09-21 15:35:27 +0800
commitc7d2545ec7bbcdba30b775453d53df5a359410bd (patch)
tree768668b9d1b2cd835212c3a3567dd8f54700a7fa /FrontEnd/src/components/dialog/OperationDialog.tsx
parentf836d77e73f3ea0af45c5f71dae7268143d6d86f (diff)
downloadtimeline-c7d2545ec7bbcdba30b775453d53df5a359410bd.tar.gz
timeline-c7d2545ec7bbcdba30b775453d53df5a359410bd.tar.bz2
timeline-c7d2545ec7bbcdba30b775453d53df5a359410bd.zip
Revert dialog.
Diffstat (limited to 'FrontEnd/src/components/dialog/OperationDialog.tsx')
-rw-r--r--FrontEnd/src/components/dialog/OperationDialog.tsx15
1 files changed, 6 insertions, 9 deletions
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<TData> {
+ open: boolean;
+ onClose: () => void;
color?: ThemeColor;
inputColor?: ThemeColor;
title: Text;
@@ -54,6 +55,8 @@ export interface OperationDialogProps<TData> {
function OperationDialog<TData>(props: OperationDialogProps<TData>) {
const {
+ open,
+ onClose,
color,
inputColor,
title,
@@ -92,8 +95,6 @@ function OperationDialog<TData>(props: OperationDialogProps<TData>) {
data: unknown;
};
- const dialogController = useDialogController();
-
const [step, setStep] = useState<Step>({ type: "input" });
const { inputGroupProps, hasErrorAndDirty, setAllDisabled, confirm } =
@@ -103,7 +104,7 @@ function OperationDialog<TData>(props: OperationDialogProps<TData>) {
function close() {
if (step.type !== "process") {
- dialogController.closeDialog();
+ onClose();
if (step.type === "success" && onSuccessAndClose) {
onSuccessAndClose?.(step.data);
}
@@ -116,7 +117,6 @@ function OperationDialog<TData>(props: OperationDialogProps<TData>) {
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<TData>(props: OperationDialogProps<TData>) {
});
},
)
- .finally(() => {
- dialogController.setCanSwitchDialog(true);
- });
}
}
@@ -210,7 +207,7 @@ function OperationDialog<TData>(props: OperationDialogProps<TData>) {
}
return (
- <Dialog color={color}>
+ <Dialog open={open} onClose={close} color={color}>
<DialogContainer title={title} titleColor={color} buttonsV2={buttons}>
{body}
</DialogContainer>