Skip to content

Commit 8a067a8

Browse files
committed
🚧 make mobile IDE screen start the sketch
1 parent e11756d commit 8a067a8

File tree

2 files changed

+47
-40
lines changed

2 files changed

+47
-40
lines changed

client/modules/IDE/pages/IDEViewMobile.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const isUserOwner = ({ project, user }) => (project.owner && project.owner.id ==
5252

5353
const IDEViewMobile = (props) => {
5454
const {
55-
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning
55+
preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch
5656
} = props;
5757

5858
const [tmController, setTmController] = useState(null);
@@ -74,7 +74,13 @@ const IDEViewMobile = (props) => {
7474
<IconButton onClick={() => setOverlay('preferences')}>
7575
<PreferencesIcon focusable="false" aria-hidden="true" />
7676
</IconButton>
77-
<Link to="/mobile/preview">
77+
<Link
78+
to="/mobile/preview"
79+
onClick={() => {
80+
alert('starting sketch');
81+
startSketch();
82+
}}
83+
>
7884
<IconButton>
7985
<PlayIcon viewBox="-1 -1 7 7" focusable="false" aria-hidden="true" />
8086
</IconButton>
@@ -181,6 +187,8 @@ IDEViewMobile.propTypes = {
181187
updatedAt: PropTypes.string
182188
}).isRequired,
183189

190+
startSketch: PropTypes.func.isRequired,
191+
184192
updateLintMessage: PropTypes.func.isRequired,
185193

186194
clearLintMessage: PropTypes.func.isRequired,

client/modules/Mobile/MobileSketchView.jsx

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import Header from '../../components/mobile/Header';
88
import PreviewFrame from '../IDE/components/PreviewFrame';
99
import Screen from '../../components/mobile/MobileScreen';
1010
import * as ProjectActions from '../IDE/actions/project';
11+
import * as IDEActions from '../IDE/actions/ide';
12+
1113
import { getHTMLFile, getJSFiles, getCSSFiles } from '../IDE/reducers/files';
1214

1315

@@ -39,13 +41,16 @@ const MobileSketchView = (props) => {
3941
// const files = useSelector(state => state.files);
4042

4143
const {
42-
htmlFile, jsFiles, cssFiles, files, params, getProject
44+
htmlFile, jsFiles, cssFiles, files, params
4345
} = props;
4446

45-
useEffect(() => {
46-
console.log(params);
47-
getProject(params.project_id, params.username);
48-
}, []);
47+
// Actions
48+
const { getProject, startSketch } = props;
49+
50+
// useEffect(() => {
51+
// console.log(params);
52+
// getProject(params.project_id, params.username);
53+
// }, []);
4954

5055
return (
5156
<Screen>
@@ -55,42 +60,35 @@ const MobileSketchView = (props) => {
5560
</IconLinkWrapper>
5661
<div>
5762
<h2>Hello</h2>
58-
{/* <h3>{selectedFile.name}</h3> */}
63+
<h3><br /></h3>
5964
</div>
60-
61-
{/* <div style={{ marginLeft: '2rem' }}>
62-
<IconButton onClick={() => setOverlay('preferences')}>
63-
<PreferencesIcon focusable="false" aria-hidden="true" />
64-
</IconButton>
65-
<IconButton onClick={() => setOverlay('runSketch')}>
66-
<PlayIcon viewBox="-1 -1 7 7" focusable="false" aria-hidden="true" />
67-
</IconButton>
68-
</div> */}
6965
</Header>
7066
<Content>
7167
<h1>Hello</h1>
72-
<PreviewFrame
73-
htmlFile={htmlFile}
74-
jsFiles={jsFiles}
75-
cssFiles={cssFiles}
76-
files={files}
77-
head={
78-
<link type="text/css" rel="stylesheet" href="/preview-styles.css" />
79-
}
80-
fullView
81-
isPlaying
82-
isAccessibleOutputPlaying={false}
83-
textOutput={false}
84-
gridOutput={false}
85-
soundOutput={false}
86-
dispatchConsoleEvent={noop}
87-
endSketchRefresh={noop}
88-
previewIsRefreshing={false}
89-
setBlobUrl={noop}
90-
stopSketch={noop}
91-
expandConsole={noop}
92-
clearConsole={noop}
93-
/>
68+
<main className="preview-frame-holder">
69+
70+
<PreviewFrame
71+
fullView
72+
isPlaying
73+
htmlFile={htmlFile}
74+
jsFiles={jsFiles}
75+
cssFiles={cssFiles}
76+
files={files}
77+
head={<link type="text/css" rel="stylesheet" href="/preview-styles.css" />}
78+
isAccessibleOutputPlaying={false}
79+
textOutput={false}
80+
gridOutput={false}
81+
soundOutput={false}
82+
previewIsRefreshing={false}
83+
84+
dispatchConsoleEvent={noop}
85+
endSketchRefresh={noop}
86+
setBlobUrl={noop}
87+
stopSketch={noop}
88+
expandConsole={noop}
89+
clearConsole={noop}
90+
/>
91+
</main>
9492
</Content>
9593
</Screen>);
9694
};
@@ -121,6 +119,7 @@ MobileSketchView.propTypes = {
121119
name: PropTypes.string.isRequired
122120
})).isRequired,
123121
getProject: PropTypes.func.isRequired,
122+
startSketch: PropTypes.func.isRequired,
124123
};
125124

126125
function mapStateToProps(state) {
@@ -134,7 +133,7 @@ function mapStateToProps(state) {
134133
}
135134

136135
function mapDispatchToProps(dispatch) {
137-
return bindActionCreators(ProjectActions, dispatch);
136+
return bindActionCreators({ ...ProjectActions, ...IDEActions }, dispatch);
138137
}
139138

140139
export default connect(mapStateToProps, mapDispatchToProps)(MobileSketchView);

0 commit comments

Comments
 (0)