Compare commits

...

2 commits

Author SHA1 Message Date
Ruben van de Ven
fa5e7cceb1 Fix cloning when editing someone else's project 2020-10-12 17:25:26 +02:00
Ruben van de Ven
b231b6b7e3 Remove console.logs 2020-10-10 20:37:59 +02:00
5 changed files with 11 additions and 7 deletions

View file

@ -262,7 +262,7 @@ function generateNewIdsForChildren(file, files) {
export function cloneProject(id) {
return (dispatch, getState) => {
dispatch(setUnsavedChanges(false));
new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
if (!id) {
resolve(getState());
} else {

View file

@ -58,11 +58,14 @@ class Toolbar extends React.Component {
}
render() {
const canEditProjectName = this.canEditProjectName();
const playButtonClass = classNames({
'toolbar__play-button': true,
'toolbar__play-button--selected': this.props.isPlaying,
'toolbar__play-button--saved': this.props.isSaved,
'toolbar__play-button--unsaved': !this.props.isSaved
'toolbar__play-button--unsaved': !this.props.isSaved,
'toolbar__play-button--clone': this.props.unsavedChanges && !canEditProjectName
});
const stopButtonClass = classNames({
'toolbar__stop-button': true,
@ -77,8 +80,6 @@ class Toolbar extends React.Component {
'toolbar__project-name-container--editing': this.props.project.isEditingName
});
const canEditProjectName = this.canEditProjectName();
return (
<div className="toolbar">
<button
@ -178,6 +179,7 @@ class Toolbar extends React.Component {
Toolbar.propTypes = {
isPlaying: PropTypes.bool.isRequired,
unsavedChanges: PropTypes.bool.isRequired,
isSaved: PropTypes.bool.isRequired,
preferencesIsVisible: PropTypes.bool.isRequired,
stopSketch: PropTypes.func.isRequired,
@ -221,6 +223,7 @@ function mapStateToProps(state) {
isSaved: state.project.updatedAt !== '',
preferencesIsVisible: state.ide.preferencesIsVisible,
project: state.project,
unsavedChanges: state.ide.unsavedChanges,
};
}

View file

@ -183,6 +183,7 @@ class IDEView extends React.Component {
console.trace('project to save:', this.props.project);
return this.props.saveProject(this.cmController.getContent());
} else if (this.props.user.authenticated) {
console.log('cloning!');
return this.props.cloneProject();
}

View file

@ -1,5 +1,5 @@
.toolbar__play-button {
&--unsaved {
&--unsaved, &--clone {
// for some reason, I cannot manage to have PreviewFrame save _and_ actuall yload the project (it stops the playback)
// pressing twice works. So just show a floppy the first time around :-)
svg {

View file

@ -135,9 +135,9 @@ function preload() {
for(let id in data) {
images[id] = loadImage(data[id]);
}
console.log('images', data, images);
// console.log('images', data, images);
});
console.log(images);
// console.log(images);
}
function setup() {