From c5a1de961b27ca4aaecad93d2a973afd9d5182b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Tue, 21 Sep 2021 12:44:40 +0200 Subject: [PATCH] Convert GeneralRoomSettingsTab to TS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- ...tingsTab.js => GeneralRoomSettingsTab.tsx} | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) rename src/components/views/settings/tabs/room/{GeneralRoomSettingsTab.js => GeneralRoomSettingsTab.tsx} (88%) diff --git a/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js b/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.tsx similarity index 88% rename from src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js rename to src/components/views/settings/tabs/room/GeneralRoomSettingsTab.tsx index b90fb310e0..790e2999f5 100644 --- a/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.js +++ b/src/components/views/settings/tabs/room/GeneralRoomSettingsTab.tsx @@ -15,45 +15,46 @@ limitations under the License. */ import React from 'react'; -import PropTypes from 'prop-types'; import { _t } from "../../../../../languageHandler"; import RoomProfileSettings from "../../../room_settings/RoomProfileSettings"; -import * as sdk from "../../../../.."; import AccessibleButton from "../../../elements/AccessibleButton"; import dis from "../../../../../dispatcher/dispatcher"; import MatrixClientContext from "../../../../../contexts/MatrixClientContext"; import SettingsStore from "../../../../../settings/SettingsStore"; import { UIFeature } from "../../../../../settings/UIFeature"; import { replaceableComponent } from "../../../../../utils/replaceableComponent"; +import UrlPreviewSettings from "../../../room_settings/UrlPreviewSettings"; +import RelatedGroupSettings from "../../../room_settings/RelatedGroupSettings"; +import AliasSettings from "../../../room_settings/AliasSettings"; + +interface IProps { + roomId: string; +} + +interface IState { + isRoomPublished: boolean; +} @replaceableComponent("views.settings.tabs.room.GeneralRoomSettingsTab") -export default class GeneralRoomSettingsTab extends React.Component { - static propTypes = { - roomId: PropTypes.string.isRequired, - }; +export default class GeneralRoomSettingsTab extends React.Component { + public static contextType = MatrixClientContext; - static contextType = MatrixClientContext; - - constructor() { - super(); + constructor(props: IProps) { + super(props); this.state = { isRoomPublished: false, // loaded async }; } - _onLeaveClick = () => { + private onLeaveClick = (): void => { dis.dispatch({ action: 'leave_room', room_id: this.props.roomId, }); }; - render() { - const AliasSettings = sdk.getComponent("room_settings.AliasSettings"); - const RelatedGroupSettings = sdk.getComponent("room_settings.RelatedGroupSettings"); - const UrlPreviewSettings = sdk.getComponent("room_settings.UrlPreviewSettings"); - + public render(): JSX.Element { const client = this.context; const room = client.getRoom(this.props.roomId); @@ -110,7 +111,7 @@ export default class GeneralRoomSettingsTab extends React.Component { { _t("Leave room") }
- + { _t('Leave room') }