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