gab-social/app/javascript/gabsocial/features/pro_timeline.js
mgabdev 99982c0391 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
2020-08-18 19:22:15 -05:00

62 lines
1.4 KiB
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { defineMessages, injectIntl } from 'react-intl'
import { expandProTimeline } from '../actions/timelines'
import { connectProStream } from '../actions/streaming'
import StatusList from '../components/status_list'
class ProTimeline extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
}
componentDidMount () {
const { dispatch } = this.props
dispatch(expandProTimeline())
this.disconnect = dispatch(connectProStream())
}
componentWillUnmount() {
if (this.disconnect) {
this.disconnect()
this.disconnect = null
}
}
handleLoadMore = (maxId) => {
const { dispatch } = this.props
dispatch(expandProTimeline({ maxId }))
}
render () {
const { intl } = this.props
const emptyMessage = intl.formatMessage(messages.empty)
return (
<StatusList
scrollKey='pro_timeline'
timelineId='pro'
onLoadMore={this.handleLoadMore}
emptyMessage={emptyMessage}
/>
)
}
}
const messages = defineMessages({
empty: { id: 'empty_column.pro', defaultMessage: 'The pro timeline is empty.' },
})
ProTimeline.propTypes = {
dispatch: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
}
export default injectIntl(connect(null)(ProTimeline))