diff --git a/src/framework/visualisation/react/ui/prompts/radio_input.tsx b/src/framework/visualisation/react/ui/prompts/radio_input.tsx index e96bd1f7..142f3116 100644 --- a/src/framework/visualisation/react/ui/prompts/radio_input.tsx +++ b/src/framework/visualisation/react/ui/prompts/radio_input.tsx @@ -6,6 +6,7 @@ import { Translator } from '../../../../translator' import { ReactFactoryContext } from '../../factory' import { PropsUIPromptRadioInput } from '../../../../types/prompts' import { RadioItem } from '../elements/radio_item' +import { PrimaryButton } from '../elements/button' interface Copy { title: string @@ -25,20 +26,24 @@ function prepareCopy ({ title, description, locale }: Props): Copy { export const RadioInput = (props: Props): JSX.Element => { const [selectedId, setSelectedId] = React.useState(-1) - const [confirmHidden, setConfirmHidden] = React.useState(true) + const [waiting, setWaiting] = React.useState(false) + const [checked, setChecked] = React.useState(false) const { items, resolve } = props const { title, description, continueButton } = prepareCopy(props) function handleSelect (id: number): void { setSelectedId(id) - setConfirmHidden(false) + setChecked(true) } function handleConfirm (): void { - const item = items.at(selectedId) - if (item !== undefined) { - resolve?.({ __type__: 'PayloadString', value: item.value }) + if (!waiting) { + setWaiting(true) + const item = items.at(selectedId) + if (item !== undefined) { + resolve?.({ __type__: 'PayloadString', value: item.value }) + } } } @@ -64,12 +69,8 @@ export const RadioInput = (props: Props): JSX.Element => {
-
-
-
- {continueButton} -
-
+
+
)