mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
starting to change addtostudios modal to make changes on the fly
This commit is contained in:
parent
c25bfab7bb
commit
0a6ec304d3
3 changed files with 27 additions and 13 deletions
|
@ -2,7 +2,11 @@
|
|||
// * should the button to submit instantly? By clicking away shouldn't effectively undo what you thought you did.
|
||||
// * should it really be pinned on the page? Isn't that something you're trying to move away from?
|
||||
// *
|
||||
// *
|
||||
// plan:
|
||||
// * change onOrDirty to updateQueued = {[id]: {updateType: ['join':'leave']}, ...}
|
||||
// * also maintain second hash, joined = {[id]: true, ...}
|
||||
// in render, use joined to set color, and if queued, use spinner for icon.
|
||||
|
||||
|
||||
const bindAll = require('lodash.bindall');
|
||||
const truncate = require('lodash.truncate');
|
||||
|
@ -164,16 +168,25 @@ class AddToStudioModal extends React.Component {
|
|||
return accumulator;
|
||||
}, []);
|
||||
|
||||
this.props.onAddToStudio(studiosToAdd, studiosToLeave, err => {
|
||||
if (err) log.error(err);
|
||||
// When this modal is opened, and isOpen becomes true,
|
||||
// onOrDirty should start with a clean slate
|
||||
// NOTE: this doesn't seem to be working:
|
||||
this.setState({
|
||||
waiting: false,
|
||||
onOrDirty: {}
|
||||
setTimeout(function() {
|
||||
this.props.onAddToStudio(studiosToAdd, studiosToLeave, err => {
|
||||
if (err) log.error(err);
|
||||
// When this modal is opened, and isOpen becomes true,
|
||||
// onOrDirty should start with a clean slate
|
||||
// NOTE: this doesn't seem to be working:
|
||||
setTimeout(function() {
|
||||
this.setState({
|
||||
waiting: false,
|
||||
onOrDirty: {}
|
||||
});
|
||||
}.bind(this), 3000);
|
||||
// this.setState({
|
||||
|
||||
// waiting: false,
|
||||
// onOrDirty: {}
|
||||
// });
|
||||
});
|
||||
});
|
||||
}.bind(this), 3000);
|
||||
});
|
||||
}
|
||||
render () {
|
||||
|
@ -251,7 +264,7 @@ class AddToStudioModal extends React.Component {
|
|||
<FormattedMessage id="general.close" />
|
||||
</div>
|
||||
</Button>
|
||||
{this.state.addToStudioWaiting ? [
|
||||
{this.state.waiting ? [
|
||||
<Button
|
||||
className="action-button submit-button"
|
||||
disabled="disabled"
|
||||
|
|
|
@ -87,6 +87,7 @@
|
|||
);
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
pointer-events: none; /* pass clicks through to buttons underneath */
|
||||
}
|
||||
|
||||
.studio-selector-button {
|
||||
|
|
|
@ -97,8 +97,8 @@ class PreviewPresentation extends React.Component {
|
|||
handleAddToStudioSubmit (studiosToAdd, studiosToLeave, callback) {
|
||||
console.log('studios to add: ');
|
||||
console.log(studiosToAdd);
|
||||
console.log('studios to delete: ');
|
||||
console.log(studiosToDelete);
|
||||
console.log('studios to leave: ');
|
||||
console.log(studiosToLeave);
|
||||
// const data = {
|
||||
// ...formData,
|
||||
// id: this.props.projectId,
|
||||
|
|
Loading…
Reference in a new issue