Convert EncryptionInfo to TS

This commit is contained in:
Swapnil Raj 2020-07-18 22:44:56 +05:30
parent a4959f43d2
commit dac19cffce

View file

@ -15,10 +15,10 @@ limitations under the License.
*/ */
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import * as sdk from "../../../index"; import * as sdk from "../../../index";
import {_t} from "../../../languageHandler"; import {_t} from "../../../languageHandler";
import {RoomMember} from "matrix-js-sdk/src/models/room-member"
export const PendingActionSpinner = ({text}) => { export const PendingActionSpinner = ({text}) => {
const Spinner = sdk.getComponent('elements.Spinner'); const Spinner = sdk.getComponent('elements.Spinner');
@ -28,7 +28,17 @@ export const PendingActionSpinner = ({text}) => {
</div>; </div>;
}; };
const EncryptionInfo = ({ interface IProps {
waitingForOtherParty: boolean;
waitingForNetwork: boolean;
member: RoomMember;
onStartVerification: () => Promise<void>;
isRoomEncrypted: boolean;
inDialog: boolean;
isSelfVerification: boolean;
}
const EncryptionInfo: React.FC<IProps> = ({
waitingForOtherParty, waitingForOtherParty,
waitingForNetwork, waitingForNetwork,
member, member,
@ -36,10 +46,10 @@ const EncryptionInfo = ({
isRoomEncrypted, isRoomEncrypted,
inDialog, inDialog,
isSelfVerification, isSelfVerification,
}) => { }: IProps) => {
let content; let content: JSX.Element;
if (waitingForOtherParty || waitingForNetwork) { if (waitingForOtherParty || waitingForNetwork) {
let text; let text: string;
if (waitingForOtherParty) { if (waitingForOtherParty) {
if (isSelfVerification) { if (isSelfVerification) {
text = _t("Waiting for you to accept on your other session…"); text = _t("Waiting for you to accept on your other session…");
@ -61,7 +71,7 @@ const EncryptionInfo = ({
); );
} }
let description; let description: JSX.Element;
if (isRoomEncrypted) { if (isRoomEncrypted) {
description = ( description = (
<div> <div>
@ -97,10 +107,5 @@ const EncryptionInfo = ({
</div> </div>
</React.Fragment>; </React.Fragment>;
}; };
EncryptionInfo.propTypes = {
member: PropTypes.object.isRequired,
onStartVerification: PropTypes.func.isRequired,
request: PropTypes.object,
};
export default EncryptionInfo; export default EncryptionInfo;