fix(multisubs): don't show subscribe button

This commit is contained in:
plebeius.eth
2024-05-17 15:06:30 +02:00
parent 797d665150
commit 07af3187c6
@@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next';
import { Link, useLocation, useParams } from 'react-router-dom'; import { Link, useLocation, useParams } from 'react-router-dom';
import { useAccountComment, useSubscribe } from '@plebbit/plebbit-react-hooks'; import { useAccountComment, useSubscribe } from '@plebbit/plebbit-react-hooks';
import styles from './board-buttons.module.css'; import styles from './board-buttons.module.css';
import { isCatalogView, isPendingPostView, isPostPageView } from '../../lib/utils/view-utils'; import { isAllView, isCatalogView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils';
interface BoardButtonsProps { interface BoardButtonsProps {
address: string | undefined; address: string | undefined;
@@ -89,9 +89,11 @@ export const DesktopBoardButtons = () => {
const location = useLocation(); const location = useLocation();
const accountComment = useAccountComment({ commentIndex: params?.accountCommentIndex as any }); const accountComment = useAccountComment({ commentIndex: params?.accountCommentIndex as any });
const subplebbitAddress = params?.subplebbitAddress || accountComment?.subplebbitAddress; const subplebbitAddress = params?.subplebbitAddress || accountComment?.subplebbitAddress;
const isInPostPage = isPostPageView(location.pathname, params);
const isInCatalogView = isCatalogView(location.pathname, params); const isInCatalogView = isCatalogView(location.pathname, params);
const isInAllView = isAllView(location.pathname);
const isInPendingPostPage = isPendingPostView(location.pathname, params); const isInPendingPostPage = isPendingPostView(location.pathname, params);
const isInPostPage = isPostPageView(location.pathname, params);
const isInSubscriptionsView = isSubscriptionsView(location.pathname);
return ( return (
<div className={styles.desktopBoardButtons}> <div className={styles.desktopBoardButtons}>
@@ -107,9 +109,11 @@ export const DesktopBoardButtons = () => {
) : ( ) : (
<> <>
[<OptionsButton />] [<CatalogButton address={subplebbitAddress} isInCatalogView={isInCatalogView} />] [<OptionsButton />] [<CatalogButton address={subplebbitAddress} isInCatalogView={isInCatalogView} />]
<span className={styles.subscribeButton}> {!(isInAllView || isInSubscriptionsView) && (
[<SubscribeButton address={subplebbitAddress} />] <span className={styles.subscribeButton}>
</span> [<SubscribeButton address={subplebbitAddress} />]
</span>
)}
</> </>
)} )}
</div> </div>