@@ -27,43 +27,62 @@ var Divider_1 = require('material-ui/Divider');
2727var more_vert_1 = require ( 'material-ui/svg-icons/navigation/more-vert' ) ;
2828var close_1 = require ( 'material-ui/svg-icons/navigation/close' ) ;
2929var 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 ( ) {
3333 _super . apply ( this , arguments ) ;
3434 }
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 ;
3757 switch ( this . props . route ) {
3858 case 'final' :
3959 case 'page' :
40- return React . createElement ( "button" , { onTouchTap : routeToProgress } , " progress" ) ;
60+ return React . createElement ( MenuLink , { route : ' progress' } ) ;
4161 case 'progress' :
42- return React . createElement ( "button" , { onTouchTap : routeToPage } , " page" ) ;
62+ return React . createElement ( MenuItem_1 . default , { onTouchTap : routeToPage , primaryText : ' page' , key : 'page' } ) ;
4363 default : return null ;
4464 }
4565 } ;
46- default_1 . prototype . menuOptions = function ( ) {
47- var _a = this . props , routeToProgress = _a . routeToProgress , routeToTutorials = _a . routeToTutorials ;
66+ AppMenu . prototype . menuOptions = function ( ) {
4867 switch ( this . props . route ) {
4968 case 'final' :
5069 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' } ) ) ) ;
5271 case 'progress' :
53- return React . createElement ( MenuItem_1 . default , { primaryText : 'tutorials' , onTouchTap : routeToTutorials , key : 'projects '} ) ;
72+ return React . createElement ( MenuLink , { route : 'tutorials' } ) ;
5473 default : return null ;
5574 }
5675 } ;
57- default_1 . prototype . closePanel = function ( ) {
76+ AppMenu . prototype . closePanel = function ( ) {
5877 render_1 . togglePanel ( ) ;
5978 } ;
60- default_1 . prototype . render = function ( ) {
79+ AppMenu . prototype . render = function ( ) {
6180 var quit = this . props . quit ;
6281 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
6382 ? React . createElement ( MenuItem_1 . default , { key : 'issue' , className : 'link' } , React . createElement ( "a" , { href : window . coderoad . issuesPath } , "post issue" ) )
6483 : null , React . createElement ( Divider_1 . default , null ) , React . createElement ( MenuItem_1 . default , { key : 'quit' , onClick : quit } , "quit" ) ) } ) ;
6584 } ;
66- default_1 = __decorate ( [
85+ AppMenu = __decorate ( [
6786 react_redux_1 . connect ( null , function ( dispatch ) {
6887 return {
6988 routeToProgress : function ( ) { return dispatch ( actions_1 . setRoute ( 'progress' ) ) ; } ,
@@ -72,16 +91,14 @@ var default_1 = (function (_super) {
7291 dispatch ( actions_1 . setPage ( position ) ) ;
7392 dispatch ( actions_1 . setRoute ( 'page' ) ) ;
7493 } ,
75- routeToTutorials : function ( ) { return dispatch ( actions_1 . setRoute ( 'tutorials' ) ) ; } ,
7694 quit : function ( ) {
7795 render_1 . togglePanel ( ) ;
7896 subscriptions_1 . onDeactivate ( ) ;
7997 }
8098 } ;
8199 } ) ,
82100 __metadata ( 'design:paramtypes' , [ ] )
83- ] , default_1 ) ;
84- return default_1 ;
101+ ] , AppMenu ) ;
102+ return AppMenu ;
85103} ( React . Component ) ) ;
86- Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
87- exports . default = default_1 ;
104+ exports . AppMenu = AppMenu ;
0 commit comments