Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Feb 16, 2017
1 parent dd945a2 commit 398c997
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/app/js/characteristic/DatasetCharacteristicItem.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { PropTypes } from 'react';
import React from 'react';
import { connect } from 'react-redux';
import Property from '../lib/Property';
import { getFieldByName } from '../publication';
import { field as fieldPropTypes } from '../propTypes';
import { field as fieldPropTypes, resource as resourcePropTypes } from '../propTypes';

const DatasetCharacteristicItemComponent = ({ resource, field }) => (
<Property resource={resource} field={field} />
);

DatasetCharacteristicItemComponent.propTypes = {
resource: PropTypes.object.isRequired, // eslint-disable-line
resource: resourcePropTypes.isRequired,
field: fieldPropTypes.isRequired,
};

Expand Down
18 changes: 15 additions & 3 deletions src/app/js/lib/Property.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import compose from 'recompose/compose';
import translate from 'redux-polyglot/translate';
Expand All @@ -7,7 +7,12 @@ import {
getResourceUnvalidatedFields,
getResourceContributorsByField,
} from '../resource';
import { property as propertyPropTypes } from '../propTypes';
import {
contributor as contributorPropTypes,
field as fieldPropTypes,
polyglot as polyglotPropTypes,
resource as resourcePropTypes,
} from '../propTypes';
import { getCollectionFields } from '../publication';
import Format from '../formats/Format';

Expand Down Expand Up @@ -50,7 +55,14 @@ const PropertyComponent = ({ field, fields, resource, contributors, unValidatedF
</dl>
);

PropertyComponent.propTypes = propertyPropTypes;
PropertyComponent.propTypes = {
contributors: PropTypes.arrayOf(contributorPropTypes).isRequired,
field: fieldPropTypes.isRequired,
fields: PropTypes.arrayOf(fieldPropTypes).isRequired,
p: polyglotPropTypes.isRequired,
resource: resourcePropTypes.isRequired,
unValidatedFields: PropTypes.arrayOf(PropTypes.string).isRequired,
};

const mapStateToProps = state => ({
unValidatedFields: getResourceUnvalidatedFields(state),
Expand Down
6 changes: 6 additions & 0 deletions src/app/js/propTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ export const field = PropTypes.shape({
scheme: PropTypes.string,
});

export const resource = PropTypes.shape({
uri: PropTypes.string.isRequired,
});

export const contributor = PropTypes.object;

export const property = PropTypes.shape({
name: PropTypes.string.isRequired,
value: PropTypes.any.isRequired,
Expand Down

0 comments on commit 398c997

Please sign in to comment.