// Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only import React, { useCallback } from 'react'; import { useSelector } from 'react-redux'; import type { GlobalModalsStateType } from '../ducks/globalModals'; import type { StateType } from '../reducer'; import type { ButtonVariant } from '../../components/Button'; import { ErrorModal } from '../../components/ErrorModal'; import { GlobalModalContainer } from '../../components/GlobalModalContainer'; import { SmartAboutContactModal } from './AboutContactModal'; import { SmartAddUserToAnotherGroupModal } from './AddUserToAnotherGroupModal'; import { SmartContactModal } from './ContactModal'; import { SmartEditHistoryMessagesModal } from './EditHistoryMessagesModal'; import { SmartForwardMessagesModal } from './ForwardMessagesModal'; import { SmartProfileEditorModal } from './ProfileEditorModal'; import { SmartUsernameOnboardingModal } from './UsernameOnboardingModal'; import { SmartSafetyNumberModal } from './SafetyNumberModal'; import { SmartSendAnywayDialog } from './SendAnywayDialog'; import { SmartShortcutGuideModal } from './ShortcutGuideModal'; import { SmartStickerPreviewModal } from './StickerPreviewModal'; import { SmartStoriesSettingsModal } from './StoriesSettingsModal'; import { getConversationsStoppingSend } from '../selectors/conversations'; import { getIntl, getTheme } from '../selectors/user'; import { useGlobalModalActions } from '../ducks/globalModals'; import { SmartDeleteMessagesModal } from './DeleteMessagesModal'; import { SmartMessageRequestActionsConfirmation } from './MessageRequestActionsConfirmation'; function renderEditHistoryMessagesModal(): JSX.Element { return ; } function renderProfileEditor(): JSX.Element { return ; } function renderUsernameOnboarding(): JSX.Element { return ; } function renderContactModal(): JSX.Element { return ; } function renderDeleteMessagesModal(): JSX.Element { return ; } function renderForwardMessagesModal(): JSX.Element { return ; } function renderMessageRequestActionsConfirmation(): JSX.Element { return ; } function renderStoriesSettings(): JSX.Element { return ; } function renderSendAnywayDialog(): JSX.Element { return ; } function renderShortcutGuideModal(): JSX.Element { return ; } function renderAboutContactModal(): JSX.Element { return ; } export function SmartGlobalModalContainer(): JSX.Element { const conversationsStoppingSend = useSelector(getConversationsStoppingSend); const i18n = useSelector(getIntl); const theme = useSelector(getTheme); const hasSafetyNumberChangeModal = conversationsStoppingSend.length > 0; const { aboutContactModalContactId, addUserToAnotherGroupModalContactId, authArtCreatorData, contactModalState, deleteMessagesProps, editHistoryMessages, errorModalProps, formattingWarningData, forwardMessagesProps, messageRequestActionsConfirmationProps, isAuthorizingArtCreator, isProfileEditorVisible, isShortcutGuideModalVisible, isSignalConnectionsVisible, isStoriesSettingsVisible, isWhatsNewVisible, usernameOnboardingState, safetyNumberChangedBlockingData, safetyNumberModalContactId, sendEditWarningData, stickerPackPreviewId, userNotFoundModalState, } = useSelector( state => state.globalModals ); const { cancelAuthorizeArtCreator, closeErrorModal, confirmAuthorizeArtCreator, hideUserNotFoundModal, hideWhatsNewModal, showFormattingWarningModal, showSendEditWarningModal, toggleSignalConnectionsModal, } = useGlobalModalActions(); const renderAddUserToAnotherGroup = useCallback(() => { return ( ); }, [addUserToAnotherGroupModalContactId]); const renderSafetyNumber = useCallback( () => ( ), [safetyNumberModalContactId] ); const renderStickerPreviewModal = useCallback( () => stickerPackPreviewId ? ( ) : null, [stickerPackPreviewId] ); const renderErrorModal = useCallback( ({ buttonVariant, description, title, }: { buttonVariant?: ButtonVariant; description?: string; title?: string; }) => ( ), [closeErrorModal, i18n] ); return ( ); }