mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 09:46:09 +03:00
Convert ShareDialog to Typescript
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
89bc3bdd5b
commit
276b5b874c
1 changed files with 32 additions and 13 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2018 New Vector Ltd
|
Copyright 2018 New Vector Ltd
|
||||||
|
Copyright 2020 The Matrix.org Foundation C.I.C.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with 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.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {createRef} from 'react';
|
import * as React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import * as PropTypes from 'prop-types';
|
||||||
import {Room, User, Group, RoomMember, MatrixEvent} from 'matrix-js-sdk';
|
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 * as sdk from '../../../index';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import QRCode from 'qrcode-react';
|
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<IProps, IState> {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onFinished: PropTypes.func.isRequired,
|
onFinished: PropTypes.func.isRequired,
|
||||||
target: PropTypes.oneOfType([
|
target: PropTypes.oneOfType([
|
||||||
|
@ -65,6 +81,8 @@ export default class ShareDialog extends React.Component {
|
||||||
]).isRequired,
|
]).isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected closeCopiedTooltip: () => void;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
@ -206,17 +224,18 @@ export default class ShareDialog extends React.Component {
|
||||||
<QRCode value={matrixToUrl} size={256} logoWidth={48} logo={require("../../../../res/img/matrix-m.svg")} />
|
<QRCode value={matrixToUrl} size={256} logoWidth={48} logo={require("../../../../res/img/matrix-m.svg")} />
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_ShareDialog_social_container">
|
<div className="mx_ShareDialog_social_container">
|
||||||
{
|
{ socials.map((social) => (
|
||||||
socials.map((social) => <a rel="noreferrer noopener"
|
<a
|
||||||
target="_blank"
|
rel="noreferrer noopener"
|
||||||
key={social.name}
|
target="_blank"
|
||||||
name={social.name}
|
key={social.name}
|
||||||
href={social.url(encodedUrl)}
|
title={social.name}
|
||||||
className="mx_ShareDialog_social_icon"
|
href={social.url(encodedUrl)}
|
||||||
|
className="mx_ShareDialog_social_icon"
|
||||||
>
|
>
|
||||||
<img src={social.img} alt={social.name} height={64} width={64} />
|
<img src={social.img} alt={social.name} height={64} width={64} />
|
||||||
</a>)
|
</a>
|
||||||
}
|
)) }
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in a new issue