2015-07-12 20:51:24 -04:00
|
|
|
/*
|
2016-01-06 23:17:56 -05:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2015-07-12 20:51:24 -04:00
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react');
|
2016-09-03 08:44:00 -04:00
|
|
|
var ReactDOM = require('react-dom');
|
2015-10-11 10:00:43 -04:00
|
|
|
var sdk = require('matrix-react-sdk')
|
2015-09-22 14:09:23 -04:00
|
|
|
var dis = require('matrix-react-sdk/lib/dispatcher');
|
2015-07-15 10:04:24 -04:00
|
|
|
|
2015-07-12 20:51:24 -04:00
|
|
|
module.exports = React.createClass({
|
2015-07-20 23:11:24 -04:00
|
|
|
displayName: 'BottomLeftMenu',
|
2015-07-15 10:04:24 -04:00
|
|
|
|
2016-09-03 08:44:00 -04:00
|
|
|
propTypes: {
|
|
|
|
collapsed: React.PropTypes.bool.isRequired,
|
|
|
|
},
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
return({
|
2016-09-09 07:23:50 -04:00
|
|
|
directoryHover : false,
|
2016-09-03 08:44:00 -04:00
|
|
|
roomsHover : false,
|
|
|
|
peopleHover : false,
|
|
|
|
settingsHover : false,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// Room events
|
2016-09-09 07:23:50 -04:00
|
|
|
onDirectoryClick: function() {
|
|
|
|
dis.dispatch({ action: 'view_room_directory' });
|
|
|
|
},
|
|
|
|
|
|
|
|
onDirectoryMouseEnter: function() {
|
|
|
|
this.setState({ directoryHover: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
onDirectoryMouseLeave: function() {
|
|
|
|
this.setState({ directoryHover: false });
|
|
|
|
},
|
|
|
|
|
2016-09-03 08:44:00 -04:00
|
|
|
onRoomsClick: function() {
|
2016-09-09 07:23:50 -04:00
|
|
|
dis.dispatch({ action: 'view_create_room' });
|
2016-09-03 08:44:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
onRoomsMouseEnter: function() {
|
|
|
|
this.setState({ roomsHover: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
onRoomsMouseLeave: function() {
|
|
|
|
this.setState({ roomsHover: false });
|
|
|
|
},
|
|
|
|
|
|
|
|
// People events
|
|
|
|
onPeopleClick: function() {
|
2016-09-09 07:23:50 -04:00
|
|
|
dis.dispatch({ action: 'view_create_chat' });
|
2016-09-03 08:44:00 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
onPeopleMouseEnter: function() {
|
|
|
|
this.setState({ peopleHover: true });
|
|
|
|
},
|
|
|
|
|
|
|
|
onPeopleMouseLeave: function() {
|
|
|
|
this.setState({ peopleHover: false });
|
|
|
|
},
|
|
|
|
|
|
|
|
// Settings events
|
2015-07-15 10:04:24 -04:00
|
|
|
onSettingsClick: function() {
|
2016-09-09 07:23:50 -04:00
|
|
|
dis.dispatch({ action: 'view_user_settings' });
|
2015-07-15 10:04:24 -04:00
|
|
|
},
|
|
|
|
|
2016-09-03 08:44:00 -04:00
|
|
|
onSettingsMouseEnter: function() {
|
|
|
|
this.setState({ settingsHover: true });
|
2015-07-20 23:11:24 -04:00
|
|
|
},
|
|
|
|
|
2016-09-03 08:44:00 -04:00
|
|
|
onSettingsMouseLeave: function() {
|
|
|
|
this.setState({ settingsHover: false });
|
2015-07-16 08:49:34 -04:00
|
|
|
},
|
|
|
|
|
2016-09-03 08:44:00 -04:00
|
|
|
// Get the label/tooltip to show
|
2016-09-04 02:41:48 -04:00
|
|
|
getLabel: function(label, show) {
|
2016-09-03 08:57:49 -04:00
|
|
|
if (show) {
|
2015-12-01 06:19:54 -05:00
|
|
|
var RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
|
2016-09-09 01:56:54 -04:00
|
|
|
return <RoomTooltip className="mx_BottomLeftMenu_tooltip" label={label} />;
|
2015-10-11 10:00:43 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2015-07-12 20:51:24 -04:00
|
|
|
render: function() {
|
2016-04-14 16:43:49 -04:00
|
|
|
var TintableSvg = sdk.getComponent('elements.TintableSvg');
|
2015-07-12 20:51:24 -04:00
|
|
|
return (
|
2015-07-20 23:11:24 -04:00
|
|
|
<div className="mx_BottomLeftMenu">
|
|
|
|
<div className="mx_BottomLeftMenu_options">
|
2016-09-13 07:18:09 -04:00
|
|
|
<div className="mx_BottomLeftMenu_people" onClick={ this.onPeopleClick } onMouseEnter={ this.onPeopleMouseEnter } onMouseLeave={ this.onPeopleMouseLeave } >
|
|
|
|
<TintableSvg src="img/icons-people.svg" width="25" height="25" />
|
2016-09-13 14:42:35 -04:00
|
|
|
{ this.getLabel("Start chat", this.state.peopleHover) }
|
2016-09-13 07:18:09 -04:00
|
|
|
</div>
|
2016-09-09 07:23:50 -04:00
|
|
|
<div className="mx_BottomLeftMenu_directory" onClick={ this.onDirectoryClick } onMouseEnter={ this.onDirectoryMouseEnter } onMouseLeave={ this.onDirectoryMouseLeave } >
|
|
|
|
<TintableSvg src="img/icons-directory.svg" width="25" height="25"/>
|
|
|
|
{ this.getLabel("Room directory", this.state.directoryHover) }
|
|
|
|
</div>
|
2016-09-04 02:41:48 -04:00
|
|
|
<div className="mx_BottomLeftMenu_createRoom" onClick={ this.onRoomsClick } onMouseEnter={ this.onRoomsMouseEnter } onMouseLeave={ this.onRoomsMouseLeave } >
|
2016-09-03 08:44:00 -04:00
|
|
|
<TintableSvg src="img/icons-create-room.svg" width="25" height="25" />
|
2016-09-09 07:23:50 -04:00
|
|
|
{ this.getLabel("Create new room", this.state.roomsHover) }
|
2016-04-14 16:43:49 -04:00
|
|
|
</div>
|
2016-09-04 02:41:48 -04:00
|
|
|
<div className="mx_BottomLeftMenu_settings" onClick={ this.onSettingsClick } onMouseEnter={ this.onSettingsMouseEnter } onMouseLeave={ this.onSettingsMouseLeave } >
|
2016-09-03 08:44:00 -04:00
|
|
|
<TintableSvg src="img/icons-settings.svg" width="25" height="25" />
|
2016-09-04 02:41:48 -04:00
|
|
|
{ this.getLabel("Settings", this.state.settingsHover) }
|
2016-04-14 16:43:49 -04:00
|
|
|
</div>
|
2015-07-12 20:51:24 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|