blob: 7bc3ef4e13f0ade1fba60556dc655c086b387f43 (
plain)
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
|
import { connect } from 'react-redux'
import actions from '../actions'
import MetasComponent from '../components/Metas'
const mapStateToProps = (state) => {
return {
metas: state.metas
}
}
const mapDispatchToProps = (dispatch) => {
return {
onUpdateDayTypes: (index, dayTypes) => {
let newDayTypes = dayTypes.slice(0)
newDayTypes[index] = !newDayTypes[index]
dispatch(actions.updateDayTypes(newDayTypes))
dispatch(actions.updateCurrentMonthFromDaytypes(newDayTypes))
},
onUpdateComment: (comment) => {
dispatch(actions.updateComment(comment))
},
onUpdateColor: (color) => {
dispatch(actions.updateColor(color))
},
onSelect2Tags: (e) => {
e.preventDefault()
$(e.target).find('[data-select2-tag]').remove()
dispatch(actions.select2Tags(e.params.data))
},
onUnselect2Tags: (e) => {
e.preventDefault()
dispatch(actions.unselect2Tags(e.params.data))
}
}
}
const Metas = connect(mapStateToProps, mapDispatchToProps)(MetasComponent)
export default Metas
|