From a148f11c193d35ba489f887ed393aedf58a1c714 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 30 Jul 2023 20:52:13 +0800 Subject: ... --- .../src/views/common/dialog/OperationDialog.tsx | 94 ++++++++++++---------- 1 file changed, 50 insertions(+), 44 deletions(-) (limited to 'FrontEnd/src/views/common/dialog/OperationDialog.tsx') diff --git a/FrontEnd/src/views/common/dialog/OperationDialog.tsx b/FrontEnd/src/views/common/dialog/OperationDialog.tsx index 74b4a5fa..da1ff0e0 100644 --- a/FrontEnd/src/views/common/dialog/OperationDialog.tsx +++ b/FrontEnd/src/views/common/dialog/OperationDialog.tsx @@ -1,9 +1,8 @@ -import { useState, ReactNode } from "react"; +import { useState, ReactNode, ComponentProps } from "react"; import classNames from "classnames"; import { useC, Text, ThemeColor } from "../common"; -import Button from "../button/Button"; import { useInputs, InputGroup, @@ -11,8 +10,8 @@ import { InputValueDict, InputErrorDict, } from "../input/InputGroup"; -import LoadingButton from "../button/LoadingButton"; import Dialog from "./Dialog"; +import DialogContainer from "./DialogContainer"; import "./OperationDialog.css"; @@ -124,39 +123,45 @@ function OperationDialog(props: OperationDialogProps) { } let body: ReactNode; + let buttons: ComponentProps["buttons"]; + if (step.type === "input" || step.type === "process") { const isProcessing = step.type === "process"; body = ( -
-
- - -
-
-
-
+
+ +
); + buttons = [ + { + key: "cancel", + type: "normal", + props: { + text: "operationDialog.cancel", + color: "secondary", + outline: true, + onClick: close, + disabled: isProcessing, + }, + }, + { + key: "confirm", + type: "loading", + props: { + text: "operationDialog.confirm", + color, + loading: isProcessing, + disabled: hasErrorAndDirty, + onClick: onConfirm, + }, + }, + ]; } else { const result = step; @@ -171,28 +176,29 @@ function OperationDialog(props: OperationDialogProps) { customMessage: failurePrompt?.(result.data), }; body = ( -
+
-
-
-
); + + buttons = [ + { + key: "ok", + type: "normal", + props: { + text: "operationDialog.ok", + color: "primary", + onClick: close, + }, + }, + ]; } return ( -
-
{c(title)}
-
+ {body} -
+
); } -- cgit v1.2.3