@ -5,17 +5,12 @@ import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import { connect } from 'react-redux' ;
import { connect } from 'react-redux' ;
import { Link } from 'react-router-dom' ;
import { Link } from 'react-router-dom' ;
import BundleContainer from 'soapbox/features/ui/containers/bundle_container' ;
import { getFeatures } from 'soapbox/utils/features' ;
import { getFeatures } from 'soapbox/utils/features' ;
import { expandHomeTimeline } from '../../actions/timelines' ;
import { expandHomeTimeline } from '../../actions/timelines' ;
import { Column } from '../../components/ui' ;
import { Column } from '../../components/ui' ;
import Timeline from '../ui/components/timeline' ;
import Timeline from '../ui/components/timeline' ;
function FollowRecommendationsContainer ( ) {
return import ( /* webpackChunkName: "features/follow_recommendations" */ 'soapbox/features/follow_recommendations/components/follow_recommendations_container' ) ;
}
const messages = defineMessages ( {
const messages = defineMessages ( {
title : { id : 'column.home' , defaultMessage : 'Home' } ,
title : { id : 'column.home' , defaultMessage : 'Home' } ,
} ) ;
} ) ;
@ -92,37 +87,24 @@ class HomeTimeline extends React.PureComponent {
}
}
}
}
handleDone = e => {
this . props . dispatch ( expandHomeTimeline ( ) ) ;
this . setState ( { done : true } ) ;
}
handleRefresh = ( ) => {
handleRefresh = ( ) => {
const { dispatch } = this . props ;
const { dispatch } = this . props ;
return dispatch ( expandHomeTimeline ( ) ) ;
return dispatch ( expandHomeTimeline ( ) ) ;
}
}
render ( ) {
render ( ) {
const { intl , siteTitle , isLoading , loadingFailed , isEmpty , features } = this . props ;
const { intl , siteTitle } = this . props ;
const { done } = this . state ;
const showSuggestions = features . suggestions && isEmpty && ! isLoading && ! loadingFailed && ! done ;
return (
return (
< Column label = { intl . formatMessage ( messages . title ) } transparent = { ! showSuggestions } >
< Column label = { intl . formatMessage ( messages . title ) } >
{ showSuggestions ? (
< Timeline
< BundleContainer fetchComponent = { FollowRecommendationsContainer } >
scrollKey = 'home_timeline'
{ Component => < Component onDone = { this . handleDone } / > }
onLoadMore = { this . handleLoadMore }
< / B u n d l e C o n t a i n e r >
onRefresh = { this . handleRefresh }
) : (
timelineId = 'home'
< Timeline
divideType = 'space'
scrollKey = 'home_timeline'
emptyMessage = { < FormattedMessage id = 'empty_column.home' defaultMessage = 'Your home timeline is empty! Visit {public} to get started and meet other users.' values = { { public : < Link to = '/timeline/local' > < FormattedMessage id = 'empty_column.home.local_tab' defaultMessage = 'the {site_title} tab' values = { { site _title : siteTitle } } / > < /Link> }} / > }
onLoadMore = { this . handleLoadMore }
/ >
onRefresh = { this . handleRefresh }
timelineId = 'home'
divideType = 'space'
emptyMessage = { < FormattedMessage id = 'empty_column.home' defaultMessage = 'Your home timeline is empty! Visit {public} to get started and meet other users.' values = { { public : < Link to = '/timeline/local' > < FormattedMessage id = 'empty_column.home.local_tab' defaultMessage = 'the {site_title} tab' values = { { site _title : siteTitle } } / > < /Link> }} / > }
/ >
) }
< / C o l u m n >
< / C o l u m n >
) ;
) ;
}
}