Fix PropType Errors

This commit is contained in:
Cassie Tarakajian 2020-02-04 18:40:54 -05:00
parent 01665fde54
commit 1ef4b66727
5 changed files with 9 additions and 27 deletions

View file

@ -86,8 +86,8 @@ AssetList.propTypes = {
key: PropTypes.string.isRequired, key: PropTypes.string.isRequired,
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
url: PropTypes.string.isRequired, url: PropTypes.string.isRequired,
sketchName: PropTypes.string.isRequired, sketchName: PropTypes.string,
sketchId: PropTypes.string.isRequired sketchId: PropTypes.string
})).isRequired, })).isRequired,
getAssets: PropTypes.func.isRequired, getAssets: PropTypes.func.isRequired,
loading: PropTypes.bool.isRequired loading: PropTypes.bool.isRequired

View file

@ -62,7 +62,6 @@ class CollectionList extends React.Component {
} }
hideAddSketches = () => { hideAddSketches = () => {
console.log('hideAddSketches');
this.setState({ this.setState({
addingSketchesToCollectionId: null, addingSketchesToCollectionId: null,
}); });
@ -161,28 +160,12 @@ class CollectionList extends React.Component {
} }
} }
const ProjectShape = PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
createdAt: PropTypes.string.isRequired,
updatedAt: PropTypes.string.isRequired,
user: PropTypes.shape({
username: PropTypes.string.isRequired
}).isRequired,
});
const ItemsShape = PropTypes.shape({
createdAt: PropTypes.string.isRequired,
updatedAt: PropTypes.string.isRequired,
project: ProjectShape
});
CollectionList.propTypes = { CollectionList.propTypes = {
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, projectId: PropTypes.string,
getCollections: PropTypes.func.isRequired, getCollections: PropTypes.func.isRequired,
getProject: PropTypes.func.isRequired, getProject: PropTypes.func.isRequired,
collections: PropTypes.arrayOf(PropTypes.shape({ collections: PropTypes.arrayOf(PropTypes.shape({
@ -191,7 +174,6 @@ CollectionList.propTypes = {
description: PropTypes.string, description: PropTypes.string,
createdAt: PropTypes.string.isRequired, createdAt: PropTypes.string.isRequired,
updatedAt: PropTypes.string.isRequired, updatedAt: PropTypes.string.isRequired,
items: PropTypes.arrayOf(ItemsShape),
})).isRequired, })).isRequired,
username: PropTypes.string, username: PropTypes.string,
loading: PropTypes.bool.isRequired, loading: PropTypes.bool.isRequired,
@ -210,6 +192,7 @@ CollectionList.propTypes = {
}; };
CollectionList.defaultProps = { CollectionList.defaultProps = {
projectId: undefined,
project: { project: {
id: undefined, id: undefined,
owner: undefined owner: undefined
@ -224,7 +207,7 @@ function mapStateToProps(state, ownProps) {
sorting: state.sorting, sorting: state.sorting,
loading: state.loading, loading: state.loading,
project: state.project, project: state.project,
projectId: ownProps && ownProps.params ? ownProps.prams.project_id : null, projectId: ownProps && ownProps.params ? ownProps.params.project_id : null,
}; };
} }

View file

@ -235,9 +235,6 @@ CollectionListRowBase.propTypes = {
}) })
})) }))
}).isRequired, }).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,

View file

@ -23,7 +23,9 @@ const ItemType = PropTypes.shape({
}); });
Item.propTypes = { Item.propTypes = {
...ItemType, name: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
isAdded: PropTypes.bool.isRequired,
onSelect: PropTypes.func.isRequired, onSelect: PropTypes.func.isRequired,
}; };

View file

@ -171,7 +171,7 @@ DashboardView.propTypes = {
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,
}), }),
}; };