From 5a2fb4ed23cc99366277e23097c7996d0c26a559 Mon Sep 17 00:00:00 2001 From: danidfra Date: Mon, 10 Mar 2025 13:53:18 -0300 Subject: [PATCH] Hide filters and welcome message in Fediverse view --- src/features/explorer/index.tsx | 57 ++++++++++++++------------ src/features/public-timeline/index.tsx | 2 +- 2 files changed, 31 insertions(+), 28 deletions(-) diff --git a/src/features/explorer/index.tsx b/src/features/explorer/index.tsx index 7875bb05c..4414f27d4 100644 --- a/src/features/explorer/index.tsx +++ b/src/features/explorer/index.tsx @@ -19,6 +19,7 @@ import AccountsCarousel from 'soapbox/features/explorer/components/popular-accou import { PublicTimeline } from 'soapbox/features/ui/util/async-components.ts'; import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; +import { useFeatures } from 'soapbox/hooks/useFeatures.ts'; import { IFilters, initialState as filterInitialState } from 'soapbox/reducers/search-filter.ts'; import { SearchFilter } from 'soapbox/reducers/search.ts'; @@ -44,6 +45,7 @@ const PostsTab = () => { const intl = useIntl(); const inPosts = path === '/explorer'; const filters = useAppSelector((state) => state.search_filter); + const isNostr = useFeatures().nostr; const [withFilter, setWithFilter] = useState(checkFilters(filters)); @@ -55,13 +57,15 @@ const PostsTab = () => { {inPosts && <> - + {isNostr && <> + - + - + - + + } {!withFilter ? : } @@ -99,6 +103,7 @@ const AccountsTab = () => { const SearchPage = () => { + const features = useFeatures(); const intl = useIntl(); const dispatch = useAppDispatch(); const navigate = useNavigate(); @@ -121,7 +126,26 @@ const SearchPage = () => { const [selectedFilter, setSelectedFilter] = useState(selectedValue); const renderFilterBar = () => { - const items = []; + const items = [ + { + text: intl.formatMessage(messages.statuses), + action: () => handleTabs(''), + name: 'posts', + icon: globeIcon, + }, + ...(features.nostr ? [{ + text: intl.formatMessage(messages.trends), + action: () => handleTabs('/trends', 'statuses'), + name: 'statuses', + icon: trendIcon, + }] : []), + { + text: intl.formatMessage(messages.accounts), + action: () => handleTabs('/accounts', 'accounts'), + name: 'accounts', + icon: userIcon, + }, + ]; const handleTabs = (path: string, filter?: SearchFilter) => { if (filter) { @@ -134,27 +158,6 @@ const SearchPage = () => { navigate(`/explorer${path}`); }; - items.push( - { - text: intl.formatMessage(messages.statuses), - action: () => handleTabs(''), - name: 'posts', - icon: globeIcon, - }, - { - text: intl.formatMessage(messages.trends), - action: () => handleTabs('/trends', 'statuses'), - name: 'statuses', - icon: trendIcon, - }, - { - text: intl.formatMessage(messages.accounts), - action: () => handleTabs('/accounts', 'accounts'), - name: 'accounts', - icon: userIcon, - }, - ); - return ; }; @@ -169,7 +172,7 @@ const SearchPage = () => { - + {features.nostr && } diff --git a/src/features/public-timeline/index.tsx b/src/features/public-timeline/index.tsx index 0dde4c547..ee96f4b74 100644 --- a/src/features/public-timeline/index.tsx +++ b/src/features/public-timeline/index.tsx @@ -78,7 +78,7 @@ const PublicTimeline = () => { {showExplanationBox && ( -
+
} action={dismissExplanationBox}