2019-01-25 22:51:33 +03:00
|
|
|
/*
|
|
|
|
Copyright 2019 New Vector Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import {Tab, TabbedView} from "../../structures/TabbedView";
|
|
|
|
import {_t, _td} from "../../../languageHandler";
|
2019-01-30 04:23:01 +03:00
|
|
|
import AdvancedRoomSettingsTab from "../settings/tabs/AdvancedRoomSettingsTab";
|
2019-01-25 22:51:33 +03:00
|
|
|
import AccessibleButton from "../elements/AccessibleButton";
|
|
|
|
import dis from '../../../dispatcher';
|
2019-01-30 01:54:51 +03:00
|
|
|
import RolesRoomSettingsTab from "../settings/tabs/RolesRoomSettingsTab";
|
2019-01-26 06:38:35 +03:00
|
|
|
import GeneralRoomSettingsTab from "../settings/tabs/GeneralRoomSettingsTab";
|
2019-01-30 00:30:53 +03:00
|
|
|
import SecurityRoomSettingsTab from "../settings/tabs/SecurityRoomSettingsTab";
|
2019-01-25 22:51:33 +03:00
|
|
|
|
|
|
|
// TODO: Ditch this whole component
|
|
|
|
export class TempTab extends React.Component {
|
|
|
|
static propTypes = {
|
|
|
|
onClose: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
componentDidMount(): void {
|
|
|
|
dis.dispatch({action: "open_old_room_settings"});
|
|
|
|
this.props.onClose();
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return <div>Hello World</div>;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-26 06:38:35 +03:00
|
|
|
export default class RoomSettingsDialog extends React.Component {
|
2019-01-25 22:51:33 +03:00
|
|
|
static propTypes = {
|
2019-01-26 06:38:35 +03:00
|
|
|
roomId: PropTypes.string.isRequired,
|
2019-01-25 22:51:33 +03:00
|
|
|
onFinished: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
|
2019-01-28 23:52:59 +03:00
|
|
|
componentWillMount(): void {
|
|
|
|
this.dispatcherRef = dis.register(this._onAction);
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount(): void {
|
|
|
|
dis.unregister(this.dispatcherRef);
|
|
|
|
}
|
|
|
|
|
|
|
|
_onAction = (payload) => {
|
|
|
|
if (payload.action !== 'close_room_settings') return;
|
|
|
|
this.props.onFinished();
|
|
|
|
};
|
|
|
|
|
2019-01-25 22:51:33 +03:00
|
|
|
_getTabs() {
|
|
|
|
const tabs = [];
|
|
|
|
|
|
|
|
tabs.push(new Tab(
|
|
|
|
_td("General"),
|
|
|
|
"mx_RoomSettingsDialog_settingsIcon",
|
2019-01-28 23:59:09 +03:00
|
|
|
<GeneralRoomSettingsTab roomId={this.props.roomId} />,
|
2019-01-25 22:51:33 +03:00
|
|
|
));
|
|
|
|
tabs.push(new Tab(
|
|
|
|
_td("Security & Privacy"),
|
|
|
|
"mx_RoomSettingsDialog_securityIcon",
|
2019-01-30 00:30:53 +03:00
|
|
|
<SecurityRoomSettingsTab roomId={this.props.roomId} />,
|
2019-01-25 22:51:33 +03:00
|
|
|
));
|
|
|
|
tabs.push(new Tab(
|
|
|
|
_td("Roles & Permissions"),
|
|
|
|
"mx_RoomSettingsDialog_rolesIcon",
|
2019-01-30 01:54:51 +03:00
|
|
|
<RolesRoomSettingsTab roomId={this.props.roomId} />,
|
2019-01-25 22:51:33 +03:00
|
|
|
));
|
|
|
|
tabs.push(new Tab(
|
|
|
|
_td("Advanced"),
|
|
|
|
"mx_RoomSettingsDialog_warningIcon",
|
2019-01-30 04:23:01 +03:00
|
|
|
<AdvancedRoomSettingsTab roomId={this.props.roomId} />,
|
2019-01-25 22:51:33 +03:00
|
|
|
));
|
|
|
|
tabs.push(new Tab(
|
|
|
|
_td("Visit old settings"),
|
|
|
|
"mx_RoomSettingsDialog_warningIcon",
|
|
|
|
<TempTab onClose={this.props.onFinished} />,
|
|
|
|
));
|
|
|
|
|
|
|
|
return tabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="mx_RoomSettingsDialog">
|
|
|
|
<div className="mx_SettingsDialog_header">
|
|
|
|
{_t("Settings")}
|
|
|
|
<span className="mx_SettingsDialog_close">
|
|
|
|
<AccessibleButton className="mx_SettingsDialog_closeIcon" onClick={this.props.onFinished} />
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<TabbedView tabs={this._getTabs()} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|