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 Loader from '../../App/components/loader';
|
||||||
import QuickAddList from './QuickAddList';
|
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 {
|
class CollectionList extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -55,7 +56,6 @@ class CollectionList extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const username = this.props.username !== undefined ? this.props.username : this.props.user.username;
|
|
||||||
const { collections, project } = this.props;
|
const { collections, project } = this.props;
|
||||||
const hasCollections = collections.length > 0;
|
const hasCollections = collections.length > 0;
|
||||||
const collectionWithSketchStatus = collections.map(collection => ({
|
const collectionWithSketchStatus = collections.map(collection => ({
|
||||||
|
@ -69,7 +69,13 @@ class CollectionList extends React.Component {
|
||||||
if (this.props.loading && !this.state.hasLoadedData) {
|
if (this.props.loading && !this.state.hasLoadedData) {
|
||||||
content = <Loader />;
|
content = <Loader />;
|
||||||
} else if (hasCollections) {
|
} else if (hasCollections) {
|
||||||
content = <QuickAddList items={collectionWithSketchStatus} onAdd={this.handleCollectionAdd} onRemove={this.handleCollectionRemove} />;
|
content = (
|
||||||
|
<QuickAddList
|
||||||
|
items={collectionWithSketchStatus}
|
||||||
|
onAdd={this.handleCollectionAdd}
|
||||||
|
onRemove={this.handleCollectionRemove}
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
content = 'No collections';
|
content = 'No collections';
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,13 @@ class SketchList extends React.Component {
|
||||||
if (this.props.loading && this.state.isInitialDataLoad) {
|
if (this.props.loading && this.state.isInitialDataLoad) {
|
||||||
content = <Loader />;
|
content = <Loader />;
|
||||||
} else if (hasSketches) {
|
} else if (hasSketches) {
|
||||||
content = <QuickAddList items={sketchesWithAddedStatus} onAdd={this.handleCollectionAdd} onRemove={this.handleCollectionRemove} />;
|
content = (
|
||||||
|
<QuickAddList
|
||||||
|
items={sketchesWithAddedStatus}
|
||||||
|
onAdd={this.handleCollectionAdd}
|
||||||
|
onRemove={this.handleCollectionRemove}
|
||||||
|
/>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
content = 'No collections';
|
content = 'No collections';
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,9 +141,17 @@ class CollectionList extends React.Component {
|
||||||
</table>}
|
</table>}
|
||||||
{
|
{
|
||||||
this.state.addingSketchesToCollectionId && (
|
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">
|
<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>
|
</div>
|
||||||
</Overlay>
|
</Overlay>
|
||||||
)
|
)
|
||||||
|
|
|
@ -256,7 +256,8 @@ class Collection extends React.Component {
|
||||||
|
|
||||||
_renderEmptyTable() {
|
_renderEmptyTable() {
|
||||||
const isLoading = this.props.loading;
|
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) {
|
if (!isLoading && !hasCollectionItems) {
|
||||||
return (<p className="collection-empty-message">No sketches in collection</p>);
|
return (<p className="collection-empty-message">No sketches in collection</p>);
|
||||||
|
@ -321,7 +322,12 @@ class Collection extends React.Component {
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
this.state.isAddingSketches && (
|
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">
|
<div className="collection-add-sketch">
|
||||||
<AddToCollectionSketchList username={this.props.username} collection={this.props.collection} />
|
<AddToCollectionSketchList username={this.props.username} collection={this.props.collection} />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue