@@ -27,43 +27,62 @@ var Divider_1 = require('material-ui/Divider');
27
27
var more_vert_1 = require ( 'material-ui/svg-icons/navigation/more-vert' ) ;
28
28
var close_1 = require ( 'material-ui/svg-icons/navigation/close' ) ;
29
29
var origin = { horizontal : 'right' , vertical : 'top' } ;
30
- var default_1 = ( function ( _super ) {
31
- __extends ( default_1 , _super ) ;
32
- function default_1 ( ) {
30
+ var MenuLink = ( function ( _super ) {
31
+ __extends ( MenuLink , _super ) ;
32
+ function MenuLink ( ) {
33
33
_super . apply ( this , arguments ) ;
34
34
}
35
- default_1 . prototype . navOptions = function ( ) {
36
- var _a = this . props , routeToProgress = _a . routeToProgress , routeToPage = _a . routeToPage ;
35
+ MenuLink . prototype . render = function ( ) {
36
+ var _a = this . props , route = _a . route , title = _a . title ;
37
+ return React . createElement ( MenuItem_1 . default , { primaryText : title ? title : route , onTouchTap : this . props . routeTo . bind ( route ) , key : route } ) ;
38
+ } ;
39
+ MenuLink = __decorate ( [
40
+ react_redux_1 . connect ( null , function ( dispatch ) {
41
+ return {
42
+ routeTo : function ( route ) { return dispatch ( actions_1 . setRoute ( route ) ) ; }
43
+ } ;
44
+ } ) ,
45
+ __metadata ( 'design:paramtypes' , [ ] )
46
+ ] , MenuLink ) ;
47
+ return MenuLink ;
48
+ } ( React . Component ) ) ;
49
+ exports . MenuLink = MenuLink ;
50
+ var AppMenu = ( function ( _super ) {
51
+ __extends ( AppMenu , _super ) ;
52
+ function AppMenu ( ) {
53
+ _super . apply ( this , arguments ) ;
54
+ }
55
+ AppMenu . prototype . navOptions = function ( ) {
56
+ var routeToPage = this . props . routeToPage ;
37
57
switch ( this . props . route ) {
38
58
case 'final' :
39
59
case 'page' :
40
- return React . createElement ( "button" , { onTouchTap : routeToProgress } , " progress" ) ;
60
+ return React . createElement ( MenuLink , { route : ' progress' } ) ;
41
61
case 'progress' :
42
- return React . createElement ( "button" , { onTouchTap : routeToPage } , " page" ) ;
62
+ return React . createElement ( MenuItem_1 . default , { onTouchTap : routeToPage , primaryText : ' page' , key : 'page' } ) ;
43
63
default : return null ;
44
64
}
45
65
} ;
46
- default_1 . prototype . menuOptions = function ( ) {
47
- var _a = this . props , routeToProgress = _a . routeToProgress , routeToTutorials = _a . routeToTutorials ;
66
+ AppMenu . prototype . menuOptions = function ( ) {
48
67
switch ( this . props . route ) {
49
68
case 'final' :
50
69
case 'page' :
51
- return ( React . createElement ( "div" , null , React . createElement ( MenuItem_1 . default , { primaryText : 'progress' , onTouchTap : routeToProgress , key : 'progress' } ) , React . createElement ( MenuItem_1 . default , { primaryText : 'tutorials' , onTouchTap : routeToTutorials , key : 'projects '} ) ) ) ;
70
+ return ( React . createElement ( "div" , null , React . createElement ( MenuLink , { route : 'progress' } ) , React . createElement ( MenuLink , { route : 'tutorials' } ) ) ) ;
52
71
case 'progress' :
53
- return React . createElement ( MenuItem_1 . default , { primaryText : 'tutorials' , onTouchTap : routeToTutorials , key : 'projects '} ) ;
72
+ return React . createElement ( MenuLink , { route : 'tutorials' } ) ;
54
73
default : return null ;
55
74
}
56
75
} ;
57
- default_1 . prototype . closePanel = function ( ) {
76
+ AppMenu . prototype . closePanel = function ( ) {
58
77
render_1 . togglePanel ( ) ;
59
78
} ;
60
- default_1 . prototype . render = function ( ) {
79
+ AppMenu . prototype . render = function ( ) {
61
80
var quit = this . props . quit ;
62
81
return React . createElement ( AppBar_1 . default , { title : 'CodeRoad' , className : 'cr-menu-bar' , iconElementLeft : React . createElement ( IconButton_1 . default , { onClick : this . closePanel } , React . createElement ( close_1 . default , null ) ) , iconElementRight : React . createElement ( IconMenu_1 . default , { iconButtonElement : React . createElement ( IconButton_1 . default , null , React . createElement ( more_vert_1 . default , null ) ) , targetOrigin : origin , anchorOrigin : origin } , this . menuOptions ( ) , window . coderoad . issuesPath
63
82
? React . createElement ( MenuItem_1 . default , { key : 'issue' , className : 'link' } , React . createElement ( "a" , { href : window . coderoad . issuesPath } , "post issue" ) )
64
83
: null , React . createElement ( Divider_1 . default , null ) , React . createElement ( MenuItem_1 . default , { key : 'quit' , onClick : quit } , "quit" ) ) } ) ;
65
84
} ;
66
- default_1 = __decorate ( [
85
+ AppMenu = __decorate ( [
67
86
react_redux_1 . connect ( null , function ( dispatch ) {
68
87
return {
69
88
routeToProgress : function ( ) { return dispatch ( actions_1 . setRoute ( 'progress' ) ) ; } ,
@@ -72,16 +91,14 @@ var default_1 = (function (_super) {
72
91
dispatch ( actions_1 . setPage ( position ) ) ;
73
92
dispatch ( actions_1 . setRoute ( 'page' ) ) ;
74
93
} ,
75
- routeToTutorials : function ( ) { return dispatch ( actions_1 . setRoute ( 'tutorials' ) ) ; } ,
76
94
quit : function ( ) {
77
95
render_1 . togglePanel ( ) ;
78
96
subscriptions_1 . onDeactivate ( ) ;
79
97
}
80
98
} ;
81
99
} ) ,
82
100
__metadata ( 'design:paramtypes' , [ ] )
83
- ] , default_1 ) ;
84
- return default_1 ;
101
+ ] , AppMenu ) ;
102
+ return AppMenu ;
85
103
} ( React . Component ) ) ;
86
- Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
87
- exports . default = default_1 ;
104
+ exports . AppMenu = AppMenu ;
0 commit comments