signal-desktop/ts/state/smart/GroupLinkManagement.tsx
Jamie Kyle 27b55e472d
Refactor smart components
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
2024-03-13 13:44:13 -07:00

38 lines
1.3 KiB
TypeScript

// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { memo } from 'react';
import { useSelector } from 'react-redux';
import { GroupLinkManagement } from '../../components/conversation/conversation-details/GroupLinkManagement';
import { getConversationSelector } from '../selectors/conversations';
import { getIntl } from '../selectors/user';
import { useConversationsActions } from '../ducks/conversations';
export type SmartGroupLinkManagementProps = Readonly<{
conversationId: string;
}>;
export const SmartGroupLinkManagement = memo(function SmartGroupLinkManagement({
conversationId,
}: SmartGroupLinkManagementProps) {
const i18n = useSelector(getIntl);
const conversationSelector = useSelector(getConversationSelector);
const conversation = conversationSelector(conversationId);
const isAdmin = conversation?.areWeAdmin ?? false;
const {
changeHasGroupLink,
generateNewGroupLink,
setAccessControlAddFromInviteLinkSetting,
} = useConversationsActions();
return (
<GroupLinkManagement
i18n={i18n}
changeHasGroupLink={changeHasGroupLink}
conversation={conversation}
generateNewGroupLink={generateNewGroupLink}
isAdmin={isAdmin}
setAccessControlAddFromInviteLinkSetting={
setAccessControlAddFromInviteLinkSetting
}
/>
);
});