1- import React from 'react' ;
1+ import React , { useEffect } from 'react' ;
22import PropTypes from 'prop-types' ;
33import { connect } from 'react-redux' ;
44import { withRouter } from 'react-router' ;
@@ -46,6 +46,21 @@ const NavItem = styled.li`
4646 position: relative;
4747` ;
4848
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+
4964const MobileIDEView = ( props ) => {
5065 const {
5166 preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
@@ -58,25 +73,23 @@ const MobileIDEView = (props) => {
5873 const [ tmController , setTmController ] = useState ( null ) ; // eslint-disable-line
5974
6075 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-
7476
7577 const [ triggerNavDropdown , NavDropDown ] = useAsModal ( < Dropdown
76- items = { username ? navOptionsLoggedIn : navOptionsLoggedOut }
78+ items = { getNatOptions ( username ) }
7779 align = "right"
7880 /> ) ;
7981
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+
8093 return (
8194 < Screen fullscreen >
8295 < Header
0 commit comments