Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/components/dates/DatePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class DatePicker extends React.Component {
}

onChange(event) {
this.props.dispatch(setDate(event.target.value, this.props.onChangeAction));
this.props.setDate(event.target.value, this.props.onChangeAction);
}

render() {
Expand All @@ -32,16 +32,19 @@ export class DatePicker extends React.Component {
}

DatePicker.propTypes = {
value: PropTypes.string,
setDate: PropTypes.func,
dispatch: PropTypes.func,
colour: PropTypes.string,
onChangeAction: PropTypes.string,
setDate: PropTypes.func,
title: PropTypes.string,
colour: PropTypes.string
value: PropTypes.string,
};

const mapStateToProps = state => ({
value: state.value
const mapStateToProps = (state) => ({
value: state.value,
});

const mapDispatchToProps = (dispatch) => ({
setDate: (value, dateActionType) => dispatch(setDate(value, dateActionType)),
});

export default connect(mapStateToProps)(DatePicker);
export default connect(mapStateToProps, mapDispatchToProps)(DatePicker);
17 changes: 10 additions & 7 deletions src/components/status/StatusSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class StatusSelector extends React.Component {
}

onChange(event) {
this.props.dispatch(setStatus(event.target.value));
this.props.setStatus(event.target.value);
}

render() {
Expand All @@ -26,7 +26,7 @@ export class StatusSelector extends React.Component {
id="status"
>
<option value="">All</option>
{Object.keys(STATUSES).map(status => (
{Object.keys(STATUSES).map((status) => (
<option value={status} key={status}>
{status}
</option>
Expand All @@ -39,13 +39,16 @@ export class StatusSelector extends React.Component {
}

StatusSelector.propTypes = {
value: PropTypes.string,
setStatus: PropTypes.func,
dispatch: PropTypes.func
value: PropTypes.string,
};

const mapStateToProps = state => ({
value: state.value
const mapStateToProps = (state) => ({
value: state.value,
});

const mapDispatchToProps = (dispatch) => ({
setStatus: (status) => dispatch(setStatus(status)),
});

export default connect(mapStateToProps)(StatusSelector);
export default connect(mapStateToProps, mapDispatchToProps)(StatusSelector);
11 changes: 7 additions & 4 deletions src/components/type/TypeSelector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class TypeSelector extends React.Component {
return option.value;
});
}
this.props.dispatch(setType(types));
this.props.setType(types);
}

render() {
Expand Down Expand Up @@ -45,13 +45,16 @@ export class TypeSelector extends React.Component {
}

TypeSelector.propTypes = {
value: PropTypes.string,
setType: PropTypes.func,
dispatch: PropTypes.func,
value: PropTypes.string,
};

const mapStateToProps = (state) => ({
value: state.value,
});

export default connect(mapStateToProps)(TypeSelector);
const mapDispatchToProps = (dispatch) => ({
setType: (types) => dispatch(setType(types)),
});

export default connect(mapStateToProps, mapDispatchToProps)(TypeSelector);