Remove navigation links to /explore when trends are disabled (#19415)

* Remove navigation links to /explore when trends are disabled

* Do not display trends interface when trends are disabled
lolsob-rspec
Claire 2022-10-25 19:03:16 +02:00 committed by GitHub
parent 7cbab3e7fd
commit 4a6fb0ea2a
3 changed files with 19 additions and 4 deletions

View File

@ -12,6 +12,7 @@ import Suggestions from './suggestions';
import Search from 'mastodon/features/compose/containers/search_container'; import Search from 'mastodon/features/compose/containers/search_container';
import SearchResults from './results'; import SearchResults from './results';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { showTrends } from 'mastodon/initial_state';
const messages = defineMessages({ const messages = defineMessages({
title: { id: 'explore.title', defaultMessage: 'Explore' }, title: { id: 'explore.title', defaultMessage: 'Explore' },
@ -20,7 +21,7 @@ const messages = defineMessages({
const mapStateToProps = state => ({ const mapStateToProps = state => ({
layout: state.getIn(['meta', 'layout']), layout: state.getIn(['meta', 'layout']),
isSearching: state.getIn(['search', 'submitted']), isSearching: state.getIn(['search', 'submitted']) || !showTrends,
}); });
export default @connect(mapStateToProps) export default @connect(mapStateToProps)

View File

@ -95,7 +95,15 @@ class GettingStarted extends ImmutablePureComponent {
navItems.push( navItems.push(
<ColumnSubheading key='header-discover' text={intl.formatMessage(messages.discover)} />, <ColumnSubheading key='header-discover' text={intl.formatMessage(messages.discover)} />,
<ColumnLink key='explore' icon='hashtag' text={intl.formatMessage(messages.explore)} to='/explore' />, );
if (showTrends) {
navItems.push(
<ColumnLink key='explore' icon='hashtag' text={intl.formatMessage(messages.explore)} to='/explore' />,
);
}
navItems.push(
<ColumnLink key='community_timeline' icon='users' text={intl.formatMessage(messages.community_timeline)} to='/public/local' />, <ColumnLink key='community_timeline' icon='users' text={intl.formatMessage(messages.community_timeline)} to='/public/local' />,
<ColumnLink key='public_timeline' icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/public' />, <ColumnLink key='public_timeline' icon='globe' text={intl.formatMessage(messages.public_timeline)} to='/public' />,
); );

View File

@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, injectIntl } from 'react-intl';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import Logo from 'mastodon/components/logo'; import Logo from 'mastodon/components/logo';
import { timelinePreview } from 'mastodon/initial_state'; import { timelinePreview, showTrends } from 'mastodon/initial_state';
import ColumnLink from './column_link'; import ColumnLink from './column_link';
import FollowRequestsColumnLink from './follow_requests_column_link'; import FollowRequestsColumnLink from './follow_requests_column_link';
import ListPanel from './list_panel'; import ListPanel from './list_panel';
@ -24,6 +24,7 @@ const messages = defineMessages({
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
followsAndFollowers: { id: 'navigation_bar.follows_and_followers', defaultMessage: 'Follows and followers' }, followsAndFollowers: { id: 'navigation_bar.follows_and_followers', defaultMessage: 'Follows and followers' },
about: { id: 'navigation_bar.about', defaultMessage: 'About' }, about: { id: 'navigation_bar.about', defaultMessage: 'About' },
search: { id: 'navigation_bar.search', defaultMessage: 'Search' },
}); });
export default @injectIntl export default @injectIntl
@ -57,7 +58,12 @@ class NavigationPanel extends React.Component {
</React.Fragment> </React.Fragment>
)} )}
<ColumnLink transparent to='/explore' icon='hashtag' text={intl.formatMessage(messages.explore)} /> {showTrends ? (
<ColumnLink transparent to='/explore' icon='hashtag' text={intl.formatMessage(messages.explore)} />
) : (
<ColumnLink transparent to='/search' icon='search' text={intl.formatMessage(messages.search)} />
)}
{(signedIn || timelinePreview) && ( {(signedIn || timelinePreview) && (
<> <>
<ColumnLink transparent to='/public/local' icon='users' text={intl.formatMessage(messages.local)} /> <ColumnLink transparent to='/public/local' icon='users' text={intl.formatMessage(messages.local)} />