diff --git a/src/components/views/elements/RoleButton.js b/src/components/views/elements/ActionButton.js
similarity index 54%
rename from src/components/views/elements/RoleButton.js
rename to src/components/views/elements/ActionButton.js
index 60f227a067..6d6289ddab 100644
--- a/src/components/views/elements/RoleButton.js
+++ b/src/components/views/elements/ActionButton.js
@@ -24,8 +24,11 @@ export default React.createClass({
displayName: 'RoleButton',
propTypes: {
- role: PropTypes.string.isRequired,
size: PropTypes.string,
+ tooltip: PropTypes.bool,
+ action: PropTypes.string.isRequired,
+ label: PropTypes.string.isRequired,
+ iconPath: PropTypes.string.isRequired,
},
getDefaultProps: function() {
@@ -43,26 +46,7 @@ export default React.createClass({
_onClick: function(ev) {
ev.stopPropagation();
-
- let action;
- switch(this.props.role) {
- case 'start_chat':
- action = 'view_create_chat';
- break;
- case 'room_directory':
- action = 'view_room_directory';
- break;
- case 'create_room':
- action = 'view_create_room';
- break;
- case 'home_page':
- action = 'view_home_page';
- break;
- case 'settings':
- action = 'view_user_settings';
- break;
- }
- if (action) dis.dispatch({action: action});
+ dis.dispatch({action: this.props.action});
},
_onMouseEnter: function() {
@@ -73,43 +57,13 @@ export default React.createClass({
this.setState({showTooltip: false});
},
- _getLabel() {
- switch(this.props.role) {
- case 'start_chat':
- return 'Start chat';
- case 'room_directory':
- return 'Room directory';
- case 'create_room':
- return 'Create new room';
- case 'home_page':
- return 'Welcome page';
- case 'settings':
- return 'Settings';
- }
- },
-
- _getIconPath() {
- switch(this.props.role) {
- case 'start_chat':
- return 'img/icons-people.svg';
- case 'room_directory':
- return 'img/icons-directory.svg';
- case 'create_room':
- return 'img/icons-create-room.svg';
- case 'home_page':
- return 'img/icons-home.svg';
- case 'settings':
- return 'img/icons-settings.svg';
- }
- },
-
render: function() {
const TintableSvg = sdk.getComponent("elements.TintableSvg");
let tooltip;
if (this.state.showTooltip) {
const RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
- tooltip = ;
+ tooltip = ;
}
return (
@@ -118,7 +72,7 @@ export default React.createClass({
onMouseEnter={this._onMouseEnter}
onMouseLeave={this._onMouseLeave}
>
-
+
{tooltip}
);
diff --git a/src/components/views/elements/CreateRoomButton.js b/src/components/views/elements/CreateRoomButton.js
new file mode 100644
index 0000000000..d6b6526d6c
--- /dev/null
+++ b/src/components/views/elements/CreateRoomButton.js
@@ -0,0 +1,37 @@
+/*
+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 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
new file mode 100644
index 0000000000..4c7f295c87
--- /dev/null
+++ b/src/components/views/elements/HomeButton.js
@@ -0,0 +1,37 @@
+/*
+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 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
new file mode 100644
index 0000000000..651dd8edd0
--- /dev/null
+++ b/src/components/views/elements/RoomDirectoryButton.js
@@ -0,0 +1,37 @@
+/*
+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 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
new file mode 100644
index 0000000000..51da6e3fd1
--- /dev/null
+++ b/src/components/views/elements/SettingsButton.js
@@ -0,0 +1,37 @@
+/*
+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 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
new file mode 100644
index 0000000000..66cd911754
--- /dev/null
+++ b/src/components/views/elements/StartChatButton.js
@@ -0,0 +1,37 @@
+/*
+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 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 2dce02cc78..8c8fd3ea86 100644
--- a/src/components/views/rooms/RoomList.js
+++ b/src/components/views/rooms/RoomList.js
@@ -517,22 +517,24 @@ module.exports = React.createClass({
return ;
}
- const RoleButton = sdk.getComponent('elements.RoleButton');
+ 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
;
}
@@ -544,16 +546,18 @@ module.exports = React.createClass({
},
_getHeaderItems: function(section) {
- const RoleButton = sdk.getComponent('elements.RoleButton');
+ 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
-
-
+
+
;
}
},