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

56 lines
1.7 KiB
TypeScript
Raw Normal View History

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import type { LocalizerType } from '../../types/Util';
import { ConfirmationDialog } from '../ConfirmationDialog';
export type PropsType = {
conversationId: string;
i18n: LocalizerType;
cancelJoinRequest: (conversationId: string) => unknown;
};
2022-11-18 00:45:19 +00:00
export function GroupV2PendingApprovalActions({
cancelJoinRequest,
conversationId,
i18n,
2022-11-18 00:45:19 +00:00
}: PropsType): JSX.Element {
const [isConfirming, setIsConfirming] = React.useState(false);
return (
<div className="module-group-v2-pending-approval-actions">
<p className="module-group-v2-pending-approval-actions__message">
2023-03-30 00:03:25 +00:00
{i18n('icu:GroupV2--join--requested')}
</p>
<div className="module-group-v2-pending-approval-actions__buttons">
<button
type="button"
onClick={() => setIsConfirming(true)}
tabIndex={0}
className="module-group-v2-pending-approval-actions__buttons__button"
>
2023-03-30 00:03:25 +00:00
{i18n('icu:GroupV2--join--cancel-request-to-join')}
</button>
</div>
{isConfirming ? (
<ConfirmationDialog
actions={[
{
2023-03-30 00:03:25 +00:00
text: i18n('icu:GroupV2--join--cancel-request-to-join--yes'),
style: 'negative',
action: () => cancelJoinRequest(conversationId),
},
]}
2023-03-30 00:03:25 +00:00
cancelText={i18n('icu:GroupV2--join--cancel-request-to-join--no')}
dialogName="GroupV2CancelRequestToJoin"
i18n={i18n}
onClose={() => setIsConfirming(false)}
>
2023-03-30 00:03:25 +00:00
{i18n('icu:GroupV2--join--cancel-request-to-join--confirmation')}
</ConfirmationDialog>
) : undefined}
</div>
);
2022-11-18 00:45:19 +00:00
}