// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { memo, useCallback } from 'react';
import { useSelector } from 'react-redux';
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';
import { getGlobalModalsState } from '../selectors/globalModals';
import { SmartEditNicknameAndNoteModal } from './EditNicknameAndNoteModal';
import { SmartNotePreviewModal } from './NotePreviewModal';
import { SmartCallLinkEditModal } from './CallLinkEditModal';
import { SmartCallLinkAddNameModal } from './CallLinkAddNameModal';
import { SmartConfirmLeaveCallModal } from './ConfirmLeaveCallModal';
import { SmartCallLinkPendingParticipantModal } from './CallLinkPendingParticipantModal';
function renderCallLinkAddNameModal(): JSX.Element {
return ;
}
function renderCallLinkEditModal(): JSX.Element {
return ;
}
function renderCallLinkPendingParticipantModal(): JSX.Element {
return ;
}
function renderConfirmLeaveCallModal(): JSX.Element {
return ;
}
function renderEditHistoryMessagesModal(): JSX.Element {
return ;
}
function renderEditNicknameAndNoteModal(): 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 renderNotePreviewModal(): JSX.Element {
return ;
}
function renderStoriesSettings(): JSX.Element {
return ;
}
function renderSendAnywayDialog(): JSX.Element {
return ;
}
function renderShortcutGuideModal(): JSX.Element {
return ;
}
function renderAboutContactModal(): JSX.Element {
return ;
}
export const SmartGlobalModalContainer = memo(
function SmartGlobalModalContainer() {
const conversationsStoppingSend = useSelector(getConversationsStoppingSend);
const i18n = useSelector(getIntl);
const theme = useSelector(getTheme);
const hasSafetyNumberChangeModal = conversationsStoppingSend.length > 0;
const {
aboutContactModalContactId,
addUserToAnotherGroupModalContactId,
callLinkAddNameModalRoomId,
callLinkEditModalRoomId,
callLinkPendingParticipantContactId,
confirmLeaveCallModalState,
contactModalState,
deleteMessagesProps,
editHistoryMessages,
editNicknameAndNoteModalProps,
errorModalProps,
forwardMessagesProps,
messageRequestActionsConfirmationProps,
notePreviewModalProps,
isProfileEditorVisible,
isShortcutGuideModalVisible,
isSignalConnectionsVisible,
isStoriesSettingsVisible,
isWhatsNewVisible,
usernameOnboardingState,
safetyNumberChangedBlockingData,
safetyNumberModalContactId,
stickerPackPreviewId,
userNotFoundModalState,
} = useSelector(getGlobalModalsState);
const {
closeErrorModal,
hideUserNotFoundModal,
hideWhatsNewModal,
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 (
);
}
);