@@ -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 , MoreIcon } 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,7 @@ 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' ;
31
- import Dropdown from '../../../components/Dropdown ' ;
32
+ import OverlayManager from '../../../components/OverlayManager ' ;
32
33
33
34
const isUserOwner = ( { project, user } ) => ( project . owner && project . owner . id === user . id ) ;
34
35
@@ -38,47 +39,6 @@ const BottomBarContent = styled.h2`
38
39
` ;
39
40
40
41
41
- // TODO: Move to new file?
42
- // const overlays = {};
43
- // const OverlayManager = name => overlays[name] || null;
44
-
45
- const OverlayManager = ( { ref, overlay, hideOverlay } ) => {
46
- useEffect ( ( ) => {
47
- const handleClickOutside = ( { target } ) => {
48
- if ( ref && ref . current && ! ref . current . contains ( target ) ) { hideOverlay ( ) ; console . log ( 'click' ) ; }
49
- } ;
50
-
51
- document . addEventListener ( 'mousedown' , handleClickOutside ) ;
52
- return ( ) => { document . removeEventListener ( 'mousedown' , handleClickOutside ) ; } ;
53
- } , [ ref ] ) ;
54
-
55
- const headerNavOptions = [
56
- { icon : PreferencesIcon , title : 'Preferences' , href : '/mobile/preferences' } ,
57
- { icon : PreferencesIcon , title : 'Examples' , href : '/mobile/examples' } ,
58
- { icon : PreferencesIcon , title : 'Original View' , href : '/mobile/preferences' }
59
- ] ;
60
-
61
- return (
62
- < div ref = { ( r ) => { if ( ref ) { ref . current = r ; } } } >
63
- { ( overlay === 'dropdown' ) && < Dropdown items = { headerNavOptions } /> }
64
- </ div >
65
- ) ;
66
- } ;
67
-
68
- const refPropType = PropTypes . oneOfType ( [
69
- PropTypes . func ,
70
- PropTypes . shape ( { current : PropTypes . instanceOf ( Element ) } )
71
- ] ) ;
72
-
73
- OverlayManager . propTypes = {
74
- ref : refPropType . isRequired ,
75
- overlay : PropTypes . string ,
76
- hideOverlay : PropTypes . func . isRequired
77
- } ;
78
-
79
- OverlayManager . defaultProps = { overlay : null } ;
80
-
81
-
82
42
const MobileIDEView = ( props ) => {
83
43
const {
84
44
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage,
@@ -93,11 +53,10 @@ const MobileIDEView = (props) => {
93
53
94
54
// TODO: Move this to OverlayController (?)
95
55
const hideOverlay = ( ) => setOverlay ( null ) ;
96
- const overlayRef = useRef ( ) ;
97
-
56
+ // const overlayRef = useRef({});
98
57
99
58
return (
100
- < Screen fullscreen >
59
+ < Screen fullscreen >
101
60
< Header
102
61
title = { project . name }
103
62
subtitle = { selectedFile . name }
@@ -151,12 +110,15 @@ const MobileIDEView = (props) => {
151
110
/>
152
111
</ IDEWrapper >
153
112
154
- { /* TODO: Create Overlay Manager */ }
155
- { < OverlayManager
156
- ref = { overlayRef }
113
+ < Footer >
114
+ < Console />
115
+ </ Footer >
116
+
117
+ < OverlayManager
118
+ // ref={overlayRef}
157
119
overlay = { overlayName }
158
120
hideOverlay = { hideOverlay }
159
- /> }
121
+ />
160
122
</ Screen >
161
123
) ;
162
124
} ;
0 commit comments