cleaned up debug code, formatting of addtostudio buttons

This commit is contained in:
Ben Wheeler 2018-06-19 12:59:27 -04:00
parent 1b874b748c
commit db4e64e4c7
3 changed files with 21 additions and 22 deletions

8
package-lock.json generated
View file

@ -6646,6 +6646,12 @@
"lodash.keysin": "3.0.8" "lodash.keysin": "3.0.8"
} }
}, },
"lodash.truncate": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.truncate/-/lodash.truncate-4.4.2.tgz",
"integrity": "sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM=",
"dev": true
},
"lodash.uniq": { "lodash.uniq": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz",
@ -11605,7 +11611,7 @@
"integrity": "sha512-FYw4Gj5izHp3aReM5V6YXCCTrtfkVdj7t2F20RmaR62qO0xqBhWdPPq3uYh7+ol6w0/lQZuwi9h4A41WFvQbYA==" "integrity": "sha512-FYw4Gj5izHp3aReM5V6YXCCTrtfkVdj7t2F20RmaR62qO0xqBhWdPPq3uYh7+ol6w0/lQZuwi9h4A41WFvQbYA=="
}, },
"scratchr2_translations": { "scratchr2_translations": {
"version": "git://github.com/LLK/scratchr2_translations.git#6e88ec9ada4e7131e87a05f31b7432f9c2b153e7", "version": "git://github.com/LLK/scratchr2_translations.git#89f8eb1e09c034f39b98eb3b356ca9cfcf02d670",
"dev": true "dev": true
}, },
"scss-tokenizer": { "scss-tokenizer": {

View file

@ -73,7 +73,6 @@ class AddToStudioModal extends React.Component {
// them too; otherwise we might retain a dirty change for a studio // them too; otherwise we might retain a dirty change for a studio
// we no longer have permission for. In theory. // we no longer have permission for. In theory.
debugger;
let onOrDirty = this.state.onOrDirty; let onOrDirty = this.state.onOrDirty;
projectStudios.forEach((studio) => { projectStudios.forEach((studio) => {
onOrDirty[studio.id] = {added: true, dirty: false}; onOrDirty[studio.id] = {added: true, dirty: false};
@ -82,7 +81,6 @@ class AddToStudioModal extends React.Component {
console.log(myStudios); console.log(myStudios);
console.log(onOrDirty); console.log(onOrDirty);
this.setState({onOrDirty: Object.assign({}, onOrDirty)}); this.setState({onOrDirty: Object.assign({}, onOrDirty)});
this.setState({testkey2: 'testval2'});
} }
handleToggleAdded(studioId) { handleToggleAdded(studioId) {
@ -143,17 +141,12 @@ class AddToStudioModal extends React.Component {
// When this modal is opened, and isOpen becomes true, // When this modal is opened, and isOpen becomes true,
// onOrDirty should start with a clean slate // onOrDirty should start with a clean slate
// NOTE: this doesn't seem to be working: // NOTE: this doesn't seem to be working:
this.setState({ onOrDirty: undefined }); this.setState({ onOrDirty: undefined }, () => {
// what's weird is, it's not an issue with "this" being invalid, this.props.onAddToStudio(studiosToAdd, studiosToDelete, err => {
// because this works fine: if (err) log.error(err);
this.setState({testkey: 'testval'}); this.setState({
waiting: false
});
debugger;
this.props.onAddToStudio(studiosToAdd, studiosToDelete, err => {
if (err) log.error(err);
this.setState({
waiting: false
}); });
}); });
} }
@ -178,8 +171,8 @@ class AddToStudioModal extends React.Component {
onClick={() => this.handleToggleAdded(studio.id)} onClick={() => this.handleToggleAdded(studio.id)}
> >
{truncate(studio.title, {'length': 20, 'separator': /[,:\.;]*\s+/})} {truncate(studio.title, {'length': 20, 'separator': /[,:\.;]*\s+/})}
<div className={".studio-status-icon" + <div className={"studio-status-icon" +
(isAdded ? " .studio-status-icon-selected" : "")} (isAdded ? " studio-status-icon-selected" : "")}
> >
{isAdded ? "✓" : "+"} {isAdded ? "✓" : "+"}
</div> </div>

View file

@ -68,12 +68,10 @@
justify-content: flex-start; justify-content: flex-start;
flex-flow: row wrap; flex-flow: row wrap;
padding: 1rem 3rem; padding: 1rem 3rem;
min-height: 30rem;
} }
/* NOTE: force scrolling: add to above: /* NOTE: force scrolling: add to above:
min-height: 30rem; min-height: 30rem;
*/ */
.studio-selector-button { .studio-selector-button {
background-color: $ui-white; background-color: $ui-white;
@ -85,6 +83,8 @@
border-radius: 0.5rem; border-radius: 0.5rem;
box-sizing: border-box; box-sizing: border-box;
width: 40%; width: 40%;
display: flex;
justify-content: space-between;
} }
.studio-selector-button-selected { .studio-selector-button-selected {
@ -94,11 +94,11 @@
.studio-status-icon { .studio-status-icon {
background-color: $ui-blue; background-color: $ui-blue;
color: $type-gray; color: $ui-white;
font-weight: 800; font-weight: 800;
height: 1.5rem; height: 1.5rem;
margin: 0.5rem 0.5rem; margin: 0rem 0rem;
padding: 0.5rem 0.5rem; padding: 0rem 0.5rem;
border-radius: 0.75rem; border-radius: 0.75rem;
box-sizing: border-box; box-sizing: border-box;
width: 1.5rem; width: 1.5rem;