diff --git a/client/components/Nav.js b/client/components/Nav.js
index 07456387..975e3ceb 100644
--- a/client/components/Nav.js
+++ b/client/components/Nav.js
@@ -8,7 +8,7 @@ function Nav(props) {
New
@@ -21,6 +21,16 @@ function Nav(props) {
Save
+
+
+ Duplicate
+
+
+
+
+ Download
+
+
@@ -28,16 +38,6 @@ function Nav(props) {
-
-
- Export (zip)
-
-
-
-
- Clone
-
-
-
@@ -50,7 +50,7 @@ function Nav(props) {
}
Nav.propTypes = {
- createProject: PropTypes.func.isRequired,
+ newProject: PropTypes.func.isRequired,
saveProject: PropTypes.func.isRequired,
exportProjectAsZip: PropTypes.func.isRequired,
cloneProject: PropTypes.func.isRequired,
diff --git a/client/constants.js b/client/constants.js
index aed9de7b..145819a3 100644
--- a/client/constants.js
+++ b/client/constants.js
@@ -29,6 +29,7 @@ export const SET_PROJECT_NAME = 'SET_PROJECT_NAME';
export const PROJECT_SAVE_SUCCESS = 'PROJECT_SAVE_SUCCESS';
export const PROJECT_SAVE_FAIL = 'PROJECT_SAVE_FAIL';
export const NEW_PROJECT = 'NEW_PROJECT';
+export const RESET_PROJECT = 'RESET_PROJECT';
export const SET_PROJECT = 'SET_PROJECT';
export const SET_PROJECTS = 'SET_PROJECTS';
diff --git a/client/modules/IDE/actions/editorAccessibility.js b/client/modules/IDE/actions/editorAccessibility.js
index 28cbe44c..3311d943 100644
--- a/client/modules/IDE/actions/editorAccessibility.js
+++ b/client/modules/IDE/actions/editorAccessibility.js
@@ -15,9 +15,9 @@ export function clearLintMessage() {
};
}
-export function updateLineNumber(lineNo) {
+export function updateLineNumber(lineNumber) {
return {
type: ActionTypes.UPDATE_LINENUMBER,
- lineNo
+ lineNumber
};
}
diff --git a/client/modules/IDE/actions/project.js b/client/modules/IDE/actions/project.js
index d44cf12a..d541a49f 100644
--- a/client/modules/IDE/actions/project.js
+++ b/client/modules/IDE/actions/project.js
@@ -52,6 +52,9 @@ export function setProjectName(event) {
export function saveProject() {
return (dispatch, getState) => {
const state = getState();
+ if (state.user.id && state.project.owner && state.project.owner.id !== state.user.id) {
+ return;
+ }
const formParams = Object.assign({}, state.project);
formParams.files = [...state.files];
if (state.project.id) {
@@ -116,7 +119,6 @@ export function createProject() {
export function exportProjectAsZip() {
return (dispatch, getState) => {
- console.log('exporting project!');
const state = getState();
const zip = new JSZip();
async.each(state.files, (file, cb) => {
@@ -139,6 +141,13 @@ export function exportProjectAsZip() {
};
}
+export function newProject() {
+ browserHistory.push('/');
+ return {
+ type: ActionTypes.RESET_PROJECT
+ };
+}
+
export function cloneProject() {
return (dispatch, getState) => {
const state = getState();
diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js
index d8829736..2bf7d214 100644
--- a/client/modules/IDE/components/Editor.js
+++ b/client/modules/IDE/components/Editor.js
@@ -18,14 +18,14 @@ import { CSSLint } from 'csslint';
window.CSSLint = CSSLint;
import { HTMLHint } from 'htmlhint';
window.HTMLHint = HTMLHint;
+const beepUrl = require('../../../sounds/audioAlert.mp3');
import { debounce } from 'throttle-debounce';
class Editor extends React.Component {
componentDidMount() {
- // TODO: replace with wav file and loader
- this.beep = new Audio('data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1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12UIRhzSaUdQ+rQU5kGeFxm+hb1oh6pWWmv3uvmReDl0UnvtapVaIzo1jZbf/pD6ElLqSX+rUmOQNpJFa/r+sa4e/pBlAABoAAAAA3CUgShLdGIxsY7AUABPRrgCABdDuQ5GC7DqPQCgbbJUAoRSUj+NIEig0YfyWUho1VBBBA//uQZB4ABZx5zfMakeAAAAmwAAAAF5F3P0w9GtAAACfAAAAAwLhMDmAYWMgVEG1U0FIGCBgXBXAtfMH10000EEEEEECUBYln03TTTdNBDZopopYvrTTdNa325mImNg3TTPV9q3pmY0xoO6bv3r00y+IDGid/9aaaZTGMuj9mpu9Mpio1dXrr5HERTZSmqU36A3CumzN/9Robv/Xx4v9ijkSRSNLQhAWumap82WRSBUqXStV/YcS+XVLnSS+WLDroqArFkMEsAS+eWmrUzrO0oEmE40RlMZ5+ODIkAyKAGUwZ3mVKmcamcJnMW26MRPgUw6j+LkhyHGVGYjSUUKNpuJUQoOIAyDvEyG8S5yfK6dhZc0Tx1KI/gviKL6qvvFs1+bWtaz58uUNnryq6kt5RzOCkPWlVqVX2a/EEBUdU1KrXLf40GoiiFXK///qpoiDXrOgqDR38JB0bw7SoL+ZB9o1RCkQjQ2CBYZKd/+VJxZRRZlqSkKiws0WFxUyCwsKiMy7hUVFhIaCrNQsKkTIsLivwKKigsj8XYlwt/WKi2N4d//uQRCSAAjURNIHpMZBGYiaQPSYyAAABLAAAAAAAACWAAAAApUF/Mg+0aohSIRobBAsMlO//Kk4soosy1JSFRYWaLC4qZBYWFRGZdwqKiwkNBVmoWFSJkWFxX4FFRQWR+LsS4W/rFRb/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////VEFHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU291bmRib3kuZGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMjAwNGh0dHA6Ly93d3cuc291bmRib3kuZGUAAAAAAAAAACU='); // eslint-disable-line
+ this.beep = new Audio(beepUrl);
this._cm = CodeMirror(this.refs.container, { // eslint-disable-line
theme: 'p5-widget',
value: this.props.file.content,
@@ -89,6 +89,8 @@ class Editor extends React.Component {
this._cm.setOption('mode', 'htmlmixed');
}
}
+
+ console.log('componentDidUpdate in editor');
}
componentWillUnmount() {
@@ -104,7 +106,7 @@ class Editor extends React.Component {
);
@@ -113,7 +115,7 @@ class Editor extends React.Component {
Editor.propTypes = {
lintWarning: PropTypes.bool.isRequired,
- lineNo: PropTypes.string.isRequired,
+ lineNumber: PropTypes.string.isRequired,
lintMessages: PropTypes.array.isRequired,
updateLintMessage: PropTypes.func.isRequired,
clearLintMessage: PropTypes.func.isRequired,
diff --git a/client/modules/IDE/components/EditorAccessibility.js b/client/modules/IDE/components/EditorAccessibility.js
index 73dce536..b2e0cbe3 100644
--- a/client/modules/IDE/components/EditorAccessibility.js
+++ b/client/modules/IDE/components/EditorAccessibility.js
@@ -27,7 +27,7 @@ class EditorAccessibility extends React.Component {
{messages}
Current line
- {this.props.lineNo}
+ {this.props.lineNumber}
);
@@ -36,7 +36,7 @@ class EditorAccessibility extends React.Component {
EditorAccessibility.propTypes = {
lintMessages: PropTypes.array.isRequired,
- lineNo: PropTypes.string.isRequired,
+ lineNumber: PropTypes.string.isRequired,
};
export default EditorAccessibility;
diff --git a/client/modules/IDE/components/PreviewFrame.js b/client/modules/IDE/components/PreviewFrame.js
index ac6794fc..dfef5396 100644
--- a/client/modules/IDE/components/PreviewFrame.js
+++ b/client/modules/IDE/components/PreviewFrame.js
@@ -33,7 +33,7 @@ const hijackConsoleScript = `