From 267978d4fe0eaee92f64d505df2a4a07d22f582c Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 25 Oct 2022 19:03:16 +0200 Subject: [PATCH] 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 --- app/javascript/mastodon/features/explore/index.js | 3 ++- .../mastodon/features/getting_started/index.js | 10 +++++++++- .../features/ui/components/navigation_panel.js | 10 ++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/javascript/mastodon/features/explore/index.js b/app/javascript/mastodon/features/explore/index.js index 1c7049e97d..552def142d 100644 --- a/app/javascript/mastodon/features/explore/index.js +++ b/app/javascript/mastodon/features/explore/index.js @@ -12,6 +12,7 @@ import Suggestions from './suggestions'; import Search from 'mastodon/features/compose/containers/search_container'; import SearchResults from './results'; import { Helmet } from 'react-helmet'; +import { showTrends } from 'mastodon/initial_state'; const messages = defineMessages({ title: { id: 'explore.title', defaultMessage: 'Explore' }, @@ -20,7 +21,7 @@ const messages = defineMessages({ const mapStateToProps = state => ({ layout: state.getIn(['meta', 'layout']), - isSearching: state.getIn(['search', 'submitted']), + isSearching: state.getIn(['search', 'submitted']) || !showTrends, }); export default @connect(mapStateToProps) diff --git a/app/javascript/mastodon/features/getting_started/index.js b/app/javascript/mastodon/features/getting_started/index.js index f002ffc774..fc91070d1a 100644 --- a/app/javascript/mastodon/features/getting_started/index.js +++ b/app/javascript/mastodon/features/getting_started/index.js @@ -95,7 +95,15 @@ class GettingStarted extends ImmutablePureComponent { navItems.push( , - , + ); + + if (showTrends) { + navItems.push( + , + ); + } + + navItems.push( , , ); diff --git a/app/javascript/mastodon/features/ui/components/navigation_panel.js b/app/javascript/mastodon/features/ui/components/navigation_panel.js index 10678f7d8c..4e9e39e2f5 100644 --- a/app/javascript/mastodon/features/ui/components/navigation_panel.js +++ b/app/javascript/mastodon/features/ui/components/navigation_panel.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { defineMessages, injectIntl } from 'react-intl'; import { Link } from 'react-router-dom'; 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 FollowRequestsColumnLink from './follow_requests_column_link'; import ListPanel from './list_panel'; @@ -24,6 +24,7 @@ const messages = defineMessages({ preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, followsAndFollowers: { id: 'navigation_bar.follows_and_followers', defaultMessage: 'Follows and followers' }, about: { id: 'navigation_bar.about', defaultMessage: 'About' }, + search: { id: 'navigation_bar.search', defaultMessage: 'Search' }, }); export default @injectIntl @@ -57,7 +58,12 @@ class NavigationPanel extends React.Component { )} - + {showTrends ? ( + + ) : ( + + )} + {(signedIn || timelinePreview) && ( <>