Skip to content

Commit 8842147

Browse files
committed
skin RoomDropTarget correctly
1 parent 61e55b3 commit 8842147

9 files changed

Lines changed: 71 additions & 32 deletions

File tree

‎src/skins/vector/css/hide.css‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
.mx_RoomDropTarget,
21
.mx_RoomSettings_encrypt,
32
.mx_CreateRoom_encrypt,
43
.mx_RightPanel_filebutton

‎src/skins/vector/css/molecules/RoomDropTarget.css‎

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,29 @@ limitations under the License.
1616

1717
.mx_RoomDropTarget {
1818
font-size: 14px;
19-
text-align: center;
20-
margin-left: 8px;
19+
margin-left: 10px;
20+
margin-right: 15px;
21+
padding-top: 5px;
22+
padding-bottom: 5px;
23+
border: 1px dashed #76cfa6;
24+
color: #454545;
25+
background-color: rgba(255,255,255,0.5);
26+
border-radius: 4px;
27+
}
28+
29+
.mx_RoomDropTarget_avatar {
30+
background-color: #fff;
31+
border-radius: 24px;
32+
width: 24px;
33+
height: 24px;
34+
float: left;
35+
margin-left: 7px;
2136
margin-right: 8px;
22-
padding-top: 16px;
23-
padding-bottom: 16px;
24-
background-color: #fbfbfb;
25-
border: 1px dashed #d7d7d7;
26-
border-radius: 8px;
37+
}
38+
39+
.mx_RoomDropTarget_label {
40+
position: relative;
41+
margin-top: 3px;
42+
line-height: 21px;
43+
z-index: 1;
2744
}

‎src/skins/vector/css/molecules/RoomTile.css‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ limitations under the License.
2222

2323
.mx_RoomTile_avatar {
2424
display: table-cell;
25-
background: #eaf5f0;
2625
padding-right: 8px;
2726
padding-top: 4px;
2827
padding-bottom: 2px;
@@ -43,13 +42,11 @@ limitations under the License.
4342
overflow: hidden;
4443
text-overflow: ellipsis;
4544
padding-right: 16px;
46-
color: #454545;
47-
opacity: 0.8;
45+
color: rgba(69, 69, 69, 0.8);
4846
}
4947

5048
.mx_RoomTile_invite {
51-
opacity: 0.5;
52-
font-weight: normal;
49+
color: rgba(69, 69, 69, 0.5);
5350
}
5451

