@@ -7,6 +7,7 @@ import styled from 'styled-components';
77
88// Imports to be Refactored
99import { bindActionCreators } from 'redux' ;
10+
1011import * as FileActions from '../actions/files' ;
1112import * as IDEActions from '../actions/ide' ;
1213import * as ProjectActions from '../actions/project' ;
@@ -19,7 +20,7 @@ import { getHTMLFile } from '../reducers/files';
1920
2021// Local Imports
2122import Editor from '../components/Editor' ;
22- import { PreferencesIcon , PlayIcon , ExitIcon } from '../../../common/icons' ;
23+ import { PlayIcon , ExitIcon , MoreIcon } from '../../../common/icons' ;
2324
2425import IconButton from '../../../components/mobile/IconButton' ;
2526import Header from '../../../components/mobile/Header' ;
@@ -28,7 +29,11 @@ import Footer from '../../../components/mobile/Footer';
2829import IDEWrapper from '../../../components/mobile/IDEWrapper' ;
2930import Console from '../components/Console' ;
3031import { remSize } from '../../../theme' ;
32+ // import OverlayManager from '../../../components/OverlayManager';
3133import ActionStrip from '../../../components/mobile/ActionStrip' ;
34+ import useAsModal from '../../../components/useAsModal' ;
35+ import { PreferencesIcon } from '../../../common/icons' ;
36+ import Dropdown from '../../../components/Dropdown' ;
3237
3338const isUserOwner = ( { project, user } ) => ( project . owner && project . owner . id === user . id ) ;
3439
@@ -37,17 +42,30 @@ const Expander = styled.div`
3742 height: ${ props => ( props . expanded ? remSize ( 160 ) : remSize ( 27 ) ) } ;
3843` ;
3944
45+ const NavItem = styled . li `
46+ position: relative;
47+ ` ;
48+
49+ const headerNavOptions = [
50+ { icon : PreferencesIcon , title : 'Preferences' , href : '/mobile/preferences' , } ,
51+ { icon : PreferencesIcon , title : 'Examples' , href : '/mobile/examples' } ,
52+ { icon : PreferencesIcon , title : 'Original Editor' , href : '/' , } ,
53+ ] ;
54+
55+
4056const MobileIDEView = ( props ) => {
4157 const {
4258 preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
4359 selectedFile, updateFileContent, files,
44- closeEditorOptions, showEditorOptions, showKeyboardShortcutModal , setUnsavedChanges ,
60+ closeEditorOptions, showEditorOptions,
4561 startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
4662 showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch
4763 } = props ;
4864
4965 const [ tmController , setTmController ] = useState ( null ) ; // eslint-disable-line
50- const [ overlay , setOverlay ] = useState ( null ) ; // eslint-disable-line
66+
67+
68+ const [ triggerNavDropdown , NavDropDown ] = useAsModal ( < Dropdown align = "right" items = { headerNavOptions } /> ) ;
5169
5270 return (
5371 < Screen fullscreen >
@@ -58,13 +76,17 @@ const MobileIDEView = (props) => {
5876 < IconButton to = "/mobile" icon = { ExitIcon } aria-label = "Return to original editor" />
5977 }
6078 >
61- < IconButton
62- to = "/mobile/preferences"
63- onClick = { ( ) => setOverlay ( 'preferences' ) }
64- icon = { PreferencesIcon }
65- aria-label = "Open preferences menu"
66- />
67- < IconButton to = "/mobile/preview" onClick = { ( ) => { startSketch ( ) ; } } icon = { PlayIcon } aria-label = "Run sketch" />
79+ < NavItem >
80+ < IconButton
81+ onClick = { triggerNavDropdown }
82+ icon = { MoreIcon }
83+ aria-label = "Options"
84+ />
85+ < NavDropDown />
86+ </ NavItem >
87+ < li >
88+ < IconButton to = "/mobile/preview" onClick = { ( ) => { startSketch ( ) ; } } icon = { PlayIcon } aria-label = "Run sketch" />
89+ </ li >
6890 </ Header >
6991
7092 < IDEWrapper >
@@ -82,9 +104,7 @@ const MobileIDEView = (props) => {
82104 editorOptionsVisible = { ide . editorOptionsVisible }
83105 showEditorOptions = { showEditorOptions }
84106 closeEditorOptions = { closeEditorOptions }
85- showKeyboardShortcutModal = { showKeyboardShortcutModal }
86- setUnsavedChanges = { setUnsavedChanges }
87- isPlaying = { ide . isPlaying }
107+ showKeyboard = { ide . isPlaying }
88108 theme = { preferences . theme }
89109 startRefreshSketch = { startRefreshSketch }
90110 stopSketch = { stopSketch }
@@ -103,6 +123,7 @@ const MobileIDEView = (props) => {
103123 provideController = { setTmController }
104124 />
105125 </ IDEWrapper >
126+
106127 < Footer >
107128 { ide . consoleIsExpanded && < Expander expanded > < Console /> </ Expander > }
108129 < ActionStrip />
@@ -111,7 +132,6 @@ const MobileIDEView = (props) => {
111132 ) ;
112133} ;
113134
114-
115135MobileIDEView . propTypes = {
116136
117137 preferences : PropTypes . shape ( {
@@ -130,7 +150,7 @@ MobileIDEView.propTypes = {
130150 ide : PropTypes . shape ( {
131151 isPlaying : PropTypes . bool . isRequired ,
132152 isAccessibleOutputPlaying : PropTypes . bool . isRequired ,
133- consoleEvent : PropTypes . array ,
153+ consoleEvent : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) ,
134154 modalIsVisible : PropTypes . bool . isRequired ,
135155 sidebarIsExpanded : PropTypes . bool . isRequired ,
136156 consoleIsExpanded : PropTypes . bool . isRequired ,
@@ -156,7 +176,7 @@ MobileIDEView.propTypes = {
156176 } ) . isRequired ,
157177
158178 editorAccessibility : PropTypes . shape ( {
159- lintMessages : PropTypes . array . isRequired ,
179+ lintMessages : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) . isRequired ,
160180 } ) . isRequired ,
161181
162182 project : PropTypes . shape ( {
@@ -193,10 +213,6 @@ MobileIDEView.propTypes = {
193213
194214 showEditorOptions : PropTypes . func . isRequired ,
195215
196- showKeyboardShortcutModal : PropTypes . func . isRequired ,
197-
198- setUnsavedChanges : PropTypes . func . isRequired ,
199-
200216 startRefreshSketch : PropTypes . func . isRequired ,
201217
202218 stopSketch : PropTypes . func . isRequired ,
0 commit comments