Finished updating the reformatting of propTypes and set redux, intl functions to end of component
• Finished: - updating the reformatting of propTypes and set redux, intl functions to end of component • Removed: - Gif implementation
This commit is contained in:
@@ -11,32 +11,8 @@ import {
|
||||
import StatusContainer from '../containers/status_container'
|
||||
import StatusPlaceholder from '../components/placeholder/status_placeholder'
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
const statusId = props.id || props.params.statusId
|
||||
|
||||
return {
|
||||
status: state.getIn(['statuses', statusId]),
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
onFetchStatus: (id) => dispatch(fetchStatus(id)),
|
||||
onFetchContext: (id) => dispatch(fetchContext(id)),
|
||||
onFetchComments: (id) => dispatch(fetchComments(id)),
|
||||
})
|
||||
|
||||
export default
|
||||
@connect(mapStateToProps, mapDispatchToProps)
|
||||
class Status extends ImmutablePureComponent {
|
||||
|
||||
static propTypes = {
|
||||
onFetchContext: PropTypes.func.isRequired,
|
||||
onFetchStatus: PropTypes.func.isRequired,
|
||||
onFetchComments: PropTypes.func.isRequired,
|
||||
params: PropTypes.object,
|
||||
status: ImmutablePropTypes.map,
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const statusId = this.props.id || this.props.params.statusId
|
||||
this.props.onFetchStatus(statusId)
|
||||
@@ -80,3 +56,27 @@ class Status extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, props) => {
|
||||
const statusId = props.id || props.params.statusId
|
||||
|
||||
return {
|
||||
status: state.getIn(['statuses', statusId]),
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
onFetchStatus: (id) => dispatch(fetchStatus(id)),
|
||||
onFetchContext: (id) => dispatch(fetchContext(id)),
|
||||
onFetchComments: (id) => dispatch(fetchComments(id)),
|
||||
})
|
||||
|
||||
Status.propTypes = {
|
||||
onFetchContext: PropTypes.func.isRequired,
|
||||
onFetchStatus: PropTypes.func.isRequired,
|
||||
onFetchComments: PropTypes.func.isRequired,
|
||||
params: PropTypes.object,
|
||||
status: ImmutablePropTypes.map,
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(Status)
|
||||
Reference in New Issue
Block a user