@@ -7,6 +7,7 @@ import styled from 'styled-components';
7
7
8
8
// Imports to be Refactored
9
9
import { bindActionCreators } from 'redux' ;
10
+
10
11
import * as FileActions from '../actions/files' ;
11
12
import * as IDEActions from '../actions/ide' ;
12
13
import * as ProjectActions from '../actions/project' ;
@@ -19,7 +20,7 @@ import { getHTMLFile } from '../reducers/files';
19
20
20
21
// Local Imports
21
22
import Editor from '../components/Editor' ;
22
- import { PreferencesIcon , PlayIcon , ExitIcon } from '../../../common/icons' ;
23
+ import { PlayIcon , ExitIcon , MoreIcon } from '../../../common/icons' ;
23
24
24
25
import IconButton from '../../../components/mobile/IconButton' ;
25
26
import Header from '../../../components/mobile/Header' ;
@@ -28,7 +29,11 @@ import Footer from '../../../components/mobile/Footer';
28
29
import IDEWrapper from '../../../components/mobile/IDEWrapper' ;
29
30
import Console from '../components/Console' ;
30
31
import { remSize } from '../../../theme' ;
32
+ // import OverlayManager from '../../../components/OverlayManager';
31
33
import ActionStrip from '../../../components/mobile/ActionStrip' ;
34
+ import useAsModal from '../../../components/useAsModal' ;
35
+ import { PreferencesIcon } from '../../../common/icons' ;
36
+ import Dropdown from '../../../components/Dropdown' ;
32
37
33
38
const isUserOwner = ( { project, user } ) => ( project . owner && project . owner . id === user . id ) ;
34
39
@@ -37,17 +42,30 @@ const Expander = styled.div`
37
42
height: ${ props => ( props . expanded ? remSize ( 160 ) : remSize ( 27 ) ) } ;
38
43
` ;
39
44
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
+
40
56
const MobileIDEView = ( props ) => {
41
57
const {
42
58
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
43
59
selectedFile, updateFileContent, files,
44
- closeEditorOptions, showEditorOptions, showKeyboardShortcutModal , setUnsavedChanges ,
60
+ closeEditorOptions, showEditorOptions,
45
61
startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
46
62
showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch
47
63
} = props ;
48
64
49
65
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 } /> ) ;
51
69
52
70
return (
53
71
< Screen fullscreen >
@@ -58,13 +76,17 @@ const MobileIDEView = (props) => {
58
76
< IconButton to = "/mobile" icon = { ExitIcon } aria-label = "Return to original editor" />
59
77
}
60
78
>
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 >
68
90
</ Header >
69
91
70
92
< IDEWrapper >
@@ -82,9 +104,7 @@ const MobileIDEView = (props) => {
82
104
editorOptionsVisible = { ide . editorOptionsVisible }
83
105
showEditorOptions = { showEditorOptions }
84
106
closeEditorOptions = { closeEditorOptions }
85
- showKeyboardShortcutModal = { showKeyboardShortcutModal }
86
- setUnsavedChanges = { setUnsavedChanges }
87
- isPlaying = { ide . isPlaying }
107
+ showKeyboard = { ide . isPlaying }
88
108
theme = { preferences . theme }
89
109
startRefreshSketch = { startRefreshSketch }
90
110
stopSketch = { stopSketch }
@@ -103,6 +123,7 @@ const MobileIDEView = (props) => {
103
123
provideController = { setTmController }
104
124
/>
105
125
</ IDEWrapper >
126
+
106
127
< Footer >
107
128
{ ide . consoleIsExpanded && < Expander expanded > < Console /> </ Expander > }
108
129
< ActionStrip />
@@ -111,7 +132,6 @@ const MobileIDEView = (props) => {
111
132
) ;
112
133
} ;
113
134
114
-
115
135
MobileIDEView . propTypes = {
116
136
117
137
preferences : PropTypes . shape ( {
@@ -130,7 +150,7 @@ MobileIDEView.propTypes = {
130
150
ide : PropTypes . shape ( {
131
151
isPlaying : PropTypes . bool . isRequired ,
132
152
isAccessibleOutputPlaying : PropTypes . bool . isRequired ,
133
- consoleEvent : PropTypes . array ,
153
+ consoleEvent : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) ,
134
154
modalIsVisible : PropTypes . bool . isRequired ,
135
155
sidebarIsExpanded : PropTypes . bool . isRequired ,
136
156
consoleIsExpanded : PropTypes . bool . isRequired ,
@@ -156,7 +176,7 @@ MobileIDEView.propTypes = {
156
176
} ) . isRequired ,
157
177
158
178
editorAccessibility : PropTypes . shape ( {
159
- lintMessages : PropTypes . array . isRequired ,
179
+ lintMessages : PropTypes . arrayOf ( PropTypes . shape ( { } ) ) . isRequired ,
160
180
} ) . isRequired ,
161
181
162
182
project : PropTypes . shape ( {
@@ -193,10 +213,6 @@ MobileIDEView.propTypes = {
193
213
194
214
showEditorOptions : PropTypes . func . isRequired ,
195
215
196
- showKeyboardShortcutModal : PropTypes . func . isRequired ,
197
-
198
- setUnsavedChanges : PropTypes . func . isRequired ,
199
-
200
216
startRefreshSketch : PropTypes . func . isRequired ,
201
217
202
218
stopSketch : PropTypes . func . isRequired ,
0 commit comments