From 08086012ff335602e928144eb1dc114fc7b985bd Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Sun, 13 Oct 2024 18:56:16 +0200 Subject: [PATCH] add subplebbit address to p/all catalog preview cards --- src/components/catalog-row/catalog-row.tsx | 8 ++++++-- src/views/catalog/catalog.module.css | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/catalog-row/catalog-row.tsx b/src/components/catalog-row/catalog-row.tsx index 6a15f9e8..58dc9fed 100644 --- a/src/components/catalog-row/catalog-row.tsx +++ b/src/components/catalog-row/catalog-row.tsx @@ -6,7 +6,8 @@ import { Comment, useComment } from '@plebbit/plebbit-react-hooks'; import { useFloating, offset, size, autoUpdate, Placement } from '@floating-ui/react'; import { fetchWebpageThumbnailIfNeeded, getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils'; import { getFormattedTimeAgo } from '../../lib/utils/time-utils'; -import { isAllView } from '../../lib/utils/view-utils'; +import { isAllView, isSubscriptionsView } from '../../lib/utils/view-utils'; +import Plebbit from '@plebbit/plebbit-js/dist/browser/index.js'; import useCatalogStyleStore from '../../stores/use-catalog-style-store'; import useEditCommentPrivileges from '../../hooks/use-author-privileges'; import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; @@ -134,7 +135,9 @@ const CatalogPost = ({ post }: { post: Comment }) => { const { hidden } = useHide({ cid }); const location = useLocation(); - const isInAllView = isAllView(location.pathname, useParams()); + const params = useParams(); + const isInAllView = isAllView(location.pathname, params); + const isInSubscriptionsView = isSubscriptionsView(location.pathname, params); const postLink = isInAllView && isDescription ? `/p/all/description` : `/p/${subplebbitAddress}/${isDescription ? 'description' : isRules ? 'rules' : `c/${cid}`}`; @@ -292,6 +295,7 @@ const CatalogPost = ({ post }: { post: Comment }) => { {author?.displayName || _.capitalize(t('anonymous'))} {isCatalogPostAuthorMod && {` ## Board ${catalogPostAuthorRole}`}} + {(isInAllView || isInSubscriptionsView) && subplebbitAddress && ` to p/${Plebbit.getShortAddress(subplebbitAddress)}`} {getFormattedTimeAgo(timestamp)} {replyCount > 0 && (
diff --git a/src/views/catalog/catalog.module.css b/src/views/catalog/catalog.module.css index 16803950..ff6fad79 100644 --- a/src/views/catalog/catalog.module.css +++ b/src/views/catalog/catalog.module.css @@ -1,5 +1,6 @@ .footer { padding: 15px 0 10px 5px; + color: var(--post-mobile-abbr-text-color); } .footer a {