Skip to content

Commit d2b0ddf

Browse files
author
Emmanouil Konstantinidis
committed
Initialize settings page
1 parent b92ec32 commit d2b0ddf

File tree

5 files changed

+74
-1
lines changed

5 files changed

+74
-1
lines changed

src/js/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ var Navigation = require('./components/navigation');
66
var Footer = require('./components/footer');
77
var LoginPage = require('./components/login');
88
var NotificationsPage = require('./components/notifications');
9+
var SettingsPage = require('./components/settings');
910

1011
var Route = Router.Route;
1112
var NotFoundRoute = Router.NotFoundRoute;
@@ -42,8 +43,9 @@ var NotFound = React.createClass({
4243
var routes = (
4344
<Route handler={App} path="/">
4445
<DefaultRoute handler={NotificationsPage} />
45-
<Route name="notifications" handler={NotificationsPage}/>
4646
<Route name="login" handler={LoginPage}/>
47+
<Route name="notifications" handler={NotificationsPage}/>
48+
<Route name="settings" handler={SettingsPage}/>
4749
<NotFoundRoute handler={NotFound}/>
4850
</Route>
4951
);

src/js/components/navigation.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ var Navigation = React.createClass({
4242
this.setState( {loading: false } );
4343
},
4444

45+
goToSettings: function () {
46+
this.context.router.transitionTo('settings');
47+
},
48+
4549
logOut: function () {
4650
Actions.logout();
4751
this.context.router.transitionTo('login');
@@ -74,6 +78,7 @@ var Navigation = React.createClass({
7478
</div>
7579
<div className='col-xs-4 right'>
7680
{logoutIcon}
81+
<i className='fa fa-cog' onClick={this.goToSettings} />
7782
<i className="fa fa-power-off" onClick={this.appQuit} />
7883
</div>
7984
</div>

src/js/components/settings.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var React = require('react');
2+
var Reflux = require('reflux');
3+
4+
var SettingsStore = require('../stores/settings');
5+
6+
var SettingsPage = React.createClass({
7+
mixins: [
8+
Reflux.connect(SettingsStore, 'settings'),
9+
],
10+
11+
getInitialState: function() {
12+
return {
13+
settings: undefined
14+
};
15+
},
16+
17+
render: function () {
18+
return (
19+
<div className="container-fluid main-container settings">
20+
<div className='row'>
21+
<div className='col-xs-8'>Setting Title</div>
22+
<div className='col-xs-4'>Value</div>
23+
</div>
24+
</div>
25+
);
26+
}
27+
});
28+
29+
module.exports = SettingsPage;

src/js/stores/settings.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var Reflux = require('reflux');
2+
var Actions = require('../actions/actions');
3+
4+
var SettingsStore = Reflux.createStore({
5+
listenables: Actions,
6+
7+
init: function () {
8+
var settings = window.localStorage.getItem('settings') || {
9+
participating: false
10+
};
11+
var participatingSetting = settings.participating || false;
12+
this._settings = {
13+
participating: participatingSetting
14+
};
15+
},
16+
17+
onGetSettings: function () {
18+
return this._settings;
19+
},
20+
21+
onSetSettings: function (setting, value) {
22+
console.log('Setting: ' + setting + ' to: ' + value);
23+
}
24+
25+
});
26+
27+
module.exports = SettingsStore;

src/less/style.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ html, body {
226226
/* @end Navbar */
227227

228228

229+
/* @group Settings */
230+
231+
.settings {
232+
background-color: @ThemeBlack;
233+
color: @White;
234+
}
235+
236+
/* @end Settings */
237+
238+
229239
/* @group Component / Login */
230240

231241
.login {

0 commit comments

Comments
 (0)