signal-desktop/ts/components/conversation/RemoveGroupMemberConfirmationDialog.tsx

65 lines
1.6 KiB
TypeScript
Raw Normal View History

2021-06-01 23:30:25 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
2021-06-01 23:30:25 +00:00
import type { ConversationType } from '../../state/ducks/conversations';
import type { LocalizerType } from '../../types/Util';
import { isAccessControlEnabled } from '../../groups/util';
2021-06-01 23:30:25 +00:00
import { ConfirmationDialog } from '../ConfirmationDialog';
import { Intl } from '../Intl';
import { ContactName } from './ContactName';
type PropsType = {
group: ConversationType;
2021-06-01 23:30:25 +00:00
conversation: ConversationType;
i18n: LocalizerType;
onClose: () => void;
onRemove: () => void;
};
2022-11-18 00:45:19 +00:00
export function RemoveGroupMemberConfirmationDialog({
conversation,
group,
i18n,
onClose,
onRemove,
}: PropsType): JSX.Element {
const accessControlEnabled = isAccessControlEnabled(
2022-03-22 20:45:34 +00:00
group.accessControlAddFromInviteLink
);
const contactName = <ContactName title={conversation.title} />;
2022-03-22 20:45:34 +00:00
return (
<ConfirmationDialog
2022-09-27 20:24:21 +00:00
dialogName="RemoveGroupMemberConfirmationDialog"
2022-03-22 20:45:34 +00:00
actions={[
{
action: onRemove,
2023-03-30 00:03:25 +00:00
text: i18n('icu:RemoveGroupMemberConfirmation__remove-button'),
2022-03-22 20:45:34 +00:00
style: 'negative',
},
]}
i18n={i18n}
onClose={onClose}
title={
accessControlEnabled ? (
<Intl
i18n={i18n}
2023-03-30 00:03:25 +00:00
id="icu:RemoveGroupMemberConfirmation__description__with-link"
components={{ name: contactName }}
/>
) : (
<Intl
i18n={i18n}
2023-03-30 00:03:25 +00:00
id="icu:RemoveGroupMemberConfirmation__description"
components={{ name: contactName }}
/>
)
2022-03-22 20:45:34 +00:00
}
/>
);
2022-11-18 00:45:19 +00:00
}