Skip to content

Commit 23c93de

Browse files
committed
Merge branch 'develop' into matthew/orderable-roomlist
2 parents bea6408 + 752f8bd commit 23c93de

10 files changed

Lines changed: 133 additions & 23 deletions

File tree

‎src/controllers/organisms/RoomView.js‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,12 @@ module.exports = {
350350
self.setState({
351351
upload: undefined
352352
});
353-
}).done(undefined, function() {
354-
// TODO: display error message
353+
}).done(undefined, function(error) {
354+
var ErrorDialog = sdk.getComponent("organisms.ErrorDialog");
355+
Modal.createDialog(ErrorDialog, {
356+
title: "Failed to upload file",
357+
description: error.toString()
358+
});
355359
});
356360
},
357361

@@ -377,6 +381,7 @@ module.exports = {
377381
room_events: {
378382
search_term: term,
379383
filter: filter,
384+
order_by: "recent",
380385
event_context: {
381386
before_limit: 1,
382387
after_limit: 1,
@@ -390,7 +395,11 @@ module.exports = {
390395
searchResults: data,
391396
});
392397
}, function(error) {
393-
// TODO: show dialog or something
398+
var ErrorDialog = sdk.getComponent("organisms.ErrorDialog");
399+
Modal.createDialog(ErrorDialog, {
400+
title: "Search failed",
401+
description: error.toString()
402+
});
394403
});
395404
},
396405

