-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathInstructions.js
More file actions
41 lines (38 loc) · 1.04 KB
/
Instructions.js
File metadata and controls
41 lines (38 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import {connect} from 'react-redux';
import Instructions from '../components/Instructions';
import {
getCurrentProjectInstructions,
getCurrentProjectKey,
getHiddenUIComponents,
isEditingInstructions,
} from '../selectors';
import {
cancelEditingInstructions,
continueEditingInstructions,
updateProjectInstructions,
} from '../actions';
function mapStateToProps(state) {
return {
instructions: getCurrentProjectInstructions(state),
isEditing: isEditingInstructions(state),
isOpen: !getHiddenUIComponents(state).includes('instructions'),
projectKey: getCurrentProjectKey(state),
};
}
function mapDispatchToProps(dispatch) {
return {
onCancelEditing() {
dispatch(cancelEditingInstructions());
},
onContinueEditing(projectKey, newValue) {
dispatch(continueEditingInstructions(projectKey, newValue));
},
onSaveChanges(projectKey, newValue) {
dispatch(updateProjectInstructions(projectKey, newValue));
},
};
}
export default connect(
mapStateToProps,
mapDispatchToProps,
)(Instructions);