From 46dc7e12da41056914a0f5fcdabbd20f81ef3bac Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 3 Sep 2020 22:49:55 +0800 Subject: ... --- .../src/app/views/common/OperationDialog.tsx | 36 ++++++++++------------ 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'Timeline/ClientApp/src/app/views/common/OperationDialog.tsx') diff --git a/Timeline/ClientApp/src/app/views/common/OperationDialog.tsx b/Timeline/ClientApp/src/app/views/common/OperationDialog.tsx index 6f97eb15..841392a6 100644 --- a/Timeline/ClientApp/src/app/views/common/OperationDialog.tsx +++ b/Timeline/ClientApp/src/app/views/common/OperationDialog.tsx @@ -1,16 +1,10 @@ import React, { useState } from "react"; import { useTranslation } from "react-i18next"; -import { Spinner, Container, Form, Button, Modal } from "react-bootstrap"; +import { Form, Button, Modal } from "react-bootstrap"; import { UiLogicError } from "@/common"; -const DefaultProcessPrompt: React.FC = (_) => { - return ( - - - - ); -}; +import LoadingButton from "./LoadingButton"; interface DefaultErrorPromptProps { error?: string; @@ -154,7 +148,9 @@ const OperationDialog: React.FC = (props) => { }; let body: React.ReactNode; - if (step === "input") { + if (step === "input" || step === "process") { + const process = step === "process"; + let inputPrompt = typeof props.inputPrompt === "function" ? props.inputPrompt() @@ -246,9 +242,12 @@ const OperationDialog: React.FC = (props) => { ); }} isInvalid={error != null} + disabled={process} /> {error != null && ( - {error} + + {error} + )} {item.helperText && ( {t(item.helperText)} @@ -265,6 +264,7 @@ const OperationDialog: React.FC = (props) => { updateValue(index, event.currentTarget.checked); }} label={t(item.label)} + disabled={process} /> ); @@ -278,6 +278,7 @@ const OperationDialog: React.FC = (props) => { onChange={(event) => { updateValue(index, event.target.value); }} + disabled={process} > {item.options.map((option, i) => { return ( @@ -294,11 +295,12 @@ const OperationDialog: React.FC = (props) => { })} - - + ); - } else if (step === "process") { - body = ( - - {props.processPrompt?.() ?? } - - ); } else { let content: React.ReactNode; const result = step; @@ -345,7 +341,7 @@ const OperationDialog: React.FC = (props) => { const title = typeof props.title === "string" ? t(props.title) : props.title; return ( - +