@@ -408,7 +417,7 @@ module.exports = {
408417
var eventIds = Object.keys(results);
409418
// XXX: todo: merge overlapping results somehow?
410419
// XXX: why doesn't searching on name work?
411-
var resultList = eventIds.map(function(key) { return results[key]; }).sort(function(a, b) { b.rank - a.rank });
420+
var resultList = eventIds.map(function(key) { return results[key]; }); // .sort(function(a, b) { b.rank - a.rank });
412421
for (var i = 0; i < resultList.length; i++) {
413422
var ts1 = resultList[i].result.origin_server_ts;
414423
ret.push(<li key={ts1 + "-search"}><DateSeparator ts={ts1}/></li>); // Rank: {resultList[i].rank}

‎src/skins/vector/css/atoms/MemberAvatar.css‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@ limitations under the License.
1919
border-radius: 20px;
2020
}
2121

22+
.mx_MemberAvatar_initial {
23+
position: absolute;
24+
color: #fff;
25+
text-align: center;
26+
}
27+
28+
.mx_MemberAvatar_wrapper {
29+
position: relative;
30+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Copyright 2015 OpenMarket Ltd
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
.mx_RoomAvatar {
18+
}
19+
20+
.mx_RoomAvatar_initial {
21+
position: absolute;
22+
color: #fff;
23+
text-align: center;
24+
font-weight: normal ! important;
25+
}

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

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,40 @@ limitations under the License.
1515
*/
1616

1717
.mx_MatrixToolbar {
18-
text-align: center;
19-
background-color: #ff0064;
18+
background-color: #76cfa6;
2019
color: #fff;
21-
font-weight: bold;
22-
padding: 6px;
20+
21+
display: -webkit-box;
22+
display: -moz-box;
23+
display: -ms-flexbox;
24+
display: -webkit-flex;
25+
display: flex;
26+
-webkit-align-items: center;
27+
align-items: center;
2328
}
2429

25-
.mx_MatrixToolbar button {
26-
margin-left: 12px;
30+
.mx_MatrixToolbar_warning {
31+
margin-left: 16px;
32+
margin-right: 8px;
33+
margin-top: -2px;
34+
}
35+
36+
.mx_MatrixToolbar_link
37+
{
38+
color: #fff ! important;
39+
text-decoration: underline ! important;
40+
cursor: pointer;
2741
}
2842

2943
.mx_MatrixToolbar_close {
30-
float: right;
31-
margin-top: 3px;
32-
margin-right: 12px;
44+
-webkit-flex: 1;
45+
flex: 1;
3346
cursor: pointer;
34-
}
47+
text-align: right;
48+
}
49+
50+
.mx_MatrixToolbar_close img {
51+
display: block;
52+
float: right;
53+
margin-right: 10px;
54+
}

‎src/skins/vector/css/pages/MatrixChat.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ limitations under the License.
3535
-webkit-order: 1;
3636
order: 1;
3737

38-
height: 21px;
38+
height: 40px;
3939
}
4040

4141
.mx_MatrixChat_toolbarShowing {
1.15 KB
Loading

‎src/skins/vector/img/warning.png‎

1.44 KB
Loading

‎src/skins/vector/views/atoms/MemberAvatar.js‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ module.exports = React.createClass({
4040
},
4141

4242
render: function() {
43+
// XXX: recalculates default avatar url constantly
44+
if (this.state.imageUrl === this.defaultAvatarUrl(this.props.member)) {
45+
var initial;
46+
if (this.props.member.name[0])
47+
initial = this.props.member.name[0].toUpperCase();
48+
if (initial === '@' && this.props.member.name[1])
49+
initial = this.props.member.name[1].toUpperCase();
50+
51+
return (
52+
<span className="mx_MemberAvatar_wrapper">
53+
<span className="mx_MemberAvatar_initial"
54+
style={{ fontSize: (this.props.width * 0.75) + "px",
55+
width: this.props.width + "px",
56+
lineHeight: this.props.height*1.2 + "px" }}>{ initial }</span>
57+
<img className="mx_MemberAvatar" src={this.state.imageUrl}
58+
onError={this.onError} width={this.props.width} height={this.props.height} />
59+
</span>
60+
);
61+
}
4362
return (
4463
<img className="mx_MemberAvatar" src={this.state.imageUrl}
4564
onError={this.onError}

‎src/skins/vector/views/atoms/RoomAvatar.js‎

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,32 @@ module.exports = React.createClass({
4444
render: function() {
4545
var style = {
4646
width: this.props.width,
47-
weight: this.props.height,
47+
height: this.props.height,
4848
};
49-
return (
50-
<img className="mx_RoomAvatar" src={this.state.imageUrl} onError={this.onError}
51-
style={style}
52-
/>
53-
);
49+
50+
// XXX: recalculates fallback avatar constantly
51+
if (this.state.imageUrl === this.getFallbackAvatar()) {
52+
var initial;
53+
if (this.props.room.name[0])
54+
initial = this.props.room.name[0].toUpperCase();
55+
if ((initial === '@' || initial === '#') && this.props.room.name[1])
56+
initial = this.props.room.name[1].toUpperCase();
57+
58+
return (
59+
<span>
60+
<span className="mx_RoomAvatar_initial"
61+
style={{ fontSize: (this.props.width * 0.75) + "px",
62+
width: this.props.width + "px",
63+
lineHeight: this.props.height*1.2 + "px" }}>{ initial }</span>
64+
<img className="mx_RoomAvatar" src={this.state.imageUrl}
65+
onError={this.onError} style={style} />
66+
</span>
67+
);
68+
}
69+
else {
70+
return <img className="mx_RoomAvatar" src={this.state.imageUrl}
71+
onError={this.onError} style={style} />
72+
}
73+
5474
}
5575
});

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,20 @@ module.exports = React.createClass({
2828
Notifier.setToolbarHidden(true);
2929
},
3030

31+
onClick: function() {
32+
var Notifier = sdk.getComponent('organisms.Notifier');
33+
Notifier.setEnabled(true);
34+
},
35+
3136
render: function() {
3237
var EnableNotificationsButton = sdk.getComponent("atoms.EnableNotificationsButton");
3338
return (
3439
<div className="mx_MatrixToolbar">
35-
You are not receiving desktop notifications. <EnableNotificationsButton />
36-
<div className="mx_MatrixToolbar_close"><img src="img/close-white.png" width="16" height="16" onClick={ this.hideToolbar } /></div>
40+
<img className="mx_MatrixToolbar_warning" src="img/warning.png" width="28" height="28" alt="/!\"/>
41+
<div>
42+
You are not receiving desktop notifications. <a className="mx_MatrixToolbar_link" onClick={ this.onClick }>Enable them now</a>
43+
</div>
44+
<div className="mx_MatrixToolbar_close"><img src="img/cancel-black2.png" width="23" height="23" onClick={ this.hideToolbar } /></div>
3745
</div>
3846
);
3947
}

0 commit comments

Comments
 (0)