Skip to content

Commit 3cead03

Browse files
committed
Revert "Merge pull request element-hq#3804 from vector-im/dbkr/left_panel_for_newbies_2"
This reverts commit e613382, reversing changes made to d1db602.
1 parent 0e0918d commit 3cead03

7 files changed

Lines changed: 170 additions & 111 deletions

File tree

‎src/components/structures/BottomLeftMenu.js‎

Lines changed: 112 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
3-
Copyright 2017 Vector Creations Ltd
43
54
Licensed under the Apache License, Version 2.0 (the "License");
65
you may not use this file except in compliance with the License.
@@ -15,8 +14,13 @@ See the License for the specific language governing permissions and
1514
limitations under the License.
1615
*/
1716

18-
import React from 'react';
19-
import sdk from 'matrix-react-sdk';
17+
'use strict';
18+
19+
var React = require('react');
20+
var ReactDOM = require('react-dom');
21+
var sdk = require('matrix-react-sdk')
22+
var dis = require('matrix-react-sdk/lib/dispatcher');
23+
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
2024

2125
module.exports = React.createClass({
2226
displayName: 'BottomLeftMenu',
@@ -26,28 +30,121 @@ module.exports = React.createClass({
2630
teamToken: React.PropTypes.string,
2731
},
2832

33+
getInitialState: function() {
34+
return({
35+
directoryHover : false,
36+
roomsHover : false,
37+
homeHover: false,
38+
peopleHover : false,
39+
settingsHover : false,
40+
});
41+
},
42+
43+
// Room events
44+
onDirectoryClick: function() {
45+
dis.dispatch({ action: 'view_room_directory' });
46+
},
47+
48+
onDirectoryMouseEnter: function() {
49+
this.setState({ directoryHover: true });
50+
},
51+
52+
onDirectoryMouseLeave: function() {
53+
this.setState({ directoryHover: false });
54+
},
55+
56+
onRoomsClick: function() {
57+
dis.dispatch({ action: 'view_create_room' });
58+
},
59+
60+
onRoomsMouseEnter: function() {
61+
this.setState({ roomsHover: true });
62+
},
63+
64+
onRoomsMouseLeave: function() {
65+
this.setState({ roomsHover: false });
66+
},
67+
68+
// Home button events
69+
onHomeClick: function() {
70+
dis.dispatch({ action: 'view_home_page' });
71+
},
72+
73+
onHomeMouseEnter: function() {
74+
this.setState({ homeHover: true });
75+
},
76+
77+
onHomeMouseLeave: function() {
78+
this.setState({ homeHover: false });
79+
},
80+
81+
// People events
82+
onPeopleClick: function() {
83+
dis.dispatch({ action: 'view_create_chat' });
84+
},
85+
86+
onPeopleMouseEnter: function() {
87+
this.setState({ peopleHover: true });
88+
},
89+
90+
onPeopleMouseLeave: function() {
91+
this.setState({ peopleHover: false });
92+
},
93+
94+
// Settings events
95+
onSettingsClick: function() {
96+
dis.dispatch({ action: 'view_user_settings' });
97+
},
98+
99+
onSettingsMouseEnter: function() {
100+
this.setState({ settingsHover: true });
101+
},
102+
103+
onSettingsMouseLeave: function() {
104+
this.setState({ settingsHover: false });
105+
},
106+
107+
// Get the label/tooltip to show
108+
getLabel: function(label, show) {
109+
if (show) {
110+
var RoomTooltip = sdk.getComponent("rooms.RoomTooltip");
111+
return <RoomTooltip className="mx_BottomLeftMenu_tooltip" label={label} />;
112+
}
113+
},
114+
29115
render: function() {
30-
const HomeButton = sdk.getComponent('elements.HomeButton');
31-
const StartChatButton = sdk.getComponent('elements.StartChatButton');
32-
const RoomDirectoryButton = sdk.getComponent('elements.RoomDirectoryButton');
33-
const CreateRoomButton = sdk.getComponent('elements.CreateRoomButton');
34-
const SettingsButton = sdk.getComponent('elements.SettingsButton');
116+
var TintableSvg = sdk.getComponent('elements.TintableSvg');
35117

36118
var homeButton;
37119
if (this.props.teamToken) {
38-
homeButton = <HomeButton tooltip={true} />;
120+
homeButton = (
121+
<AccessibleButton className="mx_BottomLeftMenu_homePage" onClick={ this.onHomeClick } onMouseEnter={ this.onHomeMouseEnter } onMouseLeave={ this.onHomeMouseLeave } >
122+
<TintableSvg src="img/icons-home.svg" width="25" height="25" />
123+
{ this.getLabel("Welcome page", this.state.homeHover) }
124+
</AccessibleButton>
125+
);
39126
}
40127

41128
return (
42129
<div className="mx_BottomLeftMenu">
43130
<div className="mx_BottomLeftMenu_options">
44131
{ homeButton }
45-
<StartChatButton tooltip={true} />
46-
<RoomDirectoryButton tooltip={true} />
47-
<CreateRoomButton tooltip={true} />
48-
<span className="mx_BottomLeftMenu_settings">
49-
<SettingsButton tooltip={true} />
50-
</span>
132+
<AccessibleButton className="mx_BottomLeftMenu_people" onClick={ this.onPeopleClick } onMouseEnter={ this.onPeopleMouseEnter } onMouseLeave={ this.onPeopleMouseLeave } >
133+
<TintableSvg src="img/icons-people.svg" width="25" height="25" />
134+
{ this.getLabel("Start chat", this.state.peopleHover) }
135+
</AccessibleButton>
136+
<AccessibleButton className="mx_BottomLeftMenu_directory" onClick={ this.onDirectoryClick } onMouseEnter={ this.onDirectoryMouseEnter } onMouseLeave={ this.onDirectoryMouseLeave } >
137+
<TintableSvg src="img/icons-directory.svg" width="25" height="25"/>
138+
{ this.getLabel("Room directory", this.state.directoryHover) }
139+
</AccessibleButton>
140+
<AccessibleButton className="mx_BottomLeftMenu_createRoom" onClick={ this.onRoomsClick } onMouseEnter={ this.onRoomsMouseEnter } onMouseLeave={ this.onRoomsMouseLeave } >
141+
<TintableSvg src="img/icons-create-room.svg" width="25" height="25" />
142+
{ this.getLabel("Create new room", this.state.roomsHover) }
143+
</AccessibleButton>
144+
<AccessibleButton className="mx_BottomLeftMenu_settings" onClick={ this.onSettingsClick } onMouseEnter={ this.onSettingsMouseEnter } onMouseLeave={ this.onSettingsMouseLeave } >
145+
<TintableSvg src="img/icons-settings.svg" width="25" height="25" />
146+
{ this.getLabel("Settings", this.state.settingsHover) }
147+
</AccessibleButton>
51148
</div>
52149
</div>
53150
);

‎src/components/structures/RoomSubList.js‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
Copyright 2017 Vector Creations Ltd
32
Copyright 2015, 2016 OpenMarket Ltd
43
54
Licensed under the Apache License, Version 2.0 (the "License");
@@ -84,8 +83,6 @@ var RoomSubList = React.createClass({
8483
incomingCall: React.PropTypes.object,
8584
onShowMoreRooms: React.PropTypes.func,
8685
searchFilter: React.PropTypes.string,
87-
emptyContent: React.PropTypes.node, // content shown if the list is empty
88-
headerItems: React.PropTypes.node, // content shown in the sublist header
8986
},
9087

9188
getInitialState: function() {
@@ -472,15 +469,16 @@ var RoomSubList = React.createClass({
472469

473470
render: function() {
474471
var connectDropTarget = this.props.connectDropTarget;
472+
var RoomDropTarget = sdk.getComponent('rooms.RoomDropTarget');
475473
var TruncatedList = sdk.getComponent('elements.TruncatedList');
476474

477475
var label = this.props.collapsed ? null : this.props.label;
478476

479-
let content;
480-
if (this.state.sortedList.length == 0) {
481-
content = this.props.emptyContent;
482-
} else {
483-
content = this.makeRoomTiles();
477+
//console.log("render: " + JSON.stringify(this.state.sortedList));
478+
479+
var target;
480+
if (this.state.sortedList.length == 0 && this.props.editable) {
481+
target = <RoomDropTarget label={ 'Drop here to ' + this.props.verb }/>;
484482
}
485483

486484
var roomCount = this.props.list.length > 0 ? this.props.list.length : '';
@@ -500,7 +498,8 @@ var RoomSubList = React.createClass({
500498
if (!this.state.hidden) {
501499
subList = <TruncatedList className={ classes } truncateAt={this.state.truncateAt}
502500
createOverflowElement={this._createOverflowTile} >
503-
{ content }
501+
{ target }
502+
{ this.makeRoomTiles() }
504503
</TruncatedList>;
505504
}
506505
else {
@@ -522,7 +521,6 @@ var RoomSubList = React.createClass({
522521
roomNotificationCount={ this.roomNotificationCount() }
523522
onClick={ this.onClick }
524523
onHeaderClick={ this.props.onHeaderClick }
525-
headerItems={this.props.headerItems}
526524
/>
527525
{ subList }
528526
</div>
@@ -544,7 +542,6 @@ var RoomSubList = React.createClass({
544542
roomNotificationCount={ this.roomNotificationCount() }
545543
onClick={ this.onClick }
546544
onHeaderClick={ this.props.onHeaderClick }
547-
headerItems={this.props.headerItems}
548545
/>
549546
: undefined }
550547
{ (this.props.showSpinner && !this.state.hidden) ? <Loader /> : undefined }

‎src/components/structures/RoomSubListHeader.js‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import React from 'react';
18-
import classNames from 'classnames';
19-
import sdk from 'matrix-react-sdk';
20-
import { formatCount } from 'matrix-react-sdk/lib/utils/FormattingUtils';
21-
import AccessibleButton from 'matrix-react-sdk/lib/components/views/elements/AccessibleButton';
17+
'use strict';
18+
19+
var React = require('react');
20+
var ReactDOM = require('react-dom');
21+
var classNames = require('classnames');
22+
var sdk = require('matrix-react-sdk')
23+
var FormattingUtils = require('matrix-react-sdk/lib/utils/FormattingUtils');
24+
var RoomNotifs = require('matrix-react-sdk/lib/RoomNotifs');
25+
var AccessibleButton = require('matrix-react-sdk/lib/components/views/elements/AccessibleButton');
26+
var ConstantTimeDispatcher = require('matrix-react-sdk/lib/ConstantTimeDispatcher');
2227

2328
module.exports = React.createClass({
2429
displayName: 'RoomSubListHeader',
@@ -37,7 +42,6 @@ module.exports = React.createClass({
3742
hidden: React.PropTypes.bool,
3843
onClick: React.PropTypes.func,
3944
onHeaderClick: React.PropTypes.func,
40-
headerItems: React.PropTypes.node, // content shown in the sublist header
4145
},
4246

4347
getDefaultProps: function() {
@@ -59,52 +63,52 @@ module.exports = React.createClass({
5963
// },
6064

6165
render: function() {
62-
const TintableSvg = sdk.getComponent("elements.TintableSvg");
66+
var TintableSvg = sdk.getComponent("elements.TintableSvg");
6367

64-
const subListNotifications = this.props.roomNotificationCount;
65-
const subListNotifCount = subListNotifications[0];
66-
const subListNotifHighlight = subListNotifications[1];
68+
var subListNotifications = this.props.roomNotificationCount;
69+
var subListNotifCount = subListNotifications[0];
70+
var subListNotifHighlight = subListNotifications[1];
6771

68-
const chevronClasses = classNames({
72+
var chevronClasses = classNames({
6973
'mx_RoomSubList_chevron': true,
7074
'mx_RoomSubList_chevronRight': this.props.hidden,
7175
'mx_RoomSubList_chevronDown': !this.props.hidden,
7276
});
7377

74-
const badgeClasses = classNames({
78+
var badgeClasses = classNames({
7579
'mx_RoomSubList_badge': true,
7680
'mx_RoomSubList_badgeHighlight': subListNotifHighlight,
7781
});
7882

79-
let badge;
83+
var badge;
8084
if (subListNotifCount > 0) {
81-
badge = <div className={badgeClasses}>{ formatCount(subListNotifCount) }</div>;
82-
} else if (subListNotifHighlight) {
85+
badge = <div className={badgeClasses}>{ FormattingUtils.formatCount(subListNotifCount) }</div>;
86+
}
87+
else if (subListNotifHighlight) {
8388
badge = <div className={badgeClasses}>!</div>;
8489
}
8590

8691
// When collapsed, allow a long hover on the header to show user
8792
// the full tag name and room count
88-
let title;
89-
const roomCount = this.props.roomCount;
93+
var title;
94+
var roomCount = this.props.roomCount;
9095
if (this.props.collapsed) {
9196
title = this.props.label;
9297
if (roomCount !== '') {
9398
title += " [" + roomCount + "]";
9499
}
95100
}
96101

97-
let incomingCall;
102+
var incomingCall;
98103
if (this.props.isIncomingCallRoom) {
99-
const IncomingCallBox = sdk.getComponent("voip.IncomingCallBox");
104+
var IncomingCallBox = sdk.getComponent("voip.IncomingCallBox");
100105
incomingCall = <IncomingCallBox className="mx_RoomSubList_incomingCall" incomingCall={ this.props.incomingCall }/>;
101106
}
102107

103108
return (
104109
<div className="mx_RoomSubList_labelContainer" title={ title } ref="header">
105110
<AccessibleButton onClick={ this.props.onClick } className="mx_RoomSubList_label" tabIndex="0">
106111
{ this.props.collapsed ? '' : this.props.label }
107-
{this.props.headerItems}
108112
<div className="mx_RoomSubList_roomCount">{ roomCount }</div>
109113
<div className={chevronClasses}></div>
110114
{ badge }

‎src/skins/vector/css/_components.scss‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
@import "./matrix-react-sdk/views/elements/_MemberEventListSummary.scss";
2828
@import "./matrix-react-sdk/views/elements/_ProgressBar.scss";
2929
@import "./matrix-react-sdk/views/elements/_RichText.scss";
30-
@import "./matrix-react-sdk/views/elements/_RoleButton.scss";
3130
@import "./matrix-react-sdk/views/login/_InteractiveAuthEntryComponents.scss";
3231
@import "./matrix-react-sdk/views/login/_ServerConfig.scss";
3332
@import "./matrix-react-sdk/views/messages/_MEmoteBody.scss";

‎src/skins/vector/css/matrix-react-sdk/views/elements/_RoleButton.scss‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎src/skins/vector/css/matrix-react-sdk/views/rooms/_RoomList.scss‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
3-
Copyright 2107 Vector Creations Ltd
43
54
Licensed under the Apache License, Version 2.0 (the "License");
65
you may not use this file except in compliance with the License.
@@ -38,25 +37,3 @@ limitations under the License.
3837
.mx_RoomList_scrollbar .gm-scrollbar.-vertical {
3938
z-index: 6;
4039
}
41-
42-
.mx_RoomList_emptySubListTip {
43-
font-size: 13px;
44-
margin-left: 18px;
45-
margin-right: 18px;
46-
margin-top: 8px;
47-
margin-bottom: 7px;
48-
padding: 5px;
49-
border: 1px dashed $accent-color;
50-
color: $primary-fg-color;
51-
background-color: $droptarget-bg-color;
52-
border-radius: 4px;
53-
}
54-
55-
.mx_RoomList_emptySubListTip .mx_RoleButton {
56-
vertical-align: -3px;
57-
}
58-
59-
.mx_RoomList_headerButtons {
60-
position: absolute;
61-
right: 60px;
62-
}

0 commit comments

Comments
 (0)