No need for bindActionCreators
parent
d855524199
commit
98a1b97574
|
@ -10,7 +10,6 @@ import * as schema from 'src/shared/schemas'
|
||||||
import {ADDING, TEMP_ANNOTATION} from 'src/shared/annotations/helpers'
|
import {ADDING, TEMP_ANNOTATION} from 'src/shared/annotations/helpers'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addAnnotation,
|
|
||||||
updateAnnotation,
|
updateAnnotation,
|
||||||
deleteAnnotation,
|
deleteAnnotation,
|
||||||
addingAnnotationSuccess,
|
addingAnnotationSuccess,
|
||||||
|
@ -34,7 +33,6 @@ class Annotations extends Component {
|
||||||
const {
|
const {
|
||||||
mode,
|
mode,
|
||||||
isTempHovering,
|
isTempHovering,
|
||||||
handleAddAnnotation,
|
|
||||||
handleUpdateAnnotation,
|
handleUpdateAnnotation,
|
||||||
handleDeleteAnnotation,
|
handleDeleteAnnotation,
|
||||||
handleDismissAddingAnnotation,
|
handleDismissAddingAnnotation,
|
||||||
|
@ -59,7 +57,6 @@ class Annotations extends Component {
|
||||||
<NewAnnotation
|
<NewAnnotation
|
||||||
dygraph={dygraph}
|
dygraph={dygraph}
|
||||||
tempAnnotation={tempAnnotation}
|
tempAnnotation={tempAnnotation}
|
||||||
onAddAnnotation={handleAddAnnotation}
|
|
||||||
onDismissAddingAnnotation={handleDismissAddingAnnotation}
|
onDismissAddingAnnotation={handleDismissAddingAnnotation}
|
||||||
onAddingAnnotationSuccess={handleAddingAnnotationSuccess}
|
onAddingAnnotationSuccess={handleAddingAnnotationSuccess}
|
||||||
onUpdateAnnotation={handleUpdateAnnotation}
|
onUpdateAnnotation={handleUpdateAnnotation}
|
||||||
|
@ -97,7 +94,6 @@ Annotations.propTypes = {
|
||||||
annotationsRef: func,
|
annotationsRef: func,
|
||||||
handleDeleteAnnotation: func.isRequired,
|
handleDeleteAnnotation: func.isRequired,
|
||||||
handleUpdateAnnotation: func.isRequired,
|
handleUpdateAnnotation: func.isRequired,
|
||||||
handleAddAnnotation: func.isRequired,
|
|
||||||
handleDismissAddingAnnotation: func.isRequired,
|
handleDismissAddingAnnotation: func.isRequired,
|
||||||
handleAddingAnnotationSuccess: func.isRequired,
|
handleAddingAnnotationSuccess: func.isRequired,
|
||||||
handleMouseEnterTempAnnotation: func.isRequired,
|
handleMouseEnterTempAnnotation: func.isRequired,
|
||||||
|
@ -129,7 +125,6 @@ const mapDispatchToProps = dispatch => ({
|
||||||
mouseLeaveTempAnnotation,
|
mouseLeaveTempAnnotation,
|
||||||
dispatch
|
dispatch
|
||||||
),
|
),
|
||||||
handleAddAnnotation: bindActionCreators(addAnnotation, dispatch),
|
|
||||||
handleUpdateAnnotation: bindActionCreators(updateAnnotation, dispatch),
|
handleUpdateAnnotation: bindActionCreators(updateAnnotation, dispatch),
|
||||||
handleDeleteAnnotation: bindActionCreators(deleteAnnotation, dispatch),
|
handleDeleteAnnotation: bindActionCreators(deleteAnnotation, dispatch),
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import React, {Component, PropTypes} from 'react'
|
import React, {Component, PropTypes} from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import {bindActionCreators} from 'redux'
|
|
||||||
import uuid from 'node-uuid'
|
import uuid from 'node-uuid'
|
||||||
|
|
||||||
import OnClickOutside from 'shared/components/OnClickOutside'
|
import OnClickOutside from 'shared/components/OnClickOutside'
|
||||||
|
@ -33,7 +32,7 @@ class NewAnnotation extends Component {
|
||||||
|
|
||||||
handleMouseUp = () => {
|
handleMouseUp = () => {
|
||||||
const {
|
const {
|
||||||
addAnnotation,
|
addAnnotationAsync,
|
||||||
onAddingAnnotationSuccess,
|
onAddingAnnotationSuccess,
|
||||||
tempAnnotation,
|
tempAnnotation,
|
||||||
onMouseLeaveTempAnnotation,
|
onMouseLeaveTempAnnotation,
|
||||||
|
@ -48,7 +47,7 @@ class NewAnnotation extends Component {
|
||||||
// time on mouse up
|
// time on mouse up
|
||||||
const endTime = tempAnnotation.startTime
|
const endTime = tempAnnotation.startTime
|
||||||
|
|
||||||
addAnnotation(createUrl, {
|
addAnnotationAsync(createUrl, {
|
||||||
...tempAnnotation,
|
...tempAnnotation,
|
||||||
startTime,
|
startTime,
|
||||||
endTime,
|
endTime,
|
||||||
|
@ -67,7 +66,7 @@ class NewAnnotation extends Component {
|
||||||
onAddingAnnotationSuccess()
|
onAddingAnnotationSuccess()
|
||||||
onMouseLeaveTempAnnotation()
|
onMouseLeaveTempAnnotation()
|
||||||
|
|
||||||
addAnnotation(createUrl, {
|
addAnnotationAsync(createUrl, {
|
||||||
...tempAnnotation,
|
...tempAnnotation,
|
||||||
id: uuid.v4(),
|
id: uuid.v4(),
|
||||||
startTime,
|
startTime,
|
||||||
|
@ -196,7 +195,7 @@ NewAnnotation.propTypes = {
|
||||||
dygraph: shape({}).isRequired,
|
dygraph: shape({}).isRequired,
|
||||||
isTempHovering: bool,
|
isTempHovering: bool,
|
||||||
tempAnnotation: schema.annotation.isRequired,
|
tempAnnotation: schema.annotation.isRequired,
|
||||||
addAnnotation: func.isRequired,
|
addAnnotationAsync: func.isRequired,
|
||||||
onDismissAddingAnnotation: func.isRequired,
|
onDismissAddingAnnotation: func.isRequired,
|
||||||
onAddingAnnotationSuccess: func.isRequired,
|
onAddingAnnotationSuccess: func.isRequired,
|
||||||
onUpdateAnnotation: func.isRequired,
|
onUpdateAnnotation: func.isRequired,
|
||||||
|
@ -204,8 +203,8 @@ NewAnnotation.propTypes = {
|
||||||
onMouseLeaveTempAnnotation: func.isRequired,
|
onMouseLeaveTempAnnotation: func.isRequired,
|
||||||
}
|
}
|
||||||
|
|
||||||
const mdtp = dispatch => ({
|
const mdtp = {
|
||||||
addAnnotation: bindActionCreators(actions.addAnnotationAsync, dispatch),
|
addAnnotationAsync: actions.addAnnotationAsync,
|
||||||
})
|
}
|
||||||
|
|
||||||
export default connect(null, mdtp)(OnClickOutside(NewAnnotation))
|
export default connect(null, mdtp)(OnClickOutside(NewAnnotation))
|
||||||
|
|
Loading…
Reference in New Issue