2022-09-26 16:24:52 +00:00
|
|
|
// Copyright 2022 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import React, { memo } from 'react';
|
2022-09-26 16:24:52 +00:00
|
|
|
import { AddUserToAnotherGroupModal } from '../../components/AddUserToAnotherGroupModal';
|
|
|
|
import {
|
|
|
|
getAllGroupsWithInviteAccess,
|
|
|
|
getContactSelector,
|
|
|
|
} from '../selectors/conversations';
|
2024-03-13 20:44:13 +00:00
|
|
|
import { getIntl, getRegionCode } from '../selectors/user';
|
|
|
|
import { useToastActions } from '../ducks/toast';
|
|
|
|
import { useGlobalModalActions } from '../ducks/globalModals';
|
|
|
|
import { useConversationsActions } from '../ducks/conversations';
|
2022-09-26 16:24:52 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export type SmartAddUserToAnotherGroupModalProps = Readonly<{
|
2022-09-26 16:24:52 +00:00
|
|
|
contactID: string;
|
2024-03-13 20:44:13 +00:00
|
|
|
}>;
|
2022-09-26 16:24:52 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export const SmartAddUserToAnotherGroupModal = memo(
|
|
|
|
function SmartAddUserToAnotherGroupModal({
|
|
|
|
contactID,
|
|
|
|
}: SmartAddUserToAnotherGroupModalProps) {
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const candidateConversations = useSelector(getAllGroupsWithInviteAccess);
|
|
|
|
const getContact = useSelector(getContactSelector);
|
|
|
|
const regionCode = useSelector(getRegionCode);
|
2022-09-26 16:24:52 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
const { toggleAddUserToAnotherGroupModal } = useGlobalModalActions();
|
|
|
|
const { addMembersToGroup } = useConversationsActions();
|
|
|
|
const { showToast } = useToastActions();
|
2022-09-26 16:24:52 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
const contact = getContact(contactID);
|
2022-09-26 16:24:52 +00:00
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
return (
|
|
|
|
<AddUserToAnotherGroupModal
|
|
|
|
contact={contact}
|
|
|
|
i18n={i18n}
|
|
|
|
candidateConversations={candidateConversations}
|
|
|
|
regionCode={regionCode}
|
|
|
|
toggleAddUserToAnotherGroupModal={toggleAddUserToAnotherGroupModal}
|
|
|
|
addMembersToGroup={addMembersToGroup}
|
|
|
|
showToast={showToast}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2022-09-26 16:24:52 +00:00
|
|
|
);
|