mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(reply-quote-preview): only scroll to reply when on thread page
This commit is contained in:
@@ -126,6 +126,8 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
const isOnThreadPage = location.pathname.includes('/thread/');
|
||||
|
||||
const handleClick = (e: React.MouseEvent, cid: string | undefined, subplebbitAddress: string | undefined, isOpQuote = false) => {
|
||||
e.preventDefault();
|
||||
if (cid && subplebbitAddress) {
|
||||
@@ -139,7 +141,7 @@ const DesktopQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, i
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (scrollToReplyOnPage(cid)) return;
|
||||
if (isOnThreadPage && scrollToReplyOnPage(cid)) return;
|
||||
navigate(threadRoute);
|
||||
}
|
||||
};
|
||||
@@ -246,6 +248,7 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const isOnThreadPage = location.pathname.includes('/thread/');
|
||||
|
||||
const handleClick = (e: React.MouseEvent, cid: string | undefined, subplebbitAddress: string | undefined, isOpQuote = false) => {
|
||||
e.preventDefault();
|
||||
@@ -260,7 +263,7 @@ const MobileQuotePreview = ({ backlinkReply, quotelinkReply, isBacklinkReply, is
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (scrollToReplyOnPage(cid)) return;
|
||||
if (isOnThreadPage && scrollToReplyOnPage(cid)) return;
|
||||
navigate(threadRoute);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user