diff --git a/package.json b/package.json
index 21add8ccb7..3e1fa2d8f3 100644
--- a/package.json
+++ b/package.json
@@ -65,7 +65,6 @@
"lodash": "^4.13.1",
"matrix-js-sdk": "matrix-org/matrix-js-sdk#develop",
"optimist": "^0.6.1",
- "prop-types": "^15.5.8",
"q": "^1.4.1",
"react": "^15.4.0",
"react-addons-css-transition-group": "15.3.2",
diff --git a/src/components/views/elements/ActionButton.js b/src/components/views/elements/ActionButton.js
deleted file mode 100644
index 267388daf6..0000000000
--- a/src/components/views/elements/ActionButton.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Copyright 2017 Vector Creations 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 AccessibleButton from './AccessibleButton';
-import dis from '../../../dispatcher';
-import sdk from '../../../index';
-
-export default React.createClass({
- displayName: 'RoleButton',
-
- propTypes: {
- size: PropTypes.string,
- tooltip: PropTypes.bool,
- action: PropTypes.string.isRequired,
- label: PropTypes.string.isRequired,
- iconPath: PropTypes.string.isRequired,
- },
-
- getDefaultProps: function() {
- return {
- size: "25",
- tooltip: false,
- };
- },
-
- getInitialState: function() {
- return {
- showTooltip: false,
- };
- },
-
- _onClick: function(ev) {
- ev.stopPropagation();
- dis.dispatch({action: this.props.action});
- },
-
- _onMouseEnter: function() {
- if (this.props.tooltip) this.setState({showTooltip: true});
- },
-
- _onMouseLeave: function() {
- this.setState({showTooltip: false});
- },
-
- render: function() {
- const TintableSvg = sdk.getComponent("elements.TintableSvg");
-
- let tooltip;
- if (this.state.showTooltip) {
- const RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
- tooltip = ;
- }
-
- return (
-
-
- {tooltip}
-
- );
- }
-});
diff --git a/src/components/views/elements/CreateRoomButton.js b/src/components/views/elements/CreateRoomButton.js
deleted file mode 100644
index e7e526d36b..0000000000
--- a/src/components/views/elements/CreateRoomButton.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2017 Vector Creations 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 sdk from '../../../index';
-import PropTypes from 'prop-types';
-
-const CreateRoomButton = function(props) {
- const ActionButton = sdk.getComponent('elements.ActionButton');
- return (
-
- );
-};
-
-CreateRoomButton.propTypes = {
- size: PropTypes.string,
- tooltip: PropTypes.bool,
-};
-
-export default CreateRoomButton;
diff --git a/src/components/views/elements/HomeButton.js b/src/components/views/elements/HomeButton.js
deleted file mode 100644
index 5c446f24c9..0000000000
--- a/src/components/views/elements/HomeButton.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2017 Vector Creations 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 sdk from '../../../index';
-import PropTypes from 'prop-types';
-
-const HomeButton = function(props) {
- const ActionButton = sdk.getComponent('elements.ActionButton');
- return (
-
- );
-};
-
-HomeButton.propTypes = {
- size: PropTypes.string,
- tooltip: PropTypes.bool,
-};
-
-export default HomeButton;
diff --git a/src/components/views/elements/RoomDirectoryButton.js b/src/components/views/elements/RoomDirectoryButton.js
deleted file mode 100644
index 5e68776a15..0000000000
--- a/src/components/views/elements/RoomDirectoryButton.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2017 Vector Creations 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 sdk from '../../../index';
-import PropTypes from 'prop-types';
-
-const RoomDirectoryButton = function(props) {
- const ActionButton = sdk.getComponent('elements.ActionButton');
- return (
-
- );
-};
-
-RoomDirectoryButton.propTypes = {
- size: PropTypes.string,
- tooltip: PropTypes.bool,
-};
-
-export default RoomDirectoryButton;
diff --git a/src/components/views/elements/SettingsButton.js b/src/components/views/elements/SettingsButton.js
deleted file mode 100644
index c6438da277..0000000000
--- a/src/components/views/elements/SettingsButton.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2017 Vector Creations 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 sdk from '../../../index';
-import PropTypes from 'prop-types';
-
-const SettingsButton = function(props) {
- const ActionButton = sdk.getComponent('elements.ActionButton');
- return (
-
- );
-};
-
-SettingsButton.propTypes = {
- size: PropTypes.string,
- tooltip: PropTypes.bool,
-};
-
-export default SettingsButton;
diff --git a/src/components/views/elements/StartChatButton.js b/src/components/views/elements/StartChatButton.js
deleted file mode 100644
index 02d5677a7c..0000000000
--- a/src/components/views/elements/StartChatButton.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright 2017 Vector Creations 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 sdk from '../../../index';
-import PropTypes from 'prop-types';
-
-const StartChatButton = function(props) {
- const ActionButton = sdk.getComponent('elements.ActionButton');
- return (
-
- );
-};
-
-StartChatButton.propTypes = {
- size: PropTypes.string,
- tooltip: PropTypes.bool,
-};
-
-export default StartChatButton;
diff --git a/src/components/views/rooms/RoomList.js b/src/components/views/rooms/RoomList.js
index a595a91ba9..49af1560f1 100644
--- a/src/components/views/rooms/RoomList.js
+++ b/src/components/views/rooms/RoomList.js
@@ -1,6 +1,5 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
-Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,16 +28,8 @@ var Rooms = require('../../../Rooms');
import DMRoomMap from '../../../utils/DMRoomMap';
var Receipt = require('../../../utils/Receipt');
var constantTimeDispatcher = require('../../../ConstantTimeDispatcher');
-import AccessibleButton from '../elements/AccessibleButton';
-const HIDE_CONFERENCE_CHANS = true;
-
-const VERBS = {
- 'm.favourite': 'favourite',
- 'im.vector.fake.direct': 'tag direct chat',
- 'im.vector.fake.recent': 'restore',
- 'm.lowpriority': 'demote',
-};
+var HIDE_CONFERENCE_CHANS = true;
module.exports = React.createClass({
displayName: 'RoomList',
@@ -62,7 +53,6 @@ module.exports = React.createClass({
getInitialState: function() {
return {
isLoadingLeftRooms: false,
- totalRoomCount: null,
lists: {},
incomingCall: null,
};
@@ -83,7 +73,8 @@ module.exports = React.createClass({
// lookup for which lists a given roomId is currently in.
this.listsForRoomId = {};
- this.refreshRoomList();
+ var s = this.getRoomLists();
+ this.setState(s);
// order of the sublists
//this.listOrder = [];
@@ -326,29 +317,21 @@ module.exports = React.createClass({
// any changes to it incrementally, updating the appropriate sublists
// as needed.
// Alternatively we'd do something magical with Immutable.js or similar.
- const lists = this.getRoomLists();
- let totalRooms = 0;
- for (const l of Object.values(lists)) {
- totalRooms += l.length;
- }
- this.setState({
- lists: this.getRoomLists(),
- totalRoomCount: totalRooms,
- });
-
+ this.setState(this.getRoomLists());
+
// this._lastRefreshRoomListTs = Date.now();
},
getRoomLists: function() {
var self = this;
- const lists = {};
+ var s = { lists: {} };
- lists["im.vector.fake.invite"] = [];
- lists["m.favourite"] = [];
- lists["im.vector.fake.recent"] = [];
- lists["im.vector.fake.direct"] = [];
- lists["m.lowpriority"] = [];
- lists["im.vector.fake.archived"] = [];
+ s.lists["im.vector.fake.invite"] = [];
+ s.lists["m.favourite"] = [];
+ s.lists["im.vector.fake.recent"] = [];
+ s.lists["im.vector.fake.direct"] = [];
+ s.lists["m.lowpriority"] = [];
+ s.lists["im.vector.fake.archived"] = [];
this.listsForRoomId = {};
var otherTagNames = {};
@@ -370,7 +353,7 @@ module.exports = React.createClass({
if (me.membership == "invite") {
self.listsForRoomId[room.roomId].push("im.vector.fake.invite");
- lists["im.vector.fake.invite"].push(room);
+ s.lists["im.vector.fake.invite"].push(room);
}
else if (HIDE_CONFERENCE_CHANS && Rooms.isConfCallRoom(room, me, self.props.ConferenceHandler)) {
// skip past this room & don't put it in any lists
@@ -383,8 +366,8 @@ module.exports = React.createClass({
if (tagNames.length) {
for (var i = 0; i < tagNames.length; i++) {
var tagName = tagNames[i];
- lists[tagName] = lists[tagName] || [];
- lists[tagName].push(room);
+ s.lists[tagName] = s.lists[tagName] || [];
+ s.lists[tagName].push(room);
self.listsForRoomId[room.roomId].push(tagName);
otherTagNames[tagName] = 1;
}
@@ -392,16 +375,16 @@ module.exports = React.createClass({
else if (dmRoomMap.getUserIdForRoomId(room.roomId)) {
// "Direct Message" rooms (that we're still in and that aren't otherwise tagged)
self.listsForRoomId[room.roomId].push("im.vector.fake.direct");
- lists["im.vector.fake.direct"].push(room);
+ s.lists["im.vector.fake.direct"].push(room);
}
else {
self.listsForRoomId[room.roomId].push("im.vector.fake.recent");
- lists["im.vector.fake.recent"].push(room);
+ s.lists["im.vector.fake.recent"].push(room);
}
}
else if (me.membership === "leave") {
self.listsForRoomId[room.roomId].push("im.vector.fake.archived");
- lists["im.vector.fake.archived"].push(room);
+ s.lists["im.vector.fake.archived"].push(room);
}
else {
console.error("unrecognised membership: " + me.membership + " - this should never happen");
@@ -425,7 +408,7 @@ module.exports = React.createClass({
];
*/
- return lists;
+ return s;
},
_getScrollNode: function() {
@@ -455,7 +438,6 @@ module.exports = React.createClass({
var incomingCallBox = document.getElementById("incomingCallBox");
if (incomingCallBox && incomingCallBox.parentElement) {
var scrollArea = this._getScrollNode();
- if (!scrollArea) return;
// Use the offset of the top of the scroll area from the window
// as this is used to calculate the CSS fixed top position for the stickies
var scrollAreaOffset = scrollArea.getBoundingClientRect().top + window.pageYOffset;
@@ -479,7 +461,6 @@ module.exports = React.createClass({
// properly through React
_initAndPositionStickyHeaders: function(initialise, scrollToPosition) {
var scrollArea = this._getScrollNode();
- if (!scrollArea) return;
// Use the offset of the top of the scroll area from the window
// as this is used to calculate the CSS fixed top position for the stickies
var scrollAreaOffset = scrollArea.getBoundingClientRect().top + window.pageYOffset;
@@ -577,58 +558,6 @@ module.exports = React.createClass({
this.refs.gemscroll.forceUpdate();
},
- _getEmptyContent: function(section) {
- const RoomDropTarget = sdk.getComponent('rooms.RoomDropTarget');
-
- if (this.props.collapsed) {
- return ;
- }
-
- const StartChatButton = sdk.getComponent('elements.StartChatButton');
- const RoomDirectoryButton = sdk.getComponent('elements.RoomDirectoryButton');
- const CreateRoomButton = sdk.getComponent('elements.CreateRoomButton');
- if (this.state.totalRoomCount === 0) {
- const TintableSvg = sdk.getComponent('elements.TintableSvg');
- switch (section) {
- case 'im.vector.fake.direct':
- return
- Press
-
- to start a chat with someone
-
;
- case 'im.vector.fake.recent':
- return
- You're not in any rooms yet! Press
-
- to make a room or
-
- to browse the directory
-
;
- }
- }
-
- const labelText = 'Drop here to ' + (VERBS[section] || 'tag ' + section);
-
- return ;
- },
-
- _getHeaderItems: function(section) {
- const StartChatButton = sdk.getComponent('elements.StartChatButton');
- const RoomDirectoryButton = sdk.getComponent('elements.RoomDirectoryButton');
- const CreateRoomButton = sdk.getComponent('elements.CreateRoomButton');
- switch (section) {
- case 'im.vector.fake.direct':
- return
-
- ;
- case 'im.vector.fake.recent':
- return
-
-
- ;
- }
- },
-
render: function() {
var RoomSubList = sdk.getComponent('structures.RoomSubList');
var self = this;
@@ -652,7 +581,7 @@ module.exports = React.createClass({