mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post): reply backlink didn't appear in post info immediately after replying to it
This commit is contained in:
@@ -199,10 +199,12 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }:
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
<PostMenuDesktop post={post} />
|
<PostMenuDesktop post={post} />
|
||||||
{replyCount > 0 &&
|
{cid &&
|
||||||
parentCid &&
|
parentCid &&
|
||||||
replies &&
|
replies &&
|
||||||
replies.map((reply: Comment, index: number) => reply?.parentCid === cid && <ReplyQuotePreview key={index} isBacklinkReply={true} backlinkReply={reply} />)}
|
replies.map(
|
||||||
|
(reply: Comment, index: number) => reply?.parentCid === cid && reply?.cid && <ReplyQuotePreview key={index} isBacklinkReply={true} backlinkReply={reply} />,
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -172,15 +172,17 @@ const PostInfoAndMedia = ({ openReplyModal, post, postReplyCount = 0, roles }: P
|
|||||||
};
|
};
|
||||||
|
|
||||||
const ReplyBacklinks = ({ post }: PostProps) => {
|
const ReplyBacklinks = ({ post }: PostProps) => {
|
||||||
const { cid, parentCid, replyCount } = post || {};
|
const { cid, parentCid } = post || {};
|
||||||
const replies = useReplies(post);
|
const replies = useReplies(post);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
replyCount > 0 &&
|
cid &&
|
||||||
parentCid &&
|
parentCid &&
|
||||||
replies && (
|
replies && (
|
||||||
<div className={styles.mobileReplyBacklinks}>
|
<div className={styles.mobileReplyBacklinks}>
|
||||||
{replies.map((reply: Comment, index: number) => reply?.parentCid === cid && <ReplyQuotePreview key={index} isBacklinkReply={true} backlinkReply={reply} />)}
|
{replies.map(
|
||||||
|
(reply: Comment, index: number) => reply?.parentCid === cid && reply?.cid && <ReplyQuotePreview key={index} isBacklinkReply={true} backlinkReply={reply} />,
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i
|
|||||||
onMouseOver={() => handleMouseOver(quotelinkReply?.cid)}
|
onMouseOver={() => handleMouseOver(quotelinkReply?.cid)}
|
||||||
onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)}
|
onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)}
|
||||||
>
|
>
|
||||||
{`c/${quotelinkReply?.shortCid}`}
|
{quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`}
|
||||||
{quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
|
{quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
|
||||||
</Link>
|
</Link>
|
||||||
<br />
|
<br />
|
||||||
@@ -200,11 +200,13 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is
|
|||||||
onMouseOver={() => handleMouseOver(backlinkReply?.cid)}
|
onMouseOver={() => handleMouseOver(backlinkReply?.cid)}
|
||||||
onMouseLeave={() => handleMouseLeave(backlinkReply?.cid)}
|
onMouseLeave={() => handleMouseLeave(backlinkReply?.cid)}
|
||||||
>
|
>
|
||||||
c/{backlinkReply?.shortCid}{' '}
|
{backlinkReply?.shortCid && `c/${backlinkReply?.shortCid}`}
|
||||||
</span>
|
</span>
|
||||||
<Link to={`/p/${backlinkReply?.subplebbitAddress}/c/${backlinkReply?.cid}`} className={styles.backlinkHash}>
|
{backlinkReply?.shortCid && (
|
||||||
#
|
<Link to={`/p/${backlinkReply?.subplebbitAddress}/c/${backlinkReply?.cid}`} className={styles.backlinkHash}>
|
||||||
</Link>
|
#
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
{hoveredCid === backlinkReply?.cid &&
|
{hoveredCid === backlinkReply?.cid &&
|
||||||
outOfViewCid === backlinkReply?.cid &&
|
outOfViewCid === backlinkReply?.cid &&
|
||||||
createPortal(
|
createPortal(
|
||||||
@@ -226,14 +228,15 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is
|
|||||||
onMouseOver={() => handleMouseOver(quotelinkReply?.cid)}
|
onMouseOver={() => handleMouseOver(quotelinkReply?.cid)}
|
||||||
onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)}
|
onMouseLeave={() => handleMouseLeave(quotelinkReply?.cid)}
|
||||||
>
|
>
|
||||||
c/{quotelinkReply?.shortCid}
|
{quotelinkReply?.shortCid && `c/${quotelinkReply?.shortCid}`}
|
||||||
{quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
|
{quotelinkReply?.author?.address === account?.author?.address && ' (You)'}
|
||||||
</span>
|
</span>
|
||||||
<Link className={styles.quoteLink} to={`/p/${quotelinkReply?.subplebbitAddress}/c/${quotelinkReply?.cid}`}>
|
{quotelinkReply?.shortCid && (
|
||||||
{' '}
|
<Link className={styles.quoteLink} to={`/p/${quotelinkReply?.subplebbitAddress}/c/${quotelinkReply?.cid}`}>
|
||||||
#
|
{' '}
|
||||||
</Link>
|
#
|
||||||
<br />
|
</Link>
|
||||||
|
)}
|
||||||
{hoveredCid === quotelinkReply?.cid &&
|
{hoveredCid === quotelinkReply?.cid &&
|
||||||
outOfViewCid === quotelinkReply?.cid &&
|
outOfViewCid === quotelinkReply?.cid &&
|
||||||
createPortal(
|
createPortal(
|
||||||
|
|||||||
Reference in New Issue
Block a user