feat(dialog): add disableAutoHideOnSubmit prop

Needed for shared video dialog.
This commit is contained in:
Hristo Terezov 2022-11-17 16:12:40 -06:00
parent d45decc393
commit 04abfe1a3b
3 changed files with 8 additions and 4 deletions

View File

@ -190,6 +190,7 @@ interface IDialogProps {
children?: React.ReactNode;
className?: string;
description?: string;
disableAutoHideOnSubmit?: boolean;
disableBackdropClose?: boolean;
disableEnter?: boolean;
hideCloseButton?: boolean;
@ -211,6 +212,7 @@ const Dialog = ({
children,
className,
description,
disableAutoHideOnSubmit = false,
disableBackdropClose,
hideCloseButton,
disableEnter,
@ -232,7 +234,7 @@ const Dialog = ({
}, [ onCancel ]);
const submit = useCallback(() => {
dispatch(hideDialog());
!disableAutoHideOnSubmit && dispatch(hideDialog());
onSubmit?.();
}, [ onSubmit ]);

View File

@ -2,7 +2,6 @@
import React, { Component } from 'react';
import { hideDialog } from '../../base/dialog/actions';
import { translate } from '../../base/i18n';
import { getParticipantById } from '../../base/participants';
import { connect } from '../../base/redux';
@ -138,7 +137,6 @@ class RemoteControlAuthorizationDialog extends Component<Props> {
_onSubmit() {
const { dispatch, participantId } = this.props;
dispatch(hideDialog());
dispatch(grant(participantId));
return false;

View File

@ -1,5 +1,6 @@
import React from 'react';
import { hideDialog } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
import { connect } from '../../../base/redux/functions';
import Dialog from '../../../base/ui/components/web/Dialog';
@ -52,7 +53,9 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<any> {
_onSubmitValue() {
const result = super._onSetVideoLink(this.state.value);
if (!result) {
if (result) {
this.props.dispatch(hideDialog());
} else {
this.setState({
error: true
});
@ -72,6 +75,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<any> {
return (
<Dialog
disableAutoHideOnSubmit = { true }
ok = {{
disabled: this.state.okDisabled,
translationKey: 'dialog.Share'