ref(salesforce) Use new Dialog component (#12400)
This commit is contained in:
parent
69567fb371
commit
6f209a8139
|
@ -20,6 +20,7 @@ import StartRecordingDialog from '../../recording/components/Recording/web/Start
|
||||||
import StopRecordingDialog from '../../recording/components/Recording/web/StopRecordingDialog';
|
import StopRecordingDialog from '../../recording/components/Recording/web/StopRecordingDialog';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import RemoteControlAuthorizationDialog from '../../remote-control/components/RemoteControlAuthorizationDialog';
|
import RemoteControlAuthorizationDialog from '../../remote-control/components/RemoteControlAuthorizationDialog';
|
||||||
|
import SalesforceLinkDialog from '../../salesforce/components/web/SalesforceLinkDialog';
|
||||||
import ShareAudioDialog from '../../screen-share/components/ShareAudioDialog';
|
import ShareAudioDialog from '../../screen-share/components/ShareAudioDialog';
|
||||||
import ShareScreenWarningDialog from '../../screen-share/components/ShareScreenWarningDialog';
|
import ShareScreenWarningDialog from '../../screen-share/components/ShareScreenWarningDialog';
|
||||||
import SecurityDialog from '../../security/components/security-dialog/web/SecurityDialog';
|
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,
|
SharedVideoDialog, SpeakerStats, LanguageSelectorDialog, MuteEveryoneDialog, MuteEveryonesVideoDialog,
|
||||||
GrantModeratorDialog, KickRemoteParticipantDialog, MuteRemoteParticipantsVideoDialog, VideoQualityDialog,
|
GrantModeratorDialog, KickRemoteParticipantDialog, MuteRemoteParticipantsVideoDialog, VideoQualityDialog,
|
||||||
VirtualBackgroundDialog, LoginDialog, WaitForOwnerDialog, DesktopPicker, RemoteControlAuthorizationDialog,
|
VirtualBackgroundDialog, LoginDialog, WaitForOwnerDialog, DesktopPicker, RemoteControlAuthorizationDialog,
|
||||||
LogoutDialog ];
|
LogoutDialog, SalesforceLinkDialog ];
|
||||||
|
|
||||||
// This function is necessary while the transition from @atlaskit dialog to our component is ongoing.
|
// 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);
|
const isNewDialog = (component: any) => NEW_DIALOG_LIST.some(comp => comp === component);
|
||||||
|
|
|
@ -173,6 +173,11 @@ const useStyles = makeStyles()((theme: Theme) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
|
back?: {
|
||||||
|
hidden?: boolean;
|
||||||
|
onClick?: () => void;
|
||||||
|
translationKey?: string;
|
||||||
|
};
|
||||||
cancel?: {
|
cancel?: {
|
||||||
hidden?: boolean;
|
hidden?: boolean;
|
||||||
translationKey?: string;
|
translationKey?: string;
|
||||||
|
@ -181,6 +186,7 @@ interface DialogProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
disableBackdropClose?: boolean;
|
disableBackdropClose?: boolean;
|
||||||
|
disableEnter?: boolean;
|
||||||
hideCloseButton?: boolean;
|
hideCloseButton?: boolean;
|
||||||
ok?: {
|
ok?: {
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
@ -195,12 +201,14 @@ interface DialogProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const Dialog = ({
|
const Dialog = ({
|
||||||
|
back = { hidden: true },
|
||||||
cancel = { translationKey: 'dialog.Cancel' },
|
cancel = { translationKey: 'dialog.Cancel' },
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
description,
|
description,
|
||||||
disableBackdropClose,
|
disableBackdropClose,
|
||||||
hideCloseButton,
|
hideCloseButton,
|
||||||
|
disableEnter,
|
||||||
ok = { translationKey: 'dialog.Ok' },
|
ok = { translationKey: 'dialog.Ok' },
|
||||||
onCancel,
|
onCancel,
|
||||||
onSubmit,
|
onSubmit,
|
||||||
|
@ -227,7 +235,7 @@ const Dialog = ({
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter' && !disableEnter) {
|
||||||
submit();
|
submit();
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
@ -269,6 +277,12 @@ const Dialog = ({
|
||||||
</div>
|
</div>
|
||||||
<div className = { classes.content }>{children}</div>
|
<div className = { classes.content }>{children}</div>
|
||||||
<div className = { classes.footer }>
|
<div className = { classes.footer }>
|
||||||
|
{!back.hidden && <Button
|
||||||
|
accessibilityLabel = { t(back.translationKey ?? '') }
|
||||||
|
labelKey = { back.translationKey }
|
||||||
|
// eslint-disable-next-line react/jsx-handler-names
|
||||||
|
onClick = { back.onClick }
|
||||||
|
type = 'secondary' />}
|
||||||
{!cancel.hidden && <Button
|
{!cancel.hidden && <Button
|
||||||
accessibilityLabel = { t(cancel.translationKey ?? '') }
|
accessibilityLabel = { t(cancel.translationKey ?? '') }
|
||||||
labelKey = { cancel.translationKey }
|
labelKey = { cancel.translationKey }
|
||||||
|
|
|
@ -6,13 +6,12 @@ import { useTranslation } from 'react-i18next';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { makeStyles } from 'tss-react/mui';
|
import { makeStyles } from 'tss-react/mui';
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
import { Dialog } from '../../../base/dialog';
|
|
||||||
import { hideDialog } from '../../../base/dialog/actions';
|
import { hideDialog } from '../../../base/dialog/actions';
|
||||||
import Icon from '../../../base/icons/components/Icon';
|
import Icon from '../../../base/icons/components/Icon';
|
||||||
import { IconSearch } from '../../../base/icons/svg';
|
import { IconSearch } from '../../../base/icons/svg';
|
||||||
import { getFieldValue } from '../../../base/react/functions';
|
import { getFieldValue } from '../../../base/react/functions';
|
||||||
import { withPixelLineHeight } from '../../../base/styles/functions.web';
|
import { withPixelLineHeight } from '../../../base/styles/functions.web';
|
||||||
|
import Dialog from '../../../base/ui/components/web/Dialog';
|
||||||
import { NOTES_MAX_LENGTH } from '../../constants';
|
import { NOTES_MAX_LENGTH } from '../../constants';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { useSalesforceLinkDialog } from '../../useSalesforceLinkDialog';
|
import { useSalesforceLinkDialog } from '../../useSalesforceLinkDialog';
|
||||||
|
@ -254,16 +253,19 @@ function SalesforceLinkDialog() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
|
back = {{
|
||||||
|
hidden: !selectedRecord,
|
||||||
|
onClick: () => setSelectedRecord(null),
|
||||||
|
translationKey: 'dialog.Back'
|
||||||
|
}}
|
||||||
|
cancel = {{ hidden: true }}
|
||||||
disableEnter = { true }
|
disableEnter = { true }
|
||||||
disableFooter = { !selectedRecord }
|
ok = {{
|
||||||
height = { 'medium' }
|
translationKey: 'dialog.linkMeeting',
|
||||||
okDisabled = { !selectedRecord }
|
hidden: !selectedRecord
|
||||||
okKey = 'dialog.linkMeeting'
|
}}
|
||||||
/* eslint-disable-next-line react/jsx-no-bind */
|
|
||||||
onDecline = { () => setSelectedRecord(null) }
|
|
||||||
onSubmit = { handleSubmit }
|
onSubmit = { handleSubmit }
|
||||||
titleKey = 'dialog.linkMeetingTitle'
|
titleKey = 'dialog.linkMeetingTitle'>
|
||||||
width = { 'small' }>
|
|
||||||
<div className = { classes.container } >
|
<div className = { classes.container } >
|
||||||
{renderRecordsSearch()}
|
{renderRecordsSearch()}
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
|
|
Loading…
Reference in New Issue