diff --git a/src/components/board-nav/board-nav.tsx b/src/components/board-nav/board-nav.tsx index 1add82aa..19dedf13 100644 --- a/src/components/board-nav/board-nav.tsx +++ b/src/components/board-nav/board-nav.tsx @@ -1,6 +1,7 @@ -import { Link, useNavigate, useParams } from 'react-router-dom'; +import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { Subplebbit } from '@plebbit/plebbit-react-hooks'; +import { isCatalogView } from '../../lib/utils/view-utils'; import styles from './board-nav.module.css'; interface BoardNavProps { @@ -10,6 +11,7 @@ interface BoardNavProps { const BoardNavDesktop = ({ subplebbits }: BoardNavProps) => { const { t } = useTranslation(); + const isInCatalogView = isCatalogView(useLocation().pathname, useParams()); return (
@@ -21,7 +23,7 @@ const BoardNavDesktop = ({ subplebbits }: BoardNavProps) => { return ( {index === 0 ? null : ' '} - + {address.includes('.') ? address : title || address.slice(0, 10).concat('...')} {index !== subplebbits.length - 1 ? ' /' : null} @@ -44,8 +46,10 @@ const BoardNavMobile = ({ subplebbits, currentSubplebbit }: BoardNavProps) => { const currentSubplebbitIsInList = subplebbits.some((subplebbit: any) => subplebbit?.address === currentSubplebbit); + const isInCatalogView = isCatalogView(useLocation().pathname, useParams()); + const boardSelect = ( - navigate(`/p/${e.target.value}${isInCatalogView && '/catalog'}`)}> {!currentSubplebbitIsInList && currentSubplebbit && }