5552
.collapsed .mx_RoomTile_name {
@@ -106,15 +103,16 @@ limitations under the License.
106103

107104
.mx_RoomTile_unread,
108105
.mx_RoomTile_highlight,
109-
.mx_RoomTile_invited
106+
.mx_RoomTile_selected
110107
{
111108
font-weight: bold;
112109
}
113110

114-
.mx_RoomTile_selected {
111+
.mx_RoomTile_selected .mx_RoomTile_name {
112+
color: #76cfa6 ! important;
115113
}
116114

117-
.mx_RoomTile.mx_RoomTile_selected {
115+
.mx_RoomTile.mx_RoomTile_selected .mx_RoomTile_name {
118116
background: url('img/selected.png');
119117
background-repeat: no-repeat;
120118
background-position: right center;

‎src/skins/vector/css/organisms/LeftPanel.css‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,18 @@ limitations under the License.
5757
-webkit-order: 3;
5858
order: 3;
5959

60-
-webkit-flex: 0 0 126px;
61-
flex: 0 0 126px;
60+
-webkit-flex: 0 0 140px;
61+
flex: 0 0 140px;
62+
63+
background-color: rgba(118,207,166,0.19);
6264
}
6365

6466
.mx_LeftPanel .mx_BottomLeftMenu .mx_RoomTile {
6567
color: #454545;
6668
}
6769

6870
.mx_LeftPanel .mx_BottomLeftMenu .mx_BottomLeftMenu_options {
69-
margin-top: 12px;
71+
margin-top: 17px;
7072
width: 100%;
7173
}
7274

‎src/skins/vector/css/organisms/RoomList.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
.mx_RoomList {
1818
padding-top: 24px;
19+
padding-bottom: 12px;
1920
}
2021

2122
.mx_RoomList_expandButton {

‎src/skins/vector/views/molecules/RoomDropTarget.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ limitations under the License.
1818

1919
var React = require('react');
2020

21-
//var RoomDropTargetController = require('matrix-react-sdk/lib/controllers/molecules/RoomDropTargetController')
22-
2321
module.exports = React.createClass({
2422
displayName: 'RoomDropTarget',
25-
// mixins: [RoomDropTargetController],
23+
2624
render: function() {
2725
return (
2826
<div className="mx_RoomDropTarget">
29-
{this.props.text}
27+
<div className="mx_RoomDropTarget_avatar"></div>
28+
<div className="mx_RoomDropTarget_label">
29+
{ this.props.label }
30+
</div>
3031
</div>
3132
);
3233
}

‎src/skins/vector/views/molecules/RoomTile.js‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ var sdk = require('matrix-react-sdk')
3232
* Only `beginDrag` function is required.
3333
*/
3434
var roomTileSource = {
35+
canDrag: function(props, monitor) {
36+
return props.roomSubList.props.editable;
37+
},
38+
3539
beginDrag: function (props) {
3640
// Return the data describing the dragged item
3741
var item = {
@@ -60,8 +64,6 @@ var roomTileSource = {
6064
return;
6165
}
6266
else {
63-
// if it's not manual ordering, we'll need to position the tile correctly here according to the right ordering
64-
6567
// When dropped on a compatible target, actually set the right tags for the new ordering
6668
// persistNewOrder(item.room, dropResult.listId);
6769
}
@@ -86,9 +88,18 @@ var roomTileTarget = {
8688
item.targetList = props.roomSubList;
8789
}
8890

89-
if (item.targetList.props.order === 'manual' && item.room.roomId !== props.room.roomId) {
90-
var roomTile = props.roomSubList.findRoomTile(props.room);
91-
props.roomSubList.moveRoomTile(item.room, roomTile.index);
91+
if (item.targetList.props.order === 'manual') {
92+
if (item.room.roomId !== props.room.roomId) {
93+
var roomTile = props.roomSubList.findRoomTile(props.room);
94+
props.roomSubList.moveRoomTile(item.room, roomTile.index);
95+
}
96+
}
97+
else {
98+
if (!props.roomSubList.findRoomTile(item.room).room) {
99+
// add to the list in the right place
100+
props.roomSubList.moveRoomTile(item.room, 0);
101+
props.roomSubList.sortList();
102+
}
92103
}
93104
},
94105
};

‎src/skins/vector/views/organisms/RoomList.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module.exports = React.createClass({
5454
<RoomSubList list={ this.state.lists['favourites'] }
5555
label="Favourites"
5656
tagname="favourites"
57+
verb="favourite"
5758
editable={ true }
5859
order="manual"
5960
activityMap={ this.state.activityMap }
@@ -68,9 +69,10 @@ module.exports = React.createClass({
6869
selectedRoom={ this.props.selectedRoom }
6970
collapsed={ this.props.collapsed } />
7071

71-
<RoomSubList list={ this.state.lists['lurking'] }
72-
label="Others"
73-
tagname="secondary"
72+
<RoomSubList list={ this.state.lists['hidden'] }
73+
label="Hidden"
74+
tagname="hidden"
75+
verb="hide"
7476
editable={ true }
7577
order="recent"
7678
activityMap={ this.state.activityMap }

‎src/skins/vector/views/organisms/RoomSubList.js‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var RoomSubList = React.createClass({
6363
},
6464

6565
componentWillMount: function() {
66-
this.sortList(this.props.list, this.props.order);
66+
this.sortList();
6767
},
6868

6969
componentWillReceiveProps: function(newProps) {
@@ -94,6 +94,8 @@ var RoomSubList = React.createClass({
9494
},
9595

9696
sortList: function(list, order) {
97+
if (list === undefined) list = this.props.list;
98+
if (order === undefined) order = this.props.order;
9799
var comparator;
98100
list = list || [];
99101
if (order === "manual") comparator = this.manualComparator;
@@ -178,11 +180,17 @@ var RoomSubList = React.createClass({
178180

179181
//console.log("render: " + JSON.stringify(this.state.sortedList));
180182

183+
var target;
184+
if (this.state.sortedList.length == 0 && this.props.editable) {
185+
target = <RoomDropTarget label={ 'Drop here to ' + this.props.verb }/>;
186+
}
187+
181188
if (this.state.sortedList.length > 0 || this.props.editable) {
182189
return connectDropTarget(
183190
<div>
184191
<h2 className="mx_RoomSubList_label">{ this.props.collapsed ? '' : this.props.label }</h2>
185192
<div className="mx_RoomSubList">
193+
{ target }
186194
{ this.makeRoomTiles() }
187195
</div>
188196
</div>

0 commit comments

Comments
 (0)