Make bottom left menu buttons use RoleButton too
Conflicts:
	src/components/structures/BottomLeftMenu.js
cherry-picking commit 2bf0074.
			
			
				pull/4023/head
			
			
		
							parent
							
								
									d81f894a50
								
							
						
					
					
						commit
						67ecd94b4a
					
				| 
						 | 
				
			
			@ -14,13 +14,8 @@ See the License for the specific language governing permissions and
 | 
			
		|||
limitations under the License.
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
var React = require('react');
 | 
			
		||||
var ReactDOM = require('react-dom');
 | 
			
		||||
var sdk = require('matrix-react-sdk')
 | 
			
		||||
var dis = require('matrix-react-sdk/lib/dispatcher');
 | 
			
		||||
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import sdk from 'matrix-react-sdk';
 | 
			
		||||
 | 
			
		||||
module.exports = React.createClass({
 | 
			
		||||
    displayName: 'BottomLeftMenu',
 | 
			
		||||
| 
						 | 
				
			
			@ -29,113 +24,24 @@ module.exports = React.createClass({
 | 
			
		|||
        collapsed: React.PropTypes.bool.isRequired,
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    getInitialState: function() {
 | 
			
		||||
        return({
 | 
			
		||||
            directoryHover : false,
 | 
			
		||||
            roomsHover : false,
 | 
			
		||||
            homeHover: false,
 | 
			
		||||
            peopleHover : false,
 | 
			
		||||
            settingsHover : false,
 | 
			
		||||
        });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Room events
 | 
			
		||||
    onDirectoryClick: function() {
 | 
			
		||||
        dis.dispatch({ action: 'view_room_directory' });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onDirectoryMouseEnter: function() {
 | 
			
		||||
        this.setState({ directoryHover: true });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onDirectoryMouseLeave: function() {
 | 
			
		||||
        this.setState({ directoryHover: false });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onRoomsClick: function() {
 | 
			
		||||
        dis.dispatch({ action: 'view_create_room' });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onRoomsMouseEnter: function() {
 | 
			
		||||
        this.setState({ roomsHover: true });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onRoomsMouseLeave: function() {
 | 
			
		||||
        this.setState({ roomsHover: false });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Home button events
 | 
			
		||||
    onHomeClick: function() {
 | 
			
		||||
        dis.dispatch({ action: 'view_home_page' });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onHomeMouseEnter: function() {
 | 
			
		||||
        this.setState({ homeHover: true });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onHomeMouseLeave: function() {
 | 
			
		||||
        this.setState({ homeHover: false });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // People events
 | 
			
		||||
    onPeopleClick: function() {
 | 
			
		||||
        dis.dispatch({ action: 'view_create_chat' });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onPeopleMouseEnter: function() {
 | 
			
		||||
        this.setState({ peopleHover: true });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onPeopleMouseLeave: function() {
 | 
			
		||||
        this.setState({ peopleHover: false });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Settings events
 | 
			
		||||
    onSettingsClick: function() {
 | 
			
		||||
        dis.dispatch({ action: 'view_user_settings' });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onSettingsMouseEnter: function() {
 | 
			
		||||
        this.setState({ settingsHover: true });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    onSettingsMouseLeave: function() {
 | 
			
		||||
        this.setState({ settingsHover: false });
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    // Get the label/tooltip to show
 | 
			
		||||
    getLabel: function(label, show) {
 | 
			
		||||
        if (show) {
 | 
			
		||||
            var RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
 | 
			
		||||
            return <RoomTooltip className="mx_BottomLeftMenu_tooltip" label={label} />;
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    render: function() {
 | 
			
		||||
        var TintableSvg = sdk.getComponent('elements.TintableSvg');
 | 
			
		||||
        const RoleButton = sdk.getComponent('elements.RoleButton');
 | 
			
		||||
 | 
			
		||||
        var homeButton;
 | 
			
		||||
        if (this.props.teamToken) {
 | 
			
		||||
            homeButton = <RoleButton role='home_page' tooltip={true} />;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return (
 | 
			
		||||
            <div className="mx_BottomLeftMenu">
 | 
			
		||||
                <div className="mx_BottomLeftMenu_options">
 | 
			
		||||
                    <AccessibleButton className="mx_BottomLeftMenu_homePage" onClick={ this.onHomeClick } onMouseEnter={ this.onHomeMouseEnter } onMouseLeave={ this.onHomeMouseLeave } >
 | 
			
		||||
                        <TintableSvg src="img/icons-home.svg" width="25" height="25" />
 | 
			
		||||
                        { this.getLabel("Welcome page", this.state.homeHover) }
 | 
			
		||||
                    </AccessibleButton>
 | 
			
		||||
                    <AccessibleButton className="mx_BottomLeftMenu_people" onClick={ this.onPeopleClick } onMouseEnter={ this.onPeopleMouseEnter } onMouseLeave={ this.onPeopleMouseLeave } >
 | 
			
		||||
                        <TintableSvg src="img/icons-people.svg" width="25" height="25" />
 | 
			
		||||
                        { this.getLabel("Start chat", this.state.peopleHover) }
 | 
			
		||||
                    </AccessibleButton>
 | 
			
		||||
                    <AccessibleButton 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) }
 | 
			
		||||
                    </AccessibleButton>
 | 
			
		||||
                    <AccessibleButton className="mx_BottomLeftMenu_createRoom" onClick={ this.onRoomsClick } onMouseEnter={ this.onRoomsMouseEnter } onMouseLeave={ this.onRoomsMouseLeave } >
 | 
			
		||||
                        <TintableSvg src="img/icons-create-room.svg" width="25" height="25" />
 | 
			
		||||
                        { this.getLabel("Create new room", this.state.roomsHover) }
 | 
			
		||||
                    </AccessibleButton>
 | 
			
		||||
                    <AccessibleButton className="mx_BottomLeftMenu_settings" onClick={ this.onSettingsClick } onMouseEnter={ this.onSettingsMouseEnter } onMouseLeave={ this.onSettingsMouseLeave } >
 | 
			
		||||
                        <TintableSvg src="img/icons-settings.svg" width="25" height="25" />
 | 
			
		||||
                        { this.getLabel("Settings", this.state.settingsHover) }
 | 
			
		||||
                    </AccessibleButton>
 | 
			
		||||
                    { homeButton }
 | 
			
		||||
                    <RoleButton role='start_chat' tooltip={true} />
 | 
			
		||||
                    <RoleButton role='room_directory' tooltip={true} />
 | 
			
		||||
                    <RoleButton role='create_room' tooltip={true} />
 | 
			
		||||
                    <span className="mx_BottomLeftMenu_settings">
 | 
			
		||||
                        <RoleButton role='settings' tooltip={true} />
 | 
			
		||||
                    </span>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,3 +24,10 @@ limitations under the License.
 | 
			
		|||
.mx_RoleButton object {
 | 
			
		||||
    pointer-events: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_RoleButton_tooltip {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    position: relative;
 | 
			
		||||
    top: -25px;
 | 
			
		||||
    left: 6px;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -64,43 +64,25 @@ limitations under the License.
 | 
			
		|||
    pointer-events: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_homePage,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_directory,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_createRoom,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_people,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_settings {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.collapsed .mx_BottomLeftMenu_homePage,
 | 
			
		||||
.collapsed .mx_BottomLeftMenu_directory,
 | 
			
		||||
.collapsed .mx_BottomLeftMenu_createRoom,
 | 
			
		||||
.collapsed .mx_BottomLeftMenu_people,
 | 
			
		||||
.collapsed .mx_BottomLeftMenu_settings {
 | 
			
		||||
.collapsed .mx_RoleButton {
 | 
			
		||||
    margin-right: 0px ! important;
 | 
			
		||||
    padding-top: 3px ! important;
 | 
			
		||||
    padding-bottom: 3px ! important;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_homePage,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_directory,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_createRoom,
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_people {
 | 
			
		||||
.mx_BottomLeftMenu_options .mx_RoleButton {
 | 
			
		||||
    margin-left: 0px;
 | 
			
		||||
    margin-right: 10px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_settings {
 | 
			
		||||
.mx_BottomLeftMenu_options .mx_BottomLeftMenu_settings {
 | 
			
		||||
    float: right;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_BottomLeftMenu_options .mx_BottomLeftMenu_settings .mx_RoleButton {
 | 
			
		||||
    margin-right: 0px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_LeftPanel.collapsed .mx_BottomLeftMenu_settings {
 | 
			
		||||
    float: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.mx_LeftPanel .mx_BottomLeftMenu_tooltip {
 | 
			
		||||
    display: inline-block;
 | 
			
		||||
    position: relative;
 | 
			
		||||
    top: -25px;
 | 
			
		||||
    left: 6px;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue