Skip to content

Commit dfd54f3

Browse files
committed
Basic structure of user settings
1 parent 844a883 commit dfd54f3

5 files changed

Lines changed: 42 additions & 10 deletions

File tree

‎skins/base/css/pages/MatrixChat.css‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ limitations under the License.
3838
height: 100%;
3939
}
4040

41-
.mx_MatrixChat .mx_RoomView {
41+
.mx_MatrixChat .mx_MainView {
4242
-webkit-box-ordinal-group: 2;
4343
-moz-box-ordinal-group: 2;
4444
-ms-flex-order: 2;
@@ -47,7 +47,7 @@ limitations under the License.
4747

4848
background-color: #f3f8fa;
4949
width: 100%;
50-
height: 100%;
50+
height: 100%;
5151
}
5252

5353
.mx_MatrixChat .mx_RightPanel {
@@ -60,5 +60,5 @@ limitations under the License.
6060
background-color: #f3f8fa;
6161
-webkit-flex: 0 0 230px;
6262
flex: 0 0 230px;
63-
height: 100%;
63+
height: 100%;
6464
}

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,20 @@ limitations under the License.
1919
var React = require('react');
2020
var classNames = require('classnames');
2121

22+
var dis = require("../../../../src/dispatcher");
23+
2224
//var DirectoryMenuController = require("../../../../src/controllers/molecules/DirectoryMenuController");
2325

2426
var MatrixClientPeg = require("../../../../src/MatrixClientPeg");
2527

2628
module.exports = React.createClass({
2729
displayName: 'DirectoryMenu',
2830
// mixins: [DirectoryMenuController],
31+
32+
onSettingsClick: function() {
33+
dis.dispatch({action: 'view_user_settings'});
34+
},
35+
2936
render: function() {
3037
return (
3138
<div className="mx_DirectoryMenu">
@@ -42,7 +49,7 @@ module.exports = React.createClass({
4249
</div>
4350
<div className="mx_RoomTile_name">Directory</div>
4451
</div>
45-
<div className="mx_RoomTile">
52+
<div className="mx_RoomTile" onClick={this.onSettingsClick}>
4653
<div className="mx_RoomTile_avatar">
4754
<img src="img/settings-big.png" width="42" height="42"/>
4855
</div>

‎skins/base/views/pages/MatrixChat.js‎

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var LeftPanel = ComponentBroker.get('organisms/LeftPanel');
2323
var RoomView = ComponentBroker.get('organisms/RoomView');
2424
var RightPanel = ComponentBroker.get('organisms/RightPanel');
2525
var Login = ComponentBroker.get('templates/Login');
26+
var UserSettings = ComponentBroker.get('organisms/UserSettings');
2627

2728
var MatrixChatController = require("../../../../src/controllers/pages/MatrixChat");
2829

@@ -36,11 +37,24 @@ module.exports = React.createClass({
3637

3738
render: function() {
3839
if (this.state.logged_in && this.state.ready) {
40+
41+
var page_element;
42+
var right_panel = "";
43+
44+
if (this.state.page_type == this.PageTypes.RoomView) {
45+
page_element = <RoomView roomId={this.state.currentRoom} key={this.state.currentRoom} />
46+
right_panel = <RightPanel roomId={this.state.currentRoom} />
47+
} else if (this.state.page_type == this.PageTypes.UserSettings) {
48+
page_element = <UserSettings />
49+
}
50+
3951
return (
4052
<div className="mx_MatrixChat">
4153
<LeftPanel selectedRoom={this.state.currentRoom} />
42-
<RoomView roomId={this.state.currentRoom} key={this.state.currentRoom} />
43-
<RightPanel roomId={this.state.currentRoom} />
54+
<div className="mx_MainView">
55+
{page_element}
56+
</div>
57+
{right_panel}
4458
</div>
4559
);
4660
} else if (this.state.logged_in) {
@@ -54,4 +68,3 @@ module.exports = React.createClass({
5468
}
5569
}
5670
});
57-

‎src/ComponentBroker.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ require('../skins/base/views/templates/Login');
8888
require('../skins/base/views/organisms/Notifier');
8989
require('../skins/base/views/organisms/CreateRoom');
9090
require('../skins/base/views/molecules/UserSelector');
91+
require('../skins/base/views/organisms/UserSettings');
9192
// new for vector
9293
require('../skins/base/views/organisms/LeftPanel');
9394
require('../skins/base/views/organisms/RightPanel');

‎src/controllers/pages/MatrixChat.js‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,16 @@ var ComponentBroker = require('../../ComponentBroker');
2929
var Notifier = ComponentBroker.get('organisms/Notifier');
3030

3131
module.exports = {
32+
PageTypes: {
33+
RoomView: "room_view",
34+
UserSettings: "user_settings",
35+
},
36+
3237
getInitialState: function() {
3338
return {
3439
logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials),
35-
ready: false
40+
ready: false,
41+
page_type: this.PageTypes.RoomView,
3642
};
3743
},
3844

@@ -74,7 +80,8 @@ module.exports = {
7480
case 'view_room':
7581
this.focusComposer = true;
7682
this.setState({
77-
currentRoom: payload.room_id
83+
currentRoom: payload.room_id,
84+
page_type: this.PageTypes.RoomView,
7885
});
7986
break;
8087
case 'view_prev_room':
@@ -95,6 +102,11 @@ module.exports = {
95102
currentRoom: allRooms[roomIndex].roomId
96103
});
97104
break;
105+
case 'view_user_settings':
106+
this.setState({
107+
page_type: this.PageTypes.UserSettings,
108+
});
109+
break;
98110
}
99111
},
100112

@@ -139,4 +151,3 @@ module.exports = {
139151
dis.dispatch({action: 'focus_composer'});
140152
}
141153
};
142-

0 commit comments

Comments
 (0)