11var React = require ( 'react' ) ;
22var Reflux = require ( 'reflux' ) ;
3+ var Router = require ( 'react-router' ) ;
4+
35var ipc = window . require ( 'ipc' ) ;
46
57var Actions = require ( '../actions/actions' ) ;
68var AuthStore = require ( '../stores/auth' ) ;
79
810var Navigation = React . createClass ( {
911 mixins : [
12+ Router . State ,
1013 Reflux . connect ( AuthStore , 'authStatus' ) ,
1114 Reflux . listenTo ( Actions . getNotifications . completed , 'refreshDone' ) ,
1215 Reflux . listenTo ( Actions . getNotifications . failed , 'refreshDone' )
@@ -52,12 +55,16 @@ var Navigation = React.createClass({
5255 ipc . sendChannel ( 'update-icon' , 'IconPlain' ) ;
5356 } ,
5457
58+ goBack : function ( ) {
59+ this . context . router . transitionTo ( 'notifications' ) ;
60+ } ,
61+
5562 appQuit : function ( ) {
5663 ipc . sendChannel ( 'app-quit' ) ;
5764 } ,
5865
5966 render : function ( ) {
60- var refreshIcon , logoutIcon ;
67+ var refreshIcon , logoutIcon , backIcon , settingsIcon ;
6168 var loadingClass = this . state . loading ? 'fa fa-refresh fa-spin' : 'fa fa-refresh' ;
6269
6370 if ( this . state . authStatus ) {
@@ -67,18 +74,29 @@ var Navigation = React.createClass({
6774 logoutIcon = (
6875 < i className = 'fa fa-sign-out' onClick = { this . logOut } />
6976 ) ;
77+ settingsIcon = (
78+ < i className = 'fa fa-cog' onClick = { this . goToSettings } />
79+ ) ;
80+ }
81+ if ( this . getPath ( ) === '/settings' ) {
82+ backIcon = (
83+ < i onClick = { this . goBack } className = 'fa fa-chevron-left' />
84+ ) ;
7085 }
7186
7287 return (
7388 < div className = 'container-fluid' >
7489 < div className = 'row navigation' >
75- < div className = 'col-xs-4 left' > { refreshIcon } </ div >
90+ < div className = 'col-xs-4 left' >
91+ { backIcon }
92+ { refreshIcon }
93+ </ div >
7694 < div className = 'col-xs-4 logo' >
7795 < img className = 'img-responsive' src = 'images/logo-hor-white.png' />
7896 </ div >
7997 < div className = 'col-xs-4 right' >
8098 { logoutIcon }
81- < i className = 'fa fa-cog' onClick = { this . goToSettings } />
99+ { settingsIcon }
82100 < i className = "fa fa-power-off" onClick = { this . appQuit } />
83101 </ div >
84102 </ div >
0 commit comments