/* Copyright 2024 New Vector Ltd. Copyright 2019, 2020 The Matrix.org Foundation C.I.C. SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE files in the repository root for full details. */ import React, { type JSX } from "react"; import { type RoomMember, type User } from "matrix-js-sdk/src/matrix"; import { _t } from "../../../languageHandler"; import AccessibleButton from "../elements/AccessibleButton"; import Spinner from "../elements/Spinner"; export const PendingActionSpinner: React.FC<{ text: string }> = ({ text }) => { return (
{text}
); }; interface IProps { waitingForOtherParty: boolean; waitingForNetwork: boolean; member: RoomMember | User; onStartVerification: () => Promise; isRoomEncrypted: boolean; inDialog: boolean; isSelfVerification: boolean; } const EncryptionInfo: React.FC = ({ waitingForOtherParty, waitingForNetwork, member, onStartVerification, isRoomEncrypted, inDialog, isSelfVerification, }: IProps) => { let content: JSX.Element; if (waitingForOtherParty && isSelfVerification) { content =
{_t("encryption|verification|self_verification_hint")}
; } else if (waitingForOtherParty || waitingForNetwork) { let text: string; if (waitingForOtherParty) { text = _t("encryption|verification|waiting_for_user_accept", { displayName: (member as User).displayName || (member as RoomMember).name || member.userId, }); } else { text = _t("encryption|verification|accepting"); } content = ; } else { content = ( {_t("encryption|verification|start_button")} ); } let description: JSX.Element; if (isRoomEncrypted) { description = (

{_t("user_info|room_encrypted")}

{_t("user_info|room_encrypted_detail")}

); } else { description = (

{_t("user_info|room_unencrypted")}

{_t("user_info|room_unencrypted_detail")}

); } if (inDialog) { return content; } return (

{_t("settings|security|encryption_section")}

{description}

{_t("user_info|verify_button")}

{_t("user_info|verify_explainer")}

{_t("encryption|verification|in_person")}

{content}
); }; export default EncryptionInfo;