2020-08-17 21:07:16 +01:00
|
|
|
import React from 'react'
|
2020-08-17 21:59:29 +01:00
|
|
|
import PropTypes from 'prop-types'
|
2020-08-17 21:39:25 +01:00
|
|
|
import { connect } from 'react-redux'
|
2020-07-02 02:40:00 +01:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl'
|
|
|
|
import { expandProTimeline } from '../actions/timelines'
|
|
|
|
import { connectProStream } from '../actions/streaming'
|
|
|
|
import StatusList from '../components/status_list'
|
|
|
|
|
2020-08-17 21:07:16 +01:00
|
|
|
class ProTimeline extends React.PureComponent {
|
2020-07-02 02:40:00 +01:00
|
|
|
|
|
|
|
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}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-08-19 01:22:15 +01:00
|
|
|
|
|
|
|
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))
|