Convert RoomCreate to TS
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
421fa1ab69
commit
c287d15fa0
1 changed files with 10 additions and 10 deletions
|
@ -16,7 +16,6 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import dis from '../../../dispatcher/dispatcher';
|
import dis from '../../../dispatcher/dispatcher';
|
||||||
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
|
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
|
||||||
|
@ -24,15 +23,16 @@ import { _t } from '../../../languageHandler';
|
||||||
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
import { MatrixClientPeg } from '../../../MatrixClientPeg';
|
||||||
import EventTileBubble from "./EventTileBubble";
|
import EventTileBubble from "./EventTileBubble";
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||||
|
|
||||||
|
interface IProps {
|
||||||
|
/* the MatrixEvent to show */
|
||||||
|
mxEvent: MatrixEvent;
|
||||||
|
}
|
||||||
|
|
||||||
@replaceableComponent("views.messages.RoomCreate")
|
@replaceableComponent("views.messages.RoomCreate")
|
||||||
export default class RoomCreate extends React.Component {
|
export default class RoomCreate extends React.Component<IProps> {
|
||||||
static propTypes = {
|
private onLinkClicked = (e: React.MouseEvent): void => {
|
||||||
/* the MatrixEvent to show */
|
|
||||||
mxEvent: PropTypes.object.isRequired,
|
|
||||||
};
|
|
||||||
|
|
||||||
_onLinkClicked = e => {
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const predecessor = this.props.mxEvent.getContent()['predecessor'];
|
const predecessor = this.props.mxEvent.getContent()['predecessor'];
|
||||||
|
@ -45,7 +45,7 @@ export default class RoomCreate extends React.Component {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
public render(): JSX.Element {
|
||||||
const predecessor = this.props.mxEvent.getContent()['predecessor'];
|
const predecessor = this.props.mxEvent.getContent()['predecessor'];
|
||||||
if (predecessor === undefined) {
|
if (predecessor === undefined) {
|
||||||
return <div />; // We should never have been instantiated in this case
|
return <div />; // We should never have been instantiated in this case
|
||||||
|
@ -55,7 +55,7 @@ export default class RoomCreate extends React.Component {
|
||||||
permalinkCreator.load();
|
permalinkCreator.load();
|
||||||
const predecessorPermalink = permalinkCreator.forEvent(predecessor['event_id']);
|
const predecessorPermalink = permalinkCreator.forEvent(predecessor['event_id']);
|
||||||
const link = (
|
const link = (
|
||||||
<a href={predecessorPermalink} onClick={this._onLinkClicked}>
|
<a href={predecessorPermalink} onClick={this.onLinkClicked}>
|
||||||
{ _t("Click here to see older messages.") }
|
{ _t("Click here to see older messages.") }
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
Loading…
Reference in a new issue