Skip to content

Commit

Permalink
Merge pull request #553 from plebbit/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
plebeius-eth authored Sep 21, 2024
2 parents bc7515a + 036a21b commit ab1026a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/components/catalog-row/catalog-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import useHide from '../../hooks/use-hide';
import useWindowWidth from '../../hooks/use-window-width';
import PostMenuDesktop from '../post-desktop/post-menu-desktop';
import styles from './catalog-row.module.css';
import Markdown from '../markdown';
import _ from 'lodash';
import { ContentPreview } from '../../views/home/popular-threads-box';

Expand Down
14 changes: 7 additions & 7 deletions src/components/post-desktop/post-desktop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const useShowOmittedReplies = create<ShowOmittedRepliesState>((set) => ({

const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }: PostProps) => {
const { t } = useTranslation();
const { author, cid, deleted, locked, pinned, parentCid, postCid, removed, shortCid, state, subplebbitAddress, timestamp } = post || {};
const { author, cid, deleted, locked, pinned, parentCid, postCid, reason, removed, shortCid, state, subplebbitAddress, timestamp } = post || {};
const title = post?.title?.trim();
const replies = useReplies(post);
const { address, shortAddress } = author || {};
Expand Down Expand Up @@ -77,7 +77,7 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }:
return (
<div className={styles.postInfo}>
{!isHidden && <EditMenu post={post} />}
<span className={(hidden || removed || deleted) && styles.postDesktopHidden}>
<span className={(hidden || ((removed || deleted) && !reason)) && parentCid ? styles.postDesktopHidden : ''}>
{title &&
(title.length <= 75 ? (
<span className={styles.subject}>{title} </span>
Expand Down Expand Up @@ -290,7 +290,7 @@ const PostMessage = ({ post }: PostProps) => {

return (
<blockquote className={`${styles.postMessage} ${isRules && styles.rulesMessage}`}>
{isReply && state !== 'failed' && isReplyingToReply && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
{isReply && state !== 'failed' && isReplyingToReply && !(deleted || removed) && <ReplyQuotePreview isQuotelinkReply={true} quotelinkReply={quotelinkReply} />}
{removed ? (
reason ? (
<>
Expand Down Expand Up @@ -381,7 +381,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
post = editedComment;
}

const { author, cid, deleted, link, postCid, removed, subplebbitAddress } = post || {};
const { author, cid, deleted, link, postCid, reason, removed, subplebbitAddress } = post || {};
const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`);
const { hidden } = useHide({ cid });

Expand All @@ -391,15 +391,15 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
<div className={`${styles.reply} ${isRouteLinkToReply && styles.highlight}`} data-cid={cid} data-author-address={author?.shortAddress} data-post-cid={postCid}>
<PostInfo openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} />
{link && !hidden && !(deleted || removed) && isValidURL(link) && <PostMedia post={post} />}
{!(hidden || removed || deleted) && <PostMessage post={post} />}
{!hidden && (!(removed || deleted) || ((removed || deleted) && reason)) && <PostMessage post={post} />}
</div>
</div>
);
};

const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies = true }: PostProps) => {
const { t } = useTranslation();
const { author, cid, content, deleted, link, pinned, postCid, removed, state, subplebbitAddress } = post || {};
const { author, cid, content, deleted, link, parentCid, pinned, postCid, removed, state, subplebbitAddress } = post || {};
const { isDescription, isRules } = post || {}; // custom properties, not from api
const params = useParams();
const location = useLocation();
Expand Down Expand Up @@ -450,7 +450,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies, showReplies
{link && !isHidden && !(deleted || removed) && isValidURL(link) && <PostMedia post={post} />}
<PostInfo isHidden={hidden} openReplyModal={openReplyModal} post={post} postReplyCount={replyCount} roles={roles} />
{!isHidden && !content && <div className={styles.spacer} />}
{!isHidden && content && <PostMessage post={post} />}
{!(isHidden && parentCid) && <PostMessage post={post} />}
</div>
{!isHidden && !isDescription && !isRules && !isInPendingPostView && (replyCount > 5 || (pinned && repliesCount > 0)) && !isInPostPageView && (
<span className={styles.summary}>
Expand Down
12 changes: 6 additions & 6 deletions src/components/post-mobile/post-mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import _ from 'lodash';

const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: PostProps) => {
const { t } = useTranslation();
const { author, cid, deleted, link, locked, parentCid, pinned, postCid, removed, shortCid, state, subplebbitAddress, timestamp } = post || {};
const { author, cid, deleted, link, locked, parentCid, pinned, postCid, reason, removed, shortCid, state, subplebbitAddress, timestamp } = post || {};
const title = post?.title?.trim();
const { isDescription, isRules } = post || {}; // custom properties, not from api
const { address, shortAddress } = author || {};
Expand Down Expand Up @@ -61,7 +61,7 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P
<>
<div className={styles.postInfo}>
<PostMenuMobile post={post} />
<span className={(hidden || deleted || removed) && styles.postDesktopHidden}>
<span className={(hidden || ((removed || deleted) && !reason)) && parentCid ? styles.postDesktopHidden : ''}>
<span className={styles.nameBlock}>
<span className={`${styles.name} ${(isDescription || isRules || authorRole) && !(deleted || removed) && styles.capcodeMod}`}>
{removed ? (
Expand Down Expand Up @@ -307,7 +307,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
if (editedComment) {
post = editedComment;
}
const { author, cid, deleted, postCid, removed, subplebbitAddress } = post || {};
const { author, cid, deleted, postCid, reason, removed, subplebbitAddress } = post || {};
const isRouteLinkToReply = useLocation().pathname.startsWith(`/p/${subplebbitAddress}/c/${cid}`);
const { hidden } = useHide({ cid });

Expand All @@ -321,7 +321,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {
data-post-cid={postCid}
>
<PostInfoAndMedia openReplyModal={openReplyModal} post={post} postReplyCount={postReplyCount} roles={roles} />
{!hidden && !deleted && !removed && <PostMessageMobile post={post} />}
{!hidden && (!(removed || deleted) || ((removed || deleted) && reason)) && <PostMessageMobile post={post} />}
<ReplyBacklinks post={reply} />
</div>
</div>
Expand All @@ -331,7 +331,7 @@ const Reply = ({ openReplyModal, postReplyCount, reply, roles }: PostProps) => {

const PostMobile = ({ openReplyModal, post, roles, showAllReplies, showReplies = true }: PostProps) => {
const { t } = useTranslation();
const { author, cid, content, pinned, postCid, replyCount, state, subplebbitAddress } = post || {};
const { author, cid, pinned, postCid, replyCount, state, subplebbitAddress } = post || {};
const { isDescription, isRules } = post || {}; // custom properties, not from api
const params = useParams();
const location = useLocation();
Expand Down Expand Up @@ -379,7 +379,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies, showReplies =
<div className={styles.postContainer}>
<div className={styles.postOp} data-cid={cid} data-author-address={author?.shortAddress} data-post-cid={postCid}>
<PostInfoAndMedia openReplyModal={openReplyModal} post={post} postReplyCount={replyCount} roles={roles} />
{content && <PostMessageMobile post={post} />}
<PostMessageMobile post={post} />
</div>
{!isInPostView && !isInPendingPostView && showReplies && (
<div className={styles.postLink}>
Expand Down

0 comments on commit ab1026a

Please sign in to comment.