From f189b8ca12df2d773cd4c69b63cdbaa91ed80d05 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Fri, 17 May 2024 21:27:06 +0200 Subject: [PATCH] fix catalog button link --- src/components/board-buttons/board-buttons.tsx | 18 ++++++++++++------ src/components/board-nav/board-nav.tsx | 2 -- .../post/post-mobile/post-mobile.tsx | 6 +++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index 6571fd2f..6daec02e 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -1,5 +1,5 @@ import { useTranslation } from 'react-i18next'; -import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; +import { Link, useLocation, useParams } from 'react-router-dom'; import { useAccountComment, useSubscribe } from '@plebbit/plebbit-react-hooks'; import styles from './board-buttons.module.css'; import { isAllView, isCatalogView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils'; @@ -16,12 +16,18 @@ const OptionsButton = () => { return ; }; -const CatalogButton = ({ address, isInAllView, isInCatalogView, isInSubscriptionsView }: BoardButtonsProps) => { +const CatalogButton = ({ address, isInAllView, isInCatalogView }: BoardButtonsProps) => { const { t } = useTranslation(); - const navigate = useNavigate(); - const link = isInAllView ? `/p/all/catalog` : isInSubscriptionsView ? `/p/subscriptions/catalog` : isInCatalogView ? `/p/${address}` : `/p/${address}/catalog`; - return ; + return ( + + ); }; const SubscribeButton = ({ address }: BoardButtonsProps) => { @@ -70,7 +76,7 @@ export const MobileBoardButtons = () => { {isInPostView || isInPendingPostPage ? (
- +
diff --git a/src/components/board-nav/board-nav.tsx b/src/components/board-nav/board-nav.tsx index 52b6f687..5d30ccbb 100644 --- a/src/components/board-nav/board-nav.tsx +++ b/src/components/board-nav/board-nav.tsx @@ -8,7 +8,6 @@ import useDefaultSubplebbits, { categorizeSubplebbits, useDefaultSubplebbitAddre const BoardNavDesktop = () => { const { t } = useTranslation(); const location = useLocation(); - const params = useParams(); const isInCatalogView = isCatalogView(location.pathname); const subplebbits = useDefaultSubplebbits(); @@ -47,7 +46,6 @@ const BoardNavMobile = ({ subplebbitAddress }: { subplebbitAddress: string }) => const currentSubplebbitIsInList = subplebbitAddresses.some((address: string) => address === subplebbitAddress); const location = useLocation(); - const params = useParams(); const isInAllView = isAllView(location.pathname); const isInCatalogView = isCatalogView(location.pathname); const isInSubscriptionsView = isSubscriptionsView(location.pathname); diff --git a/src/components/post/post-mobile/post-mobile.tsx b/src/components/post/post-mobile/post-mobile.tsx index 891abfff..90a80228 100644 --- a/src/components/post/post-mobile/post-mobile.tsx +++ b/src/components/post/post-mobile/post-mobile.tsx @@ -164,6 +164,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps) const params = useParams(); const location = useLocation(); + const isInAllView = isAllView(location.pathname); const isInPendingPostView = isPendingPostView(location.pathname, params); const isInPostView = isPostPageView(location.pathname, params); @@ -188,7 +189,10 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps) {replyCount > 0 && `${replyCount} Replies`} {linksCount > 0 && ` / ${linksCount} Links`} - + {t('view_thread')}