From aaa0d4c4f40f14c71d7f591dd2bcaecf04235356 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 24 Jan 2025 23:39:52 -0600 Subject: [PATCH] Add tabs between home feed and local --- src/components/scroll-top-button.tsx | 2 +- src/features/community-timeline/index.tsx | 2 +- src/features/status/components/thread.tsx | 4 +--- src/pages/home-page.tsx | 19 ++++++++++++++++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/scroll-top-button.tsx b/src/components/scroll-top-button.tsx index f12b34502..593f1d942 100644 --- a/src/components/scroll-top-button.tsx +++ b/src/components/scroll-top-button.tsx @@ -87,7 +87,7 @@ const ScrollTopButton: React.FC = ({ } return ( -
+
- {hasDescendants && ( -
- )} +
); diff --git a/src/pages/home-page.tsx b/src/pages/home-page.tsx index fd852c163..dafb49e15 100644 --- a/src/pages/home-page.tsx +++ b/src/pages/home-page.tsx @@ -1,13 +1,14 @@ import clsx from 'clsx'; import { useRef } from 'react'; -import { useIntl } from 'react-intl'; -import { Link } from 'react-router-dom'; +import { FormattedMessage, useIntl } from 'react-intl'; +import { Link, useLocation } from 'react-router-dom'; import { uploadCompose } from 'soapbox/actions/compose.ts'; import Avatar from 'soapbox/components/ui/avatar.tsx'; import { Card, CardBody } from 'soapbox/components/ui/card.tsx'; import HStack from 'soapbox/components/ui/hstack.tsx'; import Layout from 'soapbox/components/ui/layout.tsx'; +import Tabs from 'soapbox/components/ui/tabs.tsx'; import LinkFooter from 'soapbox/features/ui/components/link-footer.tsx'; import { WhoToFollowPanel, @@ -24,11 +25,11 @@ import { useAppDispatch } from 'soapbox/hooks/useAppDispatch.ts'; import { useAppSelector } from 'soapbox/hooks/useAppSelector.ts'; import { useDraggedFiles } from 'soapbox/hooks/useDraggedFiles.ts'; import { useFeatures } from 'soapbox/hooks/useFeatures.ts'; +import { useInstance } from 'soapbox/hooks/useInstance.ts'; import { useIsMobile } from 'soapbox/hooks/useIsMobile.ts'; import { useOwnAccount } from 'soapbox/hooks/useOwnAccount.ts'; import { useSoapboxConfig } from 'soapbox/hooks/useSoapboxConfig.ts'; - import ComposeForm from '../features/compose/components/compose-form.tsx'; interface IHomePage { @@ -38,11 +39,13 @@ interface IHomePage { const HomePage: React.FC = ({ children }) => { const intl = useIntl(); const dispatch = useAppDispatch(); + const { pathname } = useLocation(); const me = useAppSelector(state => state.me); const { account } = useOwnAccount(); const features = useFeatures(); const soapboxConfig = useSoapboxConfig(); + const { instance } = useInstance(); const composeId = 'home'; const composeBlock = useRef(null); @@ -90,6 +93,16 @@ const HomePage: React.FC = ({ children }) => { )} +
+ , to: '/' }, + { name: 'local', text:
{instance.domain}
, to: '/timeline/local' }, + ]} + activeItem={pathname === '/timeline/local' ? 'local' : 'home'} + /> +
+ {children} {!me && (