From 276b5b874c1a8e7c4fa826c7fba0507fcc9babbe Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 15 Apr 2020 00:22:19 +0100 Subject: [PATCH] Convert ShareDialog to Typescript Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../{ShareDialog.js => ShareDialog.tsx} | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) rename src/components/views/dialogs/{ShareDialog.js => ShareDialog.tsx} (86%) diff --git a/src/components/views/dialogs/ShareDialog.js b/src/components/views/dialogs/ShareDialog.tsx similarity index 86% rename from src/components/views/dialogs/ShareDialog.js rename to src/components/views/dialogs/ShareDialog.tsx index ebd1f8d1eb..375cb65b5f 100644 --- a/src/components/views/dialogs/ShareDialog.js +++ b/src/components/views/dialogs/ShareDialog.tsx @@ -1,5 +1,6 @@ /* Copyright 2018 New Vector Ltd +Copyright 2020 The Matrix.org Foundation C.I.C. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -14,9 +15,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -import React, {createRef} from 'react'; -import PropTypes from 'prop-types'; -import {Room, User, Group, RoomMember, MatrixEvent} from 'matrix-js-sdk'; +import * as React from 'react'; +import * as PropTypes from 'prop-types'; +import {Room} from "matrix-js-sdk/src/models/room"; +import {User} from "matrix-js-sdk/src/models/user"; +import {Group} from "matrix-js-sdk/src/models/group"; +import {RoomMember} from "matrix-js-sdk/src/models/room-member"; +import {MatrixEvent} from "matrix-js-sdk/src/models/event"; import * as sdk from '../../../index'; import { _t } from '../../../languageHandler'; import QRCode from 'qrcode-react'; @@ -53,7 +58,18 @@ const socials = [ }, ]; -export default class ShareDialog extends React.Component { +interface IProps { + onFinished: () => void; + target: Room | User | Group | RoomMember | MatrixEvent; + permalinkCreator: RoomPermalinkCreator; +} + +interface IState { + linkSpecificEvent: boolean; + permalinkCreator: RoomPermalinkCreator; +} + +export default class ShareDialog extends React.PureComponent { static propTypes = { onFinished: PropTypes.func.isRequired, target: PropTypes.oneOfType([ @@ -65,6 +81,8 @@ export default class ShareDialog extends React.Component { ]).isRequired, }; + protected closeCopiedTooltip: () => void; + constructor(props) { super(props); @@ -206,17 +224,18 @@ export default class ShareDialog extends React.Component {
- { - socials.map((social) => ( + {social.name} - ) - } + + )) }