2021-01-29 22:16:48 +00:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
2024-03-13 20:44:13 +00:00
|
|
|
import React, { memo } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
2021-10-26 19:15:33 +00:00
|
|
|
import type { PropsType as GroupV2JoinDialogPropsType } from '../../components/GroupV2JoinDialog';
|
|
|
|
import { GroupV2JoinDialog } from '../../components/GroupV2JoinDialog';
|
2021-01-29 22:16:48 +00:00
|
|
|
import { getIntl } from '../selectors/user';
|
|
|
|
import { getPreJoinConversation } from '../selectors/conversations';
|
|
|
|
|
2024-03-13 20:44:13 +00:00
|
|
|
export type SmartGroupV2JoinDialogProps = Pick<
|
|
|
|
GroupV2JoinDialogPropsType,
|
|
|
|
'join' | 'onClose'
|
|
|
|
>;
|
|
|
|
|
|
|
|
export const SmartGroupV2JoinDialog = memo(function SmartGroupV2JoinDialog({
|
|
|
|
join,
|
|
|
|
onClose,
|
|
|
|
}: SmartGroupV2JoinDialogProps) {
|
|
|
|
const i18n = useSelector(getIntl);
|
|
|
|
const preJoinConversation = useSelector(getPreJoinConversation);
|
|
|
|
if (preJoinConversation == null) {
|
2021-01-29 22:16:48 +00:00
|
|
|
throw new Error('smart/GroupV2JoinDialog: No pre-join conversation!');
|
|
|
|
}
|
2024-03-13 20:44:13 +00:00
|
|
|
const { memberCount, title, groupDescription, approvalRequired, avatar } =
|
|
|
|
preJoinConversation;
|
|
|
|
return (
|
|
|
|
<GroupV2JoinDialog
|
|
|
|
approvalRequired={approvalRequired}
|
|
|
|
avatar={avatar}
|
|
|
|
groupDescription={groupDescription}
|
|
|
|
i18n={i18n}
|
|
|
|
join={join}
|
|
|
|
memberCount={memberCount}
|
|
|
|
onClose={onClose}
|
|
|
|
title={title}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
});
|