From 89599457228a8835575ff9a18f1a755c2910396d Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Fri, 14 Jun 2024 11:01:06 +0200 Subject: [PATCH] feat(catalog post): add hidden style --- src/components/catalog-row/catalog-row.module.css | 4 ++++ src/components/catalog-row/catalog-row.tsx | 12 +++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/catalog-row/catalog-row.module.css b/src/components/catalog-row/catalog-row.module.css index 66259f7e..0bc151e3 100644 --- a/src/components/catalog-row/catalog-row.module.css +++ b/src/components/catalog-row/catalog-row.module.css @@ -16,6 +16,10 @@ overflow: hidden; } +.hidden { + opacity: 0.5; +} + .mediaPaddingWrapper { padding-bottom: 5px; display: inline-flex; diff --git a/src/components/catalog-row/catalog-row.tsx b/src/components/catalog-row/catalog-row.tsx index eba9c2c7..6cf4d2fa 100644 --- a/src/components/catalog-row/catalog-row.tsx +++ b/src/components/catalog-row/catalog-row.tsx @@ -7,9 +7,10 @@ import { useFloating, offset, shift, size, autoUpdate, Placement } from '@floati import { getCommentMediaInfo, getHasThumbnail } from '../../lib/utils/media-utils'; import { getFormattedTimeAgo } from '../../lib/utils/time-utils'; import { isAllView } from '../../lib/utils/view-utils'; -import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; -import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; import useEditCommentPrivileges from '../../hooks/use-author-privileges'; +import useCountLinksInReplies from '../../hooks/use-count-links-in-replies'; +import useFetchGifFirstFrame from '../../hooks/use-fetch-gif-first-frame'; +import useHide from '../../hooks/use-hide'; import PostMenuDesktop from '../post-desktop/post-menu-desktop'; import styles from './catalog-row.module.css'; import _ from 'lodash'; @@ -85,6 +86,7 @@ const CatalogPost = ({ post }: { post: Comment }) => { post || {}; const commentMediaInfo = getCommentMediaInfo(post); const hasThumbnail = getHasThumbnail(commentMediaInfo, link); + const { hidden } = useHide({ cid }); const location = useLocation(); const isInAllView = isAllView(location.pathname); @@ -154,7 +156,7 @@ const CatalogPost = ({ post }: { post: Comment }) => { subplebbitAddress, }); - const postContent = ( + const postContent = !hidden && (
{title && `${title}${content ? ': ' : ''}`} {content} @@ -163,9 +165,9 @@ const CatalogPost = ({ post }: { post: Comment }) => { return ( <> -
+
setHoveredCid(isDescription ? 'd' : isRules ? 'r' : cid)} onMouseLeave={() => setHoveredCid(null)}> - {hasThumbnail ? ( + {hasThumbnail && !hidden ? (