Skip to content

Commit c8caf34

Browse files
committed
Merge branch 'vector' into irc-style-commands
2 parents 1126769 + 891ba40 commit c8caf34

16 files changed

Lines changed: 211 additions & 32 deletions

File tree

‎skins/base/css/common.css‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ div.error {
2828
}
2929

3030
h2 {
31+
color: #80cef4;
3132
font-weight: 400;
3233
font-size: 20px;
3334
margin-top: 16px;

‎skins/base/css/molecules/RoomHeader.css‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ limitations under the License.
2727
display: -moz-box;
2828
display: -ms-flexbox;
2929
display: -webkit-flex;
30-
display: flex;
30+
display: flex;
3131
}
3232

3333
.mx_RoomHeader_leftRow {
34-
display: table-row;
3534
height: 48px;
3635

3736
-webkit-box-ordinal-group: 1;
@@ -44,7 +43,6 @@ limitations under the License.
4443
}
4544

4645
.mx_RoomHeader_rightRow {
47-
display: table-row;
4846
height: 48px;
4947
background-color: #fff;
5048
border-radius: 48px;
@@ -88,6 +86,7 @@ limitations under the License.
8886

8987
.mx_RoomHeader_avatar {
9088
display: table-cell;
89+
width: 48px;
9190
height: 50px;
9291
vertical-align: middle;
9392
}

‎skins/base/css/molecules/RoomTile.css‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,35 @@ limitations under the License.
2929
padding-top: 3px;
3030
padding-bottom: 3px;
3131
vertical-align: middle;
32-
width: 32px;
33-
height: 32px;
32+
width: 40px;
33+
height: 40px;
3434
}
3535

3636
.mx_RoomTile_avatar img {
3737
border-radius: 20px;
3838
background-color: #dbdbdb;
3939
}
4040

41+
.mx_RoomTile_nameBadge {
42+
display: table;
43+
width: 100%;
44+
height: 50px;
45+
}
46+
4147
.mx_RoomTile_name {
4248
display: table-cell;
4349
vertical-align: middle;
4450
overflow: hidden;
4551
text-overflow: ellipsis;
4652
}
4753

54+
.mx_RoomTile_badgeCell {
55+
display: table-cell;
56+
vertical-align: middle;
57+
width: 26px;
58+
}
59+
4860
.mx_RoomTile_badge {
49-
float: right;
5061
background-color: #80cef4;
5162
color: #fff;
5263
border-radius: 26px;

‎skins/base/css/organisms/LeftPanel.css‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ limitations under the License.
4444
padding-left: 16px;
4545
padding-right: 16px;
4646

47-
/* background-color: #0ff; */
4847
height: 100%;
4948
overflow-y: scroll;
5049
}

‎skins/base/css/organisms/RoomView.css‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ limitations under the License.
6464
width: 100%;
6565
height: 100%;
6666
margin-bottom: 60px;
67-
/* background-color: #ff0; */
6867

6968
overflow-y: scroll;
7069
}
@@ -78,6 +77,14 @@ limitations under the License.
7877
width: 100%;
7978
}
8079

80+
.mx_RoomView_MessageList h2 {
81+
clear: both;
82+
margin-top: 32px;
83+
margin-bottom: 8px;
84+
padding-bottom: 6px;
85+
border-bottom: 1px solid #a8dbf3;
86+
}
87+
8188
.mx_RoomView_invitePrompt {
8289
}
8390

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
'use strict';
18+
19+
var React = require('react');
20+
21+
var days = [
22+
"Sunday",
23+
"Monday",
24+
"Tuesday",
25+
"Wednesday",
26+
"Thursday",
27+
"Friday",
28+
"Saturday"
29+
];
30+
31+
module.exports = React.createClass({
32+
displayName: 'DateSeparator',
33+
render: function() {
34+
var date = new Date(this.props.ts);
35+
var today = new Date();
36+
var yesterday = new Date();
37+
yesterday.setDate(today.getDate() - 1);
38+
var label;
39+
if (date.toDateString() === today.toDateString()) {
40+
label = "Today";
41+
}
42+
else if (date.toDateString() === yesterday.toDateString()) {
43+
label = "Yesterday";
44+
}
45+
else if (today.getTime() - date.getTime() < 6 * 24 * 60 * 60 * 1000) {
46+
label = days[date.getDay()];
47+
}
48+
else {
49+
label = date.toDateString();
50+
}
51+
52+
return (
53+
<h2>{ label }</h2>
54+
);
55+
}
56+
});

