From 8a067a8787849be9ee27e12a978743c1dd56aac2 Mon Sep 17 00:00:00 2001 From: ghalestrilo Date: Thu, 18 Jun 2020 22:00:24 -0300 Subject: [PATCH] :construction: make mobile IDE screen start the sketch --- client/modules/IDE/pages/IDEViewMobile.jsx | 12 +++- client/modules/Mobile/MobileSketchView.jsx | 75 +++++++++++----------- 2 files changed, 47 insertions(+), 40 deletions(-) diff --git a/client/modules/IDE/pages/IDEViewMobile.jsx b/client/modules/IDE/pages/IDEViewMobile.jsx index b912c6a3..99be95ba 100644 --- a/client/modules/IDE/pages/IDEViewMobile.jsx +++ b/client/modules/IDE/pages/IDEViewMobile.jsx @@ -52,7 +52,7 @@ const isUserOwner = ({ project, user }) => (project.owner && project.owner.id == const IDEViewMobile = (props) => { const { - preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning + preferences, ide, editorAccessibility, project, updateLintMessage, clearLintMessage, selectedFile, updateFileContent, files, closeEditorOptions, showEditorOptions, showKeyboardShortcutModal, setUnsavedChanges, startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console, showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch } = props; const [tmController, setTmController] = useState(null); @@ -74,7 +74,13 @@ const IDEViewMobile = (props) => { setOverlay('preferences')}> - + { + alert('starting sketch'); + startSketch(); + }} + > @@ -181,6 +187,8 @@ IDEViewMobile.propTypes = { updatedAt: PropTypes.string }).isRequired, + startSketch: PropTypes.func.isRequired, + updateLintMessage: PropTypes.func.isRequired, clearLintMessage: PropTypes.func.isRequired, diff --git a/client/modules/Mobile/MobileSketchView.jsx b/client/modules/Mobile/MobileSketchView.jsx index 9365c25e..25ef9c71 100644 --- a/client/modules/Mobile/MobileSketchView.jsx +++ b/client/modules/Mobile/MobileSketchView.jsx @@ -8,6 +8,8 @@ import Header from '../../components/mobile/Header'; import PreviewFrame from '../IDE/components/PreviewFrame'; import Screen from '../../components/mobile/MobileScreen'; import * as ProjectActions from '../IDE/actions/project'; +import * as IDEActions from '../IDE/actions/ide'; + import { getHTMLFile, getJSFiles, getCSSFiles } from '../IDE/reducers/files'; @@ -39,13 +41,16 @@ const MobileSketchView = (props) => { // const files = useSelector(state => state.files); const { - htmlFile, jsFiles, cssFiles, files, params, getProject + htmlFile, jsFiles, cssFiles, files, params } = props; - useEffect(() => { - console.log(params); - getProject(params.project_id, params.username); - }, []); + // Actions + const { getProject, startSketch } = props; + + // useEffect(() => { + // console.log(params); + // getProject(params.project_id, params.username); + // }, []); return ( @@ -55,42 +60,35 @@ const MobileSketchView = (props) => {

Hello

- {/*

{selectedFile.name}

*/} +


- - {/*
- setOverlay('preferences')}> - - setOverlay('runSketch')}> - -
*/}

Hello

- - } - fullView - isPlaying - isAccessibleOutputPlaying={false} - textOutput={false} - gridOutput={false} - soundOutput={false} - dispatchConsoleEvent={noop} - endSketchRefresh={noop} - previewIsRefreshing={false} - setBlobUrl={noop} - stopSketch={noop} - expandConsole={noop} - clearConsole={noop} - /> +
+ + } + isAccessibleOutputPlaying={false} + textOutput={false} + gridOutput={false} + soundOutput={false} + previewIsRefreshing={false} + + dispatchConsoleEvent={noop} + endSketchRefresh={noop} + setBlobUrl={noop} + stopSketch={noop} + expandConsole={noop} + clearConsole={noop} + /> +
); }; @@ -121,6 +119,7 @@ MobileSketchView.propTypes = { name: PropTypes.string.isRequired })).isRequired, getProject: PropTypes.func.isRequired, + startSketch: PropTypes.func.isRequired, }; function mapStateToProps(state) { @@ -134,7 +133,7 @@ function mapStateToProps(state) { } function mapDispatchToProps(dispatch) { - return bindActionCreators(ProjectActions, dispatch); + return bindActionCreators({ ...ProjectActions, ...IDEActions }, dispatch); } export default connect(mapStateToProps, mapDispatchToProps)(MobileSketchView);