@@ -382,10 +387,12 @@ FileNode.propTypes = {
hideFolderChildren: PropTypes.func.isRequired,
canEdit: PropTypes.bool.isRequired,
openUploadFileModal: PropTypes.func.isRequired,
- authenticated: PropTypes.bool.isRequired
+ authenticated: PropTypes.bool.isRequired,
+ onClickFile: PropTypes.func
};
FileNode.defaultProps = {
+ onClickFile: null,
parentId: '0',
isSelectedFile: false,
isFolderClosed: false,
diff --git a/client/modules/IDE/pages/MobileIDEView.jsx b/client/modules/IDE/pages/MobileIDEView.jsx
index c33c6cda..a1ab0ea7 100644
--- a/client/modules/IDE/pages/MobileIDEView.jsx
+++ b/client/modules/IDE/pages/MobileIDEView.jsx
@@ -20,24 +20,41 @@ import { getHTMLFile } from '../reducers/files';
// Local Imports
import Editor from '../components/Editor';
-import { PlayIcon, MoreIcon } from '../../../common/icons';
+import { PlayIcon, MoreIcon, CircleFolderIcon } from '../../../common/icons';
import IconButton from '../../../components/mobile/IconButton';
import Header from '../../../components/mobile/Header';
import Screen from '../../../components/mobile/MobileScreen';
import Footer from '../../../components/mobile/Footer';
import IDEWrapper from '../../../components/mobile/IDEWrapper';
+import MobileExplorer from '../../../components/mobile/Explorer';
import Console from '../components/Console';
import { remSize } from '../../../theme';
-// import OverlayManager from '../../../components/OverlayManager';
+
import ActionStrip from '../../../components/mobile/ActionStrip';
import useAsModal from '../../../components/useAsModal';
import { PreferencesIcon } from '../../../common/icons';
import Dropdown from '../../../components/Dropdown';
+const getRootFile = files => files && files.filter(file => file.name === 'root')[0];
+const getRootFileID = files => (root => root && root.id)(getRootFile(files));
+
const isUserOwner = ({ project, user }) =>
project.owner && project.owner.id === user.id;
+
+// const userCanEditProject = (props) => {
+// let canEdit;
+// if (!props.owner) {
+// canEdit = true;
+// } else if (props.user.authenticated && props.owner.id === props.user.id) {
+// canEdit = true;
+// } else {
+// canEdit = false;
+// }
+// return canEdit;
+// };
+
const Expander = styled.div`
height: ${props => (props.expanded ? remSize(160) : remSize(27))};
`;
@@ -46,7 +63,7 @@ const NavItem = styled.li`
position: relative;
`;
-const getNatOptions = (username = undefined) =>
+const getNavOptions = (username = undefined) =>
(username
? [
{ icon: PreferencesIcon, title: 'Preferences', href: '/mobile/preferences', },
@@ -67,17 +84,13 @@ const MobileIDEView = (props) => {
selectedFile, updateFileContent, files, user, params,
closeEditorOptions, showEditorOptions,
startRefreshSketch, stopSketch, expandSidebar, collapseSidebar, clearConsole, console,
- showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch, getProject, clearPersistedState
+ showRuntimeErrorWarning, hideRuntimeErrorWarning, startSketch, getProject, clearPersistedState, setUnsavedChanges
} = props;
const [tmController, setTmController] = useState(null); // eslint-disable-line
const { username } = user;
- const [triggerNavDropdown, NavDropDown] = useAsModal(
);
// Force state reset
useEffect(clearPersistedState, []);
@@ -95,16 +108,29 @@ const MobileIDEView = (props) => {
setCurrentProjectID(params.project_id);
}, [params, project, username]);
+ // Screen Modals
+ const [toggleNavDropdown, NavDropDown] = useAsModal(
);
+
+ const [toggleExplorer, Explorer] = useAsModal(toggle =>
+ (
), true);
return (
+
@@ -147,6 +173,7 @@ const MobileIDEView = (props) => {
hideRuntimeErrorWarning={hideRuntimeErrorWarning}
runtimeErrorWarningVisible={ide.runtimeErrorWarningVisible}
provideController={setTmController}
+ setUnsavedChanges={setUnsavedChanges}
/>
@@ -156,7 +183,7 @@ const MobileIDEView = (props) => {
)}
-
+
);
@@ -267,6 +294,7 @@ MobileIDEView.propTypes = {
username: PropTypes.string,
}).isRequired,
+ setUnsavedChanges: PropTypes.func.isRequired,
getProject: PropTypes.func.isRequired,
clearPersistedState: PropTypes.func.isRequired,
params: PropTypes.shape({
diff --git a/client/utils/custom-hooks.js b/client/utils/custom-hooks.js
index e289147f..a58bda41 100644
--- a/client/utils/custom-hooks.js
+++ b/client/utils/custom-hooks.js
@@ -28,7 +28,7 @@ export const useModalBehavior = (hideOverlay) => {
const handleClickOutside = ({ target }) => {
- if (ref && ref.current && !ref.current.contains(target)) {
+ if (ref && ref.current && !(ref.current.contains && ref.current.contains(target))) {
hide();
}
};