Fix linter warnings
This commit is contained in:
parent
4d0aa23bb8
commit
a5b62567ef
4 changed files with 34 additions and 8 deletions
|
@ -13,7 +13,8 @@ import getSortedCollections from '../selectors/collections';
|
|||
import Loader from '../../App/components/loader';
|
||||
import QuickAddList from './QuickAddList';
|
||||
|
||||
const projectInCollection = (project, collection) => collection.items.find(item => item.project.id === project.id) != null;
|
||||
const projectInCollection = (project, collection) =>
|
||||
collection.items.find(item => item.project.id === project.id) != null;
|
||||
|
||||
class CollectionList extends React.Component {
|
||||
constructor(props) {
|
||||
|
@ -55,7 +56,6 @@ class CollectionList extends React.Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
const username = this.props.username !== undefined ? this.props.username : this.props.user.username;
|
||||
const { collections, project } = this.props;
|
||||
const hasCollections = collections.length > 0;
|
||||
const collectionWithSketchStatus = collections.map(collection => ({
|
||||
|
@ -69,7 +69,13 @@ class CollectionList extends React.Component {
|
|||
if (this.props.loading && !this.state.hasLoadedData) {
|
||||
content = <Loader />;
|
||||
} else if (hasCollections) {
|
||||
content = <QuickAddList items={collectionWithSketchStatus} onAdd={this.handleCollectionAdd} onRemove={this.handleCollectionRemove} />;
|
||||
content = (
|
||||
<QuickAddList
|
||||
items={collectionWithSketchStatus}
|
||||
onAdd={this.handleCollectionAdd}
|
||||
onRemove={this.handleCollectionRemove}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
content = 'No collections';
|
||||
}
|
||||
|
|
|
@ -60,7 +60,13 @@ class SketchList extends React.Component {
|
|||
if (this.props.loading && this.state.isInitialDataLoad) {
|
||||
content = <Loader />;
|
||||
} else if (hasSketches) {
|
||||
content = <QuickAddList items={sketchesWithAddedStatus} onAdd={this.handleCollectionAdd} onRemove={this.handleCollectionRemove} />;
|
||||
content = (
|
||||
<QuickAddList
|
||||
items={sketchesWithAddedStatus}
|
||||
onAdd={this.handleCollectionAdd}
|
||||
onRemove={this.handleCollectionRemove}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
content = 'No collections';
|
||||
}
|
||||
|
|
|
@ -141,9 +141,17 @@ class CollectionList extends React.Component {
|
|||
</table>}
|
||||
{
|
||||
this.state.addingSketchesToCollectionId && (
|
||||
<Overlay title="Add sketches" actions={<SketchSearchbar />} closeOverlay={this.hideAddSketches} isFixedHeight>
|
||||
<Overlay
|
||||
title="Add sketches"
|
||||
actions={<SketchSearchbar />}
|
||||
closeOverlay={this.hideAddSketches}
|
||||
isFixedHeight
|
||||
>
|
||||
<div className="collection-add-sketch">
|
||||
<AddToCollectionSketchList username={this.props.username} collection={find(this.props.collections, { id: this.state.addingSketchesToCollectionId })} />
|
||||
<AddToCollectionSketchList
|
||||
username={this.props.username}
|
||||
collection={find(this.props.collections, { id: this.state.addingSketchesToCollectionId })}
|
||||
/>
|
||||
</div>
|
||||
</Overlay>
|
||||
)
|
||||
|
|
|
@ -256,7 +256,8 @@ class Collection extends React.Component {
|
|||
|
||||
_renderEmptyTable() {
|
||||
const isLoading = this.props.loading;
|
||||
const hasCollectionItems = this.props.collection != null && this.props.collection.items.length > 0;
|
||||
const hasCollectionItems = this.props.collection != null &&
|
||||
this.props.collection.items.length > 0;
|
||||
|
||||
if (!isLoading && !hasCollectionItems) {
|
||||
return (<p className="collection-empty-message">No sketches in collection</p>);
|
||||
|
@ -321,7 +322,12 @@ class Collection extends React.Component {
|
|||
}
|
||||
{
|
||||
this.state.isAddingSketches && (
|
||||
<Overlay title="Add sketches" actions={<SketchSearchbar />} closeOverlay={this.hideAddSketches} isFixedHeight>
|
||||
<Overlay
|
||||
title="Add sketches"
|
||||
actions={<SketchSearchbar />}
|
||||
closeOverlay={this.hideAddSketches}
|
||||
isFixedHeight
|
||||
>
|
||||
<div className="collection-add-sketch">
|
||||
<AddToCollectionSketchList username={this.props.username} collection={this.props.collection} />
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue