Fix eslint errors
This commit is contained in:
parent
067e065c1b
commit
c84f590290
6 changed files with 56 additions and 23 deletions
|
@ -36,6 +36,7 @@ class CollectionList extends React.Component {
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (prevProps.loading === true && this.props.loading === false) {
|
if (prevProps.loading === true && this.props.loading === false) {
|
||||||
|
// eslint-disable-next-line react/no-did-update-set-state
|
||||||
this.setState({
|
this.setState({
|
||||||
hasLoadedData: true,
|
hasLoadedData: true,
|
||||||
});
|
});
|
||||||
|
@ -142,11 +143,14 @@ const ItemsShape = PropTypes.shape({
|
||||||
});
|
});
|
||||||
|
|
||||||
CollectionList.propTypes = {
|
CollectionList.propTypes = {
|
||||||
|
addMode: PropTypes.bool,
|
||||||
user: PropTypes.shape({
|
user: PropTypes.shape({
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
authenticated: PropTypes.bool.isRequired
|
authenticated: PropTypes.bool.isRequired
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
projectId: PropTypes.string.isRequired,
|
||||||
getCollections: PropTypes.func.isRequired,
|
getCollections: PropTypes.func.isRequired,
|
||||||
|
getProject: PropTypes.func.isRequired,
|
||||||
collections: PropTypes.arrayOf(PropTypes.shape({
|
collections: PropTypes.arrayOf(PropTypes.shape({
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
@ -172,6 +176,7 @@ CollectionList.propTypes = {
|
||||||
};
|
};
|
||||||
|
|
||||||
CollectionList.defaultProps = {
|
CollectionList.defaultProps = {
|
||||||
|
addMode: false,
|
||||||
project: {
|
project: {
|
||||||
id: undefined,
|
id: undefined,
|
||||||
owner: undefined
|
owner: undefined
|
||||||
|
|
|
@ -204,7 +204,7 @@ class CollectionListRowBase extends React.Component {
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -236,6 +236,10 @@ CollectionListRowBase.propTypes = {
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired
|
name: PropTypes.string.isRequired
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
addMode: PropTypes.bool.isRequired,
|
||||||
|
project: PropTypes.shape({
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
user: PropTypes.shape({
|
user: PropTypes.shape({
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
|
|
|
@ -212,20 +212,16 @@ class SketchListRowBase extends React.Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
renderAddRemoveButtons = () => {
|
renderAddRemoveButtons = () => (
|
||||||
return (
|
|
||||||
<td className="sketch-list__dropdown-column">{
|
<td className="sketch-list__dropdown-column">{
|
||||||
this.props.inCollection ?
|
this.props.inCollection ?
|
||||||
<AddRemoveButton type="remove" onClick={this.props.onCollectionRemove} /> :
|
<AddRemoveButton type="remove" onClick={this.props.onCollectionRemove} /> :
|
||||||
<AddRemoveButton type="add" onClick={this.props.onCollectionAdd} />
|
<AddRemoveButton type="add" onClick={this.props.onCollectionAdd} />
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
);
|
)
|
||||||
}
|
|
||||||
|
|
||||||
renderActions = () => {
|
renderActions = () => (this.props.addMode === true ? this.renderAddRemoveButtons() : this.renderDropdown())
|
||||||
return this.props.addMode === true ? this.renderAddRemoveButtons() : this.renderDropdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { sketch, username } = this.props;
|
const { sketch, username } = this.props;
|
||||||
|
@ -262,6 +258,8 @@ class SketchListRowBase extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
SketchListRowBase.propTypes = {
|
SketchListRowBase.propTypes = {
|
||||||
|
addMode: PropTypes.bool.isRequired,
|
||||||
|
inCollection: PropTypes.bool.isRequired,
|
||||||
sketch: PropTypes.shape({
|
sketch: PropTypes.shape({
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired
|
name: PropTypes.string.isRequired
|
||||||
|
@ -275,7 +273,9 @@ SketchListRowBase.propTypes = {
|
||||||
showShareModal: PropTypes.func.isRequired,
|
showShareModal: PropTypes.func.isRequired,
|
||||||
cloneProject: PropTypes.func.isRequired,
|
cloneProject: PropTypes.func.isRequired,
|
||||||
exportProjectAsZip: PropTypes.func.isRequired,
|
exportProjectAsZip: PropTypes.func.isRequired,
|
||||||
changeProjectName: PropTypes.func.isRequired
|
changeProjectName: PropTypes.func.isRequired,
|
||||||
|
onCollectionAdd: PropTypes.func.isRequired,
|
||||||
|
onCollectionRemove: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
function mapDispatchToPropsSketchListRow(dispatch) {
|
function mapDispatchToPropsSketchListRow(dispatch) {
|
||||||
|
@ -394,6 +394,15 @@ SketchList.propTypes = {
|
||||||
createdAt: PropTypes.string.isRequired,
|
createdAt: PropTypes.string.isRequired,
|
||||||
updatedAt: PropTypes.string.isRequired
|
updatedAt: PropTypes.string.isRequired
|
||||||
})).isRequired,
|
})).isRequired,
|
||||||
|
collection: PropTypes.shape({
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({
|
||||||
|
project: PropTypes.shape({
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
}),
|
||||||
|
})),
|
||||||
|
}).isRequired,
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
loading: PropTypes.bool.isRequired,
|
loading: PropTypes.bool.isRequired,
|
||||||
toggleDirectionForField: PropTypes.func.isRequired,
|
toggleDirectionForField: PropTypes.func.isRequired,
|
||||||
|
@ -402,14 +411,13 @@ SketchList.propTypes = {
|
||||||
field: PropTypes.string.isRequired,
|
field: PropTypes.string.isRequired,
|
||||||
direction: PropTypes.string.isRequired
|
direction: PropTypes.string.isRequired
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
addToCollection: PropTypes.func.isRequired,
|
||||||
|
removeFromCollection: PropTypes.func.isRequired,
|
||||||
addMode: PropTypes.bool,
|
addMode: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
SketchList.defaultProps = {
|
SketchList.defaultProps = {
|
||||||
project: {
|
addMode: false,
|
||||||
id: undefined,
|
|
||||||
owner: undefined
|
|
||||||
},
|
|
||||||
username: undefined
|
username: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ const ShareURL = ({ value }) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ShareURL.propTypes = {
|
||||||
|
value: PropTypes.string.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
class CollectionItemRowBase extends React.Component {
|
class CollectionItemRowBase extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -229,6 +233,11 @@ CollectionItemRowBase.propTypes = {
|
||||||
id: PropTypes.string.isRequired,
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired
|
name: PropTypes.string.isRequired
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
|
item: PropTypes.shape({
|
||||||
|
project: PropTypes.shape({
|
||||||
|
name: PropTypes.string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
}).isRequired,
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
user: PropTypes.shape({
|
user: PropTypes.shape({
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
|
@ -474,12 +483,19 @@ Collection.propTypes = {
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
getCollections: PropTypes.func.isRequired,
|
getCollections: PropTypes.func.isRequired,
|
||||||
collection: PropTypes.shape({
|
collection: PropTypes.shape({
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
name: PropTypes.string.isRequired,
|
name: PropTypes.string.isRequired,
|
||||||
|
slug: PropTypes.string,
|
||||||
description: PropTypes.string,
|
description: PropTypes.string,
|
||||||
|
owner: PropTypes.shape({
|
||||||
|
username: PropTypes.string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
items: PropTypes.arrayOf(PropTypes.shape({})),
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
username: PropTypes.string,
|
username: PropTypes.string,
|
||||||
loading: PropTypes.bool.isRequired,
|
loading: PropTypes.bool.isRequired,
|
||||||
toggleDirectionForField: PropTypes.func.isRequired,
|
toggleDirectionForField: PropTypes.func.isRequired,
|
||||||
|
editCollection: PropTypes.func.isRequired,
|
||||||
resetSorting: PropTypes.func.isRequired,
|
resetSorting: PropTypes.func.isRequired,
|
||||||
sorting: PropTypes.shape({
|
sorting: PropTypes.shape({
|
||||||
field: PropTypes.string.isRequired,
|
field: PropTypes.string.isRequired,
|
||||||
|
|
|
@ -89,7 +89,7 @@ CollectionView.propTypes = {
|
||||||
collection_id: PropTypes.string.isRequired,
|
collection_id: PropTypes.string.isRequired,
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
}).isRequired,
|
}).isRequired,
|
||||||
previousPath: PropTypes.string.isRequired,
|
// previousPath: PropTypes.string.isRequired,
|
||||||
theme: PropTypes.string.isRequired,
|
theme: PropTypes.string.isRequired,
|
||||||
user: PropTypes.shape({
|
user: PropTypes.shape({
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
|
|
Loading…
Reference in a new issue