From 3bba1389bcd7aa92e2738584b9247a8f49821ccc Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 2 Mar 2025 12:57:44 -0600 Subject: [PATCH] Make /timeline/local link still work --- src/features/home-timeline/index.tsx | 21 +++++++++++++-------- src/features/ui/index.tsx | 1 + 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/features/home-timeline/index.tsx b/src/features/home-timeline/index.tsx index e511eaf43..566f2472e 100644 --- a/src/features/home-timeline/index.tsx +++ b/src/features/home-timeline/index.tsx @@ -1,5 +1,6 @@ -import { useState, Suspense } from 'react'; +import { Suspense } from 'react'; import { FormattedMessage } from 'react-intl'; +import { Route, Switch, useRouteMatch } from 'react-router-dom'; import Tabs from 'soapbox/components/ui/tabs.tsx'; import { CommunityTimeline, FollowsTimeline } from 'soapbox/features/ui/util/async-components.ts'; @@ -8,7 +9,8 @@ import { useInstance } from 'soapbox/hooks/useInstance.ts'; const HomeTimeline = () => { const { instance } = useInstance(); - const [activeTab, setActiveTab] = useState('follows'); + + const match = useRouteMatch(); const notifications = useAppSelector((state) => state.notificationsTab); return ( @@ -16,23 +18,26 @@ const HomeTimeline = () => { , - action: () => setActiveTab('follows'), notification: notifications.home, }, { - name: 'local', + to: '/timeline/local', + name: '/timeline/local', text:
{instance.title}
, - action: () => setActiveTab('local'), notification: notifications.instance, }, ]} - activeItem={activeTab} + activeItem={match.path} /> }> - {activeTab === 'follows' ? : } + + + + ); diff --git a/src/features/ui/index.tsx b/src/features/ui/index.tsx index a73afdc17..29e19897e 100644 --- a/src/features/ui/index.tsx +++ b/src/features/ui/index.tsx @@ -192,6 +192,7 @@ const SwitchingColumnsArea: React.FC = ({ children }) => NOTE: we cannot nest routes in a fragment https://stackoverflow.com/a/68637108 */} + {features.federating && } {features.federating && } {features.federating && }