From 6f209a8139d9d9ca47f79ad3c5749f155240efae Mon Sep 17 00:00:00 2001 From: Robert Pintilii Date: Tue, 18 Oct 2022 13:56:08 +0300 Subject: [PATCH] ref(salesforce) Use new Dialog component (#12400) --- react/features/base/dialog/middleware.web.ts | 3 ++- .../base/ui/components/web/Dialog.tsx | 16 +++++++++++++- .../components/web/SalesforceLinkDialog.tsx | 22 ++++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/react/features/base/dialog/middleware.web.ts b/react/features/base/dialog/middleware.web.ts index e56d2a449..5e7e57045 100644 --- a/react/features/base/dialog/middleware.web.ts +++ b/react/features/base/dialog/middleware.web.ts @@ -20,6 +20,7 @@ import StartRecordingDialog from '../../recording/components/Recording/web/Start import StopRecordingDialog from '../../recording/components/Recording/web/StopRecordingDialog'; // @ts-ignore import RemoteControlAuthorizationDialog from '../../remote-control/components/RemoteControlAuthorizationDialog'; +import SalesforceLinkDialog from '../../salesforce/components/web/SalesforceLinkDialog'; import ShareAudioDialog from '../../screen-share/components/ShareAudioDialog'; import ShareScreenWarningDialog from '../../screen-share/components/ShareScreenWarningDialog'; import SecurityDialog from '../../security/components/security-dialog/web/SecurityDialog'; @@ -48,7 +49,7 @@ const NEW_DIALOG_LIST = [ KeyboardShortcutsDialog, ChatPrivacyDialog, DisplayNam SharedVideoDialog, SpeakerStats, LanguageSelectorDialog, MuteEveryoneDialog, MuteEveryonesVideoDialog, GrantModeratorDialog, KickRemoteParticipantDialog, MuteRemoteParticipantsVideoDialog, VideoQualityDialog, VirtualBackgroundDialog, LoginDialog, WaitForOwnerDialog, DesktopPicker, RemoteControlAuthorizationDialog, - LogoutDialog ]; + LogoutDialog, SalesforceLinkDialog ]; // This function is necessary while the transition from @atlaskit dialog to our component is ongoing. const isNewDialog = (component: any) => NEW_DIALOG_LIST.some(comp => comp === component); diff --git a/react/features/base/ui/components/web/Dialog.tsx b/react/features/base/ui/components/web/Dialog.tsx index 1172a9118..699b726ef 100644 --- a/react/features/base/ui/components/web/Dialog.tsx +++ b/react/features/base/ui/components/web/Dialog.tsx @@ -173,6 +173,11 @@ const useStyles = makeStyles()((theme: Theme) => { }); interface DialogProps { + back?: { + hidden?: boolean; + onClick?: () => void; + translationKey?: string; + }; cancel?: { hidden?: boolean; translationKey?: string; @@ -181,6 +186,7 @@ interface DialogProps { className?: string; description?: string; disableBackdropClose?: boolean; + disableEnter?: boolean; hideCloseButton?: boolean; ok?: { disabled?: boolean; @@ -195,12 +201,14 @@ interface DialogProps { } const Dialog = ({ + back = { hidden: true }, cancel = { translationKey: 'dialog.Cancel' }, children, className, description, disableBackdropClose, hideCloseButton, + disableEnter, ok = { translationKey: 'dialog.Ok' }, onCancel, onSubmit, @@ -227,7 +235,7 @@ const Dialog = ({ if (e.key === 'Escape') { onClose(); } - if (e.key === 'Enter') { + if (e.key === 'Enter' && !disableEnter) { submit(); } }, []); @@ -269,6 +277,12 @@ const Dialog = ({
{children}
+ {!back.hidden &&