HomeTimeline: remove suggestions

environments/review-tsx-conver-9bqdai/deployments/183
Alex Gleason 2 years ago
parent 71362a922a
commit 4c87573972
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -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}
</BundleContainer> 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> }} />}
/>
)}
</Column> </Column>
); );
} }

Loading…
Cancel
Save