1
- import React from 'react' ;
1
+ import React , { useEffect } from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
import { connect } from 'react-redux' ;
4
4
import { withRouter } from 'react-router' ;
@@ -46,6 +46,21 @@ const NavItem = styled.li`
46
46
position: relative;
47
47
` ;
48
48
49
+ const getNatOptions = ( username = undefined ) =>
50
+ ( username
51
+ ? [
52
+ { icon : PreferencesIcon , title : 'Preferences' , href : '/mobile/preferences' , } ,
53
+ { icon : PreferencesIcon , title : 'My Stuff' , href : `/mobile/${ username } /sketches` } ,
54
+ { icon : PreferencesIcon , title : 'Examples' , href : '/mobile/p5/sketches' } ,
55
+ { icon : PreferencesIcon , title : 'Original Editor' , href : '/' , } ,
56
+ ]
57
+ : [
58
+ { icon : PreferencesIcon , title : 'Preferences' , href : '/mobile/preferences' , } ,
59
+ { icon : PreferencesIcon , title : 'Examples' , href : '/mobile/p5/sketches' } ,
60
+ { icon : PreferencesIcon , title : 'Original Editor' , href : '/' , } ,
61
+ ]
62
+ ) ;
63
+
49
64
const MobileIDEView = ( props ) => {
50
65
const {
51
66
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
@@ -58,25 +73,23 @@ const MobileIDEView = (props) => {
58
73
const [ tmController , setTmController ] = useState ( null ) ; // eslint-disable-line
59
74
60
75
const { username } = user ;
61
- const navOptionsLoggedIn = [
62
- { icon : PreferencesIcon , title : 'Preferences' , href : '/mobile/preferences' , } ,
63
- { icon : PreferencesIcon , title : 'My Stuff' , href : `/mobile/${ username } /sketches` } ,
64
- { icon : PreferencesIcon , title : 'Examples' , href : '/mobile/p5/sketches' } ,
65
- { icon : PreferencesIcon , title : 'Original Editor' , href : '/' , } ,
66
- ] ;
67
-
68
- const navOptionsLoggedOut = [
69
- { icon : PreferencesIcon , title : 'Preferences' , href : '/mobile/preferences' , } ,
70
- { icon : PreferencesIcon , title : 'Examples' , href : '/mobile/p5/sketches' } ,
71
- { icon : PreferencesIcon , title : 'Original Editor' , href : '/' , } ,
72
- ] ;
73
-
74
76
75
77
const [ triggerNavDropdown , NavDropDown ] = useAsModal ( < Dropdown
76
- items = { username ? navOptionsLoggedIn : navOptionsLoggedOut }
78
+ items = { getNatOptions ( username ) }
77
79
align = "right"
78
80
/> ) ;
79
81
82
+ // Load Project
83
+ useEffect ( ( ) => {
84
+ // const { project_id } = params;
85
+ // const oldproject_id = '';
86
+
87
+ // if (nextProps.params.project_id && !oldproject_id)
88
+ // if (nextProps.params.project_id !== nextProps.project.id)
89
+
90
+ // getProject(nextProps.params.project_id);
91
+ } , [ ] ) ;
92
+
80
93
return (
81
94
< Screen fullscreen >
82
95
< Header
0 commit comments