‎skins/base/views/molecules/MRoomMemberTile.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,14 @@ module.exports = React.createClass({
5252

5353
render: function() {
5454
// XXX: for now, just cheekily borrow the css from message tile...
55+
var timestamp = this.props.last ? <MessageTimestamp ts={this.props.mxEvent.getTs()} /> : null;
56+
5557
return (
5658
<div className="mx_MessageTile">
5759
<div className="mx_MessageTile_avatar">
5860
<img src={ this.props.mxEvent.target ? MatrixClientPeg.get().getAvatarUrlForMember(this.props.mxEvent.target, 40, 40, "crop") : null } width="40" height="40"/>
5961
</div>
60-
<MessageTimestamp ts={this.props.mxEvent.getTs()} />
62+
{ timestamp }
6163
<span className="mx_SenderProfile"></span>
6264
<span className="mx_MessageTile_content">
6365
{this.getMemberEventText()}

‎skins/base/views/molecules/RoomHeader.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,20 @@ limitations under the License.
1717
'use strict';
1818

1919
var React = require('react');
20+
var ComponentBroker = require('../../../../src/ComponentBroker');
2021

2122
var MatrixClientPeg = require("../../../../src/MatrixClientPeg");
2223
var RoomHeaderController = require("../../../../src/controllers/molecules/RoomHeader");
24+
var EditableText = ComponentBroker.get("atoms/EditableText");
2325

2426
module.exports = React.createClass({
2527
displayName: 'RoomHeader',
2628
mixins: [RoomHeaderController],
2729

30+
onNameChange: function(new_name) {
31+
MatrixClientPeg.get().setRoomName(this.props.room.roomId, new_name);
32+
},
33+
2834
render: function() {
2935

3036
var topic = this.props.room.currentState.getStateEvents('m.room.topic', '');
@@ -52,7 +58,9 @@ module.exports = React.createClass({
5258
<img src={ MatrixClientPeg.get().getAvatarUrlForRoom(this.props.room, 48, 48, "crop") } width="48" height="48"/>
5359
</div>
5460
<div className="mx_RoomHeader_info">
55-
<div className="mx_RoomHeader_name">{ this.props.room.name }</div>
61+
<div className="mx_RoomHeader_name">
62+
<EditableText initalValue={this.props.room.name} onValueChanged={this.onNameChange} />
63+
</div>
5664
{ topic }
5765
</div>
5866
</div>
@@ -76,4 +84,3 @@ module.exports = React.createClass({
7684
);
7785
},
7886
});
79-

‎skins/base/views/molecules/RoomTile.js‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,17 @@ module.exports = React.createClass({
4343
else if (this.props.unread) {
4444
badge = <div className="mx_RoomTile_badge">1</div>;
4545
}
46+
var nameCell;
47+
if (badge) {
48+
nameCell = <div className="mx_RoomTile_nameBadge"><div className="mx_RoomTile_name">{name}</div><div className="mx_RoomTile_badgeCell">{badge}</div></div>;
49+
}
50+
else {
51+
nameCell = <div className="mx_RoomTile_name">{name}</div>;
52+
}
4653
return (
4754
<div className={classes} onClick={this.onClick}>
4855
<div className="mx_RoomTile_avatar"><img src={ MatrixClientPeg.get().getAvatarUrlForRoom(this.props.room, 40, 40, "crop") } width="40" height="40"/></div>
49-
<div className="mx_RoomTile_name">{name}{ badge }</div>
56+
{ nameCell }
5057
</div>
5158
);
5259
}

‎skins/base/views/templates/Login.js‎

Lines changed: 68 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ limitations under the License.
1919
var React = require('react');
2020

2121
var ComponentBroker = require("../../../../src/ComponentBroker");
22+
var MatrixClientPeg = require("../../../../src/MatrixClientPeg");
2223

2324
var ProgressBar = ComponentBroker.get("molecules/ProgressBar");
2425
var Loader = require("react-loader");
@@ -28,15 +29,44 @@ var LoginController = require("../../../../src/controllers/templates/Login");
2829
var ServerConfig = ComponentBroker.get("molecules/ServerConfig");
2930

3031
module.exports = React.createClass({
32+
DEFAULT_HS_URL: 'https://matrix.org',
33+
DEFAULT_IS_URL: 'https://matrix.org',
34+
3135
displayName: 'Login',
3236
mixins: [LoginController],
3337

38+
getInitialState: function() {
39+
return {
40+
serverConfigVisible: false
41+
};
42+
},
43+
44+
componentWillMount: function() {
45+
this.onHSChosen();
46+
this.customHsUrl = this.DEFAULT_HS_URL;
47+
this.customIsUrl = this.DEFAULT_IS_URL;
48+
},
49+
3450
getHsUrl: function() {
35-
return this.refs.serverConfig.getHsUrl();
51+
if (this.state.serverConfigVisible) {
52+
return this.customHsUrl;
53+
} else {
54+
return this.DEFAULT_HS_URL;
55+
}
3656
},
3757

3858
getIsUrl: function() {
39-
return this.refs.serverConfig.getIsUrl();
59+
if (this.state.serverConfigVisible) {
60+
return this.customIsUrl;
61+
} else {
62+
return this.DEFAULT_IS_URL;
63+
}
64+
},
65+
66+
onServerConfigVisibleChange: function(ev) {
67+
this.setState({
68+
serverConfigVisible: ev.target.checked
69+
}, this.onHsUrlChanged);
4070
},
4171

4272
/**
@@ -49,15 +79,46 @@ module.exports = React.createClass({
4979
};
5080
},
5181

82+
onHsUrlChanged: function() {
83+
this.customHsUrl = this.refs.serverConfig.getHsUrl();
84+
this.customIsUrl = this.refs.serverConfig.getIsUrl();
85+
MatrixClientPeg.replaceUsingUrls(
86+
this.getHsUrl(),
87+
this.getIsUrl()
88+
);
89+
this.setState({
90+
hs_url: this.getHsUrl(),
91+
is_url: this.getIsUrl()
92+
});
93+
// XXX: HSes do not have to offer password auth, so we
94+
// need to update and maybe show a different component
95+
// when a new HS is entered.
96+
/*if (this.updateHsTimeout) {
97+
clearTimeout(this.updateHsTimeout);
98+
}
99+
var self = this;
100+
this.updateHsTimeout = setTimeout(function() {
101+
self.onHSChosen();
102+
}, 500);*/
103+
},
104+
52105
componentForStep: function(step) {
53106
switch (step) {
54107
case 'choose_hs':
108+
var serverConfigStyle = {};
109+
if (!this.state.serverConfigVisible) {
110+
serverConfigStyle.display = 'none';
111+
}
55112
return (
56113
<div>
57-
<form onSubmit={this.onHSChosen}>
58-
<ServerConfig ref="serverConfig" />
59-
<input type="submit" value="Continue" />
60-
</form>
114+
<input type="checkbox" value={this.state.serverConfigVisible} onChange={this.onServerConfigVisibleChange} />
115+
Use custom server options (advanced)
116+
<div style={serverConfigStyle}>
117+
<ServerConfig ref="serverConfig"
118+
defaultHsUrl={this.customHsUrl} defaultIsUrl={this.customIsUrl}
119+
onHsUrlChanged={this.onHsUrlChanged}
120+
/>
121+
</div>
61122
</div>
62123
);
63124
// XXX: clearly these should be separate organisms
@@ -67,6 +128,7 @@ module.exports = React.createClass({
67128
<form onSubmit={this.onUserPassEntered}>
68129
<input ref="user" type="text" placeholder="username" /><br />
69130
<input ref="pass" type="password" placeholder="password" /><br />
131+
{this.componentForStep('choose_hs')}
70132
<input type="submit" value="Log in" />
71133
</form>
72134
</div>
@@ -94,7 +156,6 @@ module.exports = React.createClass({
94156
render: function() {
95157
return (
96158
<div className="mx_Login">
97-
<ProgressBar value={this.state.currentStep} max={this.state.totalSteps} />
98159
{this.loginContent()}
99160
</div>
100161
);

0 commit comments

Comments
 (0)