Fix all linting errors/warnings
This commit is contained in:
parent
59469d9f85
commit
14a8f48fd5
6 changed files with 45 additions and 22 deletions
|
@ -69,7 +69,12 @@ const CollectionPopover = ({
|
||||||
const handleSelect = inCollection ? handleRemoveFromCollection : handleAddToCollection;
|
const handleSelect = inCollection ? handleRemoveFromCollection : handleAddToCollection;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Item inCollection={inCollection} key={collection.id} collection={collection} onSelect={() => handleSelect(collection.id)} />
|
<Item
|
||||||
|
inCollection={inCollection}
|
||||||
|
key={collection.id}
|
||||||
|
collection={collection}
|
||||||
|
onSelect={() => handleSelect(collection.id)}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -89,7 +94,12 @@ const CollectionPopover = ({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="collection-popover__filter">
|
<div className="collection-popover__filter">
|
||||||
<Searchbar searchLabel="Search collections..." searchTerm={searchTerm} setSearchTerm={setSearchTerm} resetSearchTerm={() => setSearchTerm('')} />
|
<Searchbar
|
||||||
|
searchLabel="Search collections..."
|
||||||
|
searchTerm={searchTerm}
|
||||||
|
setSearchTerm={setSearchTerm}
|
||||||
|
resetSearchTerm={() => setSearchTerm('')}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="collection-popover__items">
|
<div className="collection-popover__items">
|
||||||
|
|
|
@ -256,7 +256,12 @@ class SketchListRowBase extends React.Component {
|
||||||
</button>
|
</button>
|
||||||
</li>}
|
</li>}
|
||||||
</ul>}
|
</ul>}
|
||||||
{this.state.showPopover && <CollectionPopover onClose={this.handleCloseCollectionPopover} project={this.props.sketch} />}
|
{this.state.showPopover &&
|
||||||
|
<CollectionPopover
|
||||||
|
onClose={this.handleCloseCollectionPopover}
|
||||||
|
project={this.props.sketch}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -446,7 +451,8 @@ class SketchList extends React.Component {
|
||||||
addMode={this.props.addMode}
|
addMode={this.props.addMode}
|
||||||
onCollectionAdd={() => this.handleCollectionAdd(sketch.id)}
|
onCollectionAdd={() => this.handleCollectionAdd(sketch.id)}
|
||||||
onCollectionRemove={() => this.handleCollectionRemove(sketch.id)}
|
onCollectionRemove={() => this.handleCollectionRemove(sketch.id)}
|
||||||
inCollection={this.props.collection && this.props.collection.items.find(item => item.project.id === sketch.id) != null}
|
inCollection={this.props.collection &&
|
||||||
|
this.props.collection.items.find(item => item.project.id === sketch.id) != null}
|
||||||
/>))}
|
/>))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>}
|
</table>}
|
||||||
|
@ -505,7 +511,10 @@ function mapStateToProps(state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
function mapDispatchToProps(dispatch) {
|
||||||
return bindActionCreators(Object.assign({}, ProjectsActions, CollectionsActions, ToastActions, SortingActions), dispatch);
|
return bindActionCreators(
|
||||||
|
Object.assign({}, ProjectsActions, CollectionsActions, ToastActions, SortingActions),
|
||||||
|
dispatch
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(SketchList);
|
export default connect(mapStateToProps, mapDispatchToProps)(SketchList);
|
||||||
|
|
|
@ -29,9 +29,6 @@ import * as ToastActions from '../actions/toast';
|
||||||
import * as ConsoleActions from '../actions/console';
|
import * as ConsoleActions from '../actions/console';
|
||||||
import { getHTMLFile } from '../reducers/files';
|
import { getHTMLFile } from '../reducers/files';
|
||||||
import Overlay from '../../App/components/Overlay';
|
import Overlay from '../../App/components/Overlay';
|
||||||
import SketchList from '../components/SketchList';
|
|
||||||
import Searchbar from '../components/Searchbar';
|
|
||||||
import AssetList from '../components/AssetList';
|
|
||||||
import About from '../components/About';
|
import About from '../components/About';
|
||||||
import CollectionList from '../components/CollectionList';
|
import CollectionList from '../components/CollectionList';
|
||||||
import Feedback from '../components/Feedback';
|
import Feedback from '../components/Feedback';
|
||||||
|
|
|
@ -162,7 +162,7 @@ class CollectionItemRowBase extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { item, username } = this.props;
|
const { item } = this.props;
|
||||||
const { renameOpen, optionsOpen, renameValue } = this.state;
|
const { renameOpen, optionsOpen, renameValue } = this.state;
|
||||||
const sketchOwnerUsername = item.project.user.username;
|
const sketchOwnerUsername = item.project.user.username;
|
||||||
const userIsOwner = this.props.user.username === sketchOwnerUsername;
|
const userIsOwner = this.props.user.username === sketchOwnerUsername;
|
||||||
|
@ -285,7 +285,9 @@ class Collection extends React.Component {
|
||||||
isOwner() {
|
isOwner() {
|
||||||
let isOwner = false;
|
let isOwner = false;
|
||||||
|
|
||||||
if (this.props.user != null && this.props.user.username && this.props.collection.owner.username === this.props.user.username) {
|
if (this.props.user != null &&
|
||||||
|
this.props.user.username &&
|
||||||
|
this.props.collection.owner.username === this.props.user.username) {
|
||||||
isOwner = true;
|
isOwner = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +309,7 @@ class Collection extends React.Component {
|
||||||
|
|
||||||
_renderCollectionMetadata() {
|
_renderCollectionMetadata() {
|
||||||
const {
|
const {
|
||||||
id, name, description, items, owner, slug
|
id, name, description, items, owner
|
||||||
} = this.props.collection;
|
} = this.props.collection;
|
||||||
|
|
||||||
const hostname = window.location.origin;
|
const hostname = window.location.origin;
|
||||||
|
@ -331,13 +333,16 @@ class Collection extends React.Component {
|
||||||
this.props.editCollection(id, { description: value });
|
this.props.editCollection(id, { description: value });
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEditCollectionSlug = (value) => {
|
//
|
||||||
if (value === slug) {
|
// TODO: Implement UI for editing slug
|
||||||
return;
|
//
|
||||||
}
|
// const handleEditCollectionSlug = (value) => {
|
||||||
|
// if (value === slug) {
|
||||||
this.props.editCollection(id, { slug: value });
|
// return;
|
||||||
};
|
// }
|
||||||
|
//
|
||||||
|
// this.props.editCollection(id, { slug: value });
|
||||||
|
// };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`collection-metadata ${this.isOwner() ? 'collection-metadata--is-owner' : ''}`}>
|
<div className={`collection-metadata ${this.isOwner() ? 'collection-metadata--is-owner' : ''}`}>
|
||||||
|
@ -518,7 +523,10 @@ function mapStateToProps(state, ownProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapDispatchToProps(dispatch) {
|
function mapDispatchToProps(dispatch) {
|
||||||
return bindActionCreators(Object.assign({}, CollectionsActions, ProjectsActions, ToastActions, SortingActions), dispatch);
|
return bindActionCreators(
|
||||||
|
Object.assign({}, CollectionsActions, ProjectsActions, ToastActions, SortingActions),
|
||||||
|
dispatch
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(Collection);
|
export default connect(mapStateToProps, mapDispatchToProps)(Collection);
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Overlay from '../../App/components/Overlay';
|
||||||
import AssetList from '../../IDE/components/AssetList';
|
import AssetList from '../../IDE/components/AssetList';
|
||||||
import CollectionList from '../../IDE/components/CollectionList';
|
import CollectionList from '../../IDE/components/CollectionList';
|
||||||
import SketchList from '../../IDE/components/SketchList';
|
import SketchList from '../../IDE/components/SketchList';
|
||||||
import Searchbar from '../../IDE/components/Searchbar';
|
import SketchSearchbar from '../../IDE/components/Searchbar';
|
||||||
|
|
||||||
import CollectionCreate from '../components/CollectionCreate';
|
import CollectionCreate from '../components/CollectionCreate';
|
||||||
import DashboardTabSwitcher, { TabKey } from '../components/DashboardTabSwitcher';
|
import DashboardTabSwitcher, { TabKey } from '../components/DashboardTabSwitcher';
|
||||||
|
@ -85,7 +85,7 @@ class DashboardView extends React.Component {
|
||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Searchbar />
|
<SketchSearchbar />
|
||||||
<Link className="dashboard__action-button" to="/">New sketch</Link>
|
<Link className="dashboard__action-button" to="/">New sketch</Link>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Collection from '../../models/collection';
|
import Collection from '../../models/collection';
|
||||||
import Project from '../../models/project';
|
|
||||||
|
|
||||||
export default function addProjectToCollection(req, res) {
|
export default function addProjectToCollection(req, res) {
|
||||||
const owner = req.user._id;
|
const owner = req.user._id;
|
||||||
|
|
Loading…
Reference in a new issue