Basic structure of user settings

This commit is contained in:
Erik Johnston 2015-07-15 15:04:24 +01:00
parent 844a883ad8
commit dfd54f3b95
5 changed files with 42 additions and 10 deletions

View file

@ -38,7 +38,7 @@ limitations under the License.
height: 100%; height: 100%;
} }
.mx_MatrixChat .mx_RoomView { .mx_MatrixChat .mx_MainView {
-webkit-box-ordinal-group: 2; -webkit-box-ordinal-group: 2;
-moz-box-ordinal-group: 2; -moz-box-ordinal-group: 2;
-ms-flex-order: 2; -ms-flex-order: 2;

View file

@ -19,6 +19,8 @@ limitations under the License.
var React = require('react'); var React = require('react');
var classNames = require('classnames'); var classNames = require('classnames');
var dis = require("../../../../src/dispatcher");
//var DirectoryMenuController = require("../../../../src/controllers/molecules/DirectoryMenuController"); //var DirectoryMenuController = require("../../../../src/controllers/molecules/DirectoryMenuController");
var MatrixClientPeg = require("../../../../src/MatrixClientPeg"); var MatrixClientPeg = require("../../../../src/MatrixClientPeg");
@ -26,6 +28,11 @@ var MatrixClientPeg = require("../../../../src/MatrixClientPeg");
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'DirectoryMenu', displayName: 'DirectoryMenu',
// mixins: [DirectoryMenuController], // mixins: [DirectoryMenuController],
onSettingsClick: function() {
dis.dispatch({action: 'view_user_settings'});
},
render: function() { render: function() {
return ( return (
<div className="mx_DirectoryMenu"> <div className="mx_DirectoryMenu">
@ -42,7 +49,7 @@ module.exports = React.createClass({
</div> </div>
<div className="mx_RoomTile_name">Directory</div> <div className="mx_RoomTile_name">Directory</div>
</div> </div>
<div className="mx_RoomTile"> <div className="mx_RoomTile" onClick={this.onSettingsClick}>
<div className="mx_RoomTile_avatar"> <div className="mx_RoomTile_avatar">
<img src="img/settings-big.png" width="42" height="42"/> <img src="img/settings-big.png" width="42" height="42"/>
</div> </div>

View file

@ -23,6 +23,7 @@ var LeftPanel = ComponentBroker.get('organisms/LeftPanel');
var RoomView = ComponentBroker.get('organisms/RoomView'); var RoomView = ComponentBroker.get('organisms/RoomView');
var RightPanel = ComponentBroker.get('organisms/RightPanel'); var RightPanel = ComponentBroker.get('organisms/RightPanel');
var Login = ComponentBroker.get('templates/Login'); var Login = ComponentBroker.get('templates/Login');
var UserSettings = ComponentBroker.get('organisms/UserSettings');
var MatrixChatController = require("../../../../src/controllers/pages/MatrixChat"); var MatrixChatController = require("../../../../src/controllers/pages/MatrixChat");
@ -36,11 +37,24 @@ module.exports = React.createClass({
render: function() { render: function() {
if (this.state.logged_in && this.state.ready) { if (this.state.logged_in && this.state.ready) {
var page_element;
var right_panel = "";
if (this.state.page_type == this.PageTypes.RoomView) {
page_element = <RoomView roomId={this.state.currentRoom} key={this.state.currentRoom} />
right_panel = <RightPanel roomId={this.state.currentRoom} />
} else if (this.state.page_type == this.PageTypes.UserSettings) {
page_element = <UserSettings />
}
return ( return (
<div className="mx_MatrixChat"> <div className="mx_MatrixChat">
<LeftPanel selectedRoom={this.state.currentRoom} /> <LeftPanel selectedRoom={this.state.currentRoom} />
<RoomView roomId={this.state.currentRoom} key={this.state.currentRoom} /> <div className="mx_MainView">
<RightPanel roomId={this.state.currentRoom} /> {page_element}
</div>
{right_panel}
</div> </div>
); );
} else if (this.state.logged_in) { } else if (this.state.logged_in) {
@ -54,4 +68,3 @@ module.exports = React.createClass({
} }
} }
}); });

View file

@ -88,6 +88,7 @@ require('../skins/base/views/templates/Login');
require('../skins/base/views/organisms/Notifier'); require('../skins/base/views/organisms/Notifier');
require('../skins/base/views/organisms/CreateRoom'); require('../skins/base/views/organisms/CreateRoom');
require('../skins/base/views/molecules/UserSelector'); require('../skins/base/views/molecules/UserSelector');
require('../skins/base/views/organisms/UserSettings');
// new for vector // new for vector
require('../skins/base/views/organisms/LeftPanel'); require('../skins/base/views/organisms/LeftPanel');
require('../skins/base/views/organisms/RightPanel'); require('../skins/base/views/organisms/RightPanel');

View file

@ -29,10 +29,16 @@ var ComponentBroker = require('../../ComponentBroker');
var Notifier = ComponentBroker.get('organisms/Notifier'); var Notifier = ComponentBroker.get('organisms/Notifier');
module.exports = { module.exports = {
PageTypes: {
RoomView: "room_view",
UserSettings: "user_settings",
},
getInitialState: function() { getInitialState: function() {
return { return {
logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials), logged_in: !!(MatrixClientPeg.get() && MatrixClientPeg.get().credentials),
ready: false ready: false,
page_type: this.PageTypes.RoomView,
}; };
}, },
@ -74,7 +80,8 @@ module.exports = {
case 'view_room': case 'view_room':
this.focusComposer = true; this.focusComposer = true;
this.setState({ this.setState({
currentRoom: payload.room_id currentRoom: payload.room_id,
page_type: this.PageTypes.RoomView,
}); });
break; break;
case 'view_prev_room': case 'view_prev_room':
@ -95,6 +102,11 @@ module.exports = {
currentRoom: allRooms[roomIndex].roomId currentRoom: allRooms[roomIndex].roomId
}); });
break; break;
case 'view_user_settings':
this.setState({
page_type: this.PageTypes.UserSettings,
});
break;
} }
}, },
@ -139,4 +151,3 @@ module.exports = {
dis.dispatch({action: 'focus_composer'}); dis.dispatch({action: 'focus_composer'});
} }
}; };