Removed unused Explore feature

• Removed:
- unused Explore feature, as it is now just GroupCollectionTimeline
This commit is contained in:
mgabdev 2020-08-06 23:09:17 -05:00
parent 60df345131
commit 89def69904
3 changed files with 2 additions and 103 deletions

View File

@ -1,99 +0,0 @@
import { defineMessages, injectIntl } from 'react-intl'
import { withRouter } from 'react-router-dom'
import throttle from 'lodash.throttle'
import {
expandHomeTimeline,
forceDequeueTimeline,
} from '../actions/timelines'
import StatusList from '../components/status_list'
const messages = defineMessages({
title: { id: 'column.home', defaultMessage: 'Home' },
empty: { id: 'empty_timeline.home', defaultMessage: 'Your home timeline is empty. Start following other users to receive their content here.' },
})
const mapStateToProps = (state) => ({
isPartial: state.getIn(['timelines', 'home', 'isPartial']),
})
const mapDispatchToProps = (dispatch) => ({
onExpandHomeTimeline(options) {
if (!options) dispatch(forceDequeueTimeline('home'))
dispatch(expandHomeTimeline(options))
},
})
export default
@injectIntl
@withRouter
@connect(mapStateToProps, mapDispatchToProps)
class Explore extends PureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
isPartial: PropTypes.bool,
onExpandHomeTimeline: PropTypes.func.isRequired,
}
componentDidMount () {
this._checkIfReloadNeeded(false, this.props.isPartial)
}
componentDidUpdate (prevProps) {
this._checkIfReloadNeeded(prevProps.isPartial, this.props.isPartial)
//Check if clicked on "home" button, if so, reload
if (prevProps.location.key !== this.props.location.key &&
prevProps.location.pathname === '/home' &&
this.props.location.pathname === '/home') {
this.handleReload()
}
}
componentWillUnmount () {
this._stopPolling()
}
handleLoadMore = (maxId) => {
this.props.onExpandHomeTimeline({ maxId })
}
handleReload = throttle(() => {
this.props.onExpandHomeTimeline()
}, 5000)
_checkIfReloadNeeded (wasPartial, isPartial) {
const { onExpandHomeTimeline } = this.props
if (!wasPartial && isPartial) {
this.polling = setInterval(() => {
onExpandHomeTimeline()
}, 3000)
} else if (wasPartial && !isPartial) {
this._stopPolling()
}
}
_stopPolling () {
if (this.polling) {
clearInterval(this.polling)
this.polling = null
}
}
render () {
const { intl } = this.props
const emptyMessage = intl.formatMessage(messages.empty)
return (
<StatusList
scrollKey='home_timeline'
onLoadMore={this.handleLoadMore}
timelineId='home'
emptyMessage={emptyMessage}
/>
)
}
}

View File

@ -52,7 +52,6 @@ import {
CommunityTimeline,
Compose,
DMCA,
Explore,
// Filters,
Followers,
Following,
@ -167,7 +166,7 @@ class SwitchingArea extends PureComponent {
}
{
!me &&
<WrappedRoute path='/' publicRoute page={ExplorePage} component={GroupCollectionTimeline} content={children} componentParams={{ title: 'Gab.com', collectionType: 'featured' }} />
<WrappedRoute path='/' exact publicRoute page={ExplorePage} component={GroupCollectionTimeline} content={children} componentParams={{ title: 'Gab.com', collectionType: 'featured' }} />
}
<WrappedRoute path='/home' exact page={HomePage} component={HomeTimeline} content={children} />
@ -179,7 +178,7 @@ class SwitchingArea extends PureComponent {
<WrappedRoute path='/about/sales' publicRoute exact page={AboutPage} component={TermsOfSale} content={children} componentParams={{ title: 'Terms of Sale' }} />
<WrappedRoute path='/about/tos' publicRoute exact page={AboutPage} component={TermsOfService} content={children} componentParams={{ title: 'Terms of Service' }} />
<WrappedRoute path='/explore' publicRoute page={ExplorePage} component={Explore} content={children} componentParams={{ title: 'Explore' }} />
<WrappedRoute path='/explore' publicRoute page={ExplorePage} component={GroupCollectionTimeline} content={children} componentParams={{ title: 'Explore', collectionType: 'featured' }} />
<WrappedRoute path='/news' publicRoute page={NewsPage} component={News} content={children} componentParams={{ title: 'News' }} />
<WrappedRoute path='/compose' exact page={BasicPage} component={Compose} content={children} componentParams={{ title: 'Compose', page: 'compose' }} />

View File

@ -20,7 +20,6 @@ export function EditShortcutsModal() { return import(/* webpackChunkName: "compo
export function EmbedModal() { return import(/* webpackChunkName: "modals/embed_modal" */'../../../components/modal/embed_modal') }
export function EmojiPicker() { return import(/* webpackChunkName: "emoji_picker" */'../../../components/emoji/emoji_picker') }
export function EmojiPickerPopover() { return import(/* webpackChunkName: "components/emoji_picker_popover" */'../../../components/popover/emoji_picker_popover') }
export function Explore() { return import(/* webpackChunkName: "features/explore" */'../../explore') }
export function Followers() { return import(/* webpackChunkName: "features/followers" */'../../followers') }
export function Following() { return import(/* webpackChunkName: "features/following" */'../../following') }
export function FollowRequests() { return import(/* webpackChunkName: "features/follow_requests" */'../../follow_requests') }