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