mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(pending post): "[Reply]" button and post menu shouldn't be clickable
This commit is contained in:
@@ -184,6 +184,7 @@ const PostInfo = ({ openReplyModal, post, postReplyCount = 0, roles, isHidden }:
|
|||||||
[
|
[
|
||||||
<Link
|
<Link
|
||||||
to={isInAllView && isDescription ? '/p/all/description' : `/p/${subplebbitAddress}/${isDescription ? 'description' : isRules ? 'rules' : `c/${postCid}`}`}
|
to={isInAllView && isDescription ? '/p/all/description' : `/p/${subplebbitAddress}/${isDescription ? 'description' : isRules ? 'rules' : `c/${postCid}`}`}
|
||||||
|
onClick={(e) => !cid && e.preventDefault()}
|
||||||
>
|
>
|
||||||
{_.capitalize(t('reply'))}
|
{_.capitalize(t('reply'))}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -165,6 +165,12 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => {
|
|||||||
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
|
||||||
const headingId = useId();
|
const headingId = useId();
|
||||||
|
|
||||||
|
const handleMenuClick = () => {
|
||||||
|
if (cid) {
|
||||||
|
setMenuBtnRotated((prev) => !prev);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleClose = () => setMenuBtnRotated(false);
|
const handleClose = () => setMenuBtnRotated(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -173,13 +179,14 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => {
|
|||||||
<span
|
<span
|
||||||
className={isInCatalogView ? styles.postMenuBtnCatalog : styles.postMenuBtn}
|
className={isInCatalogView ? styles.postMenuBtnCatalog : styles.postMenuBtn}
|
||||||
title='Post menu'
|
title='Post menu'
|
||||||
onClick={() => setMenuBtnRotated((prev) => !prev)}
|
onClick={handleMenuClick}
|
||||||
style={{ transform: menuBtnRotated ? 'rotate(90deg)' : 'rotate(0deg)' }}
|
style={{ transform: menuBtnRotated && cid ? 'rotate(90deg)' : 'rotate(0deg)' }}
|
||||||
>
|
>
|
||||||
▶
|
▶
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
{menuBtnRotated &&
|
{menuBtnRotated &&
|
||||||
|
cid &&
|
||||||
createPortal(
|
createPortal(
|
||||||
<FloatingFocusManager context={context} modal={false}>
|
<FloatingFocusManager context={context} modal={false}>
|
||||||
<div className={styles.postMenu} ref={refs.setFloating} style={floatingStyles} aria-labelledby={headingId} {...getFloatingProps()}>
|
<div className={styles.postMenu} ref={refs.setFloating} style={floatingStyles} aria-labelledby={headingId} {...getFloatingProps()}>
|
||||||
|
|||||||
@@ -148,16 +148,23 @@ const PostMenuMobile = ({ post }: { post: Comment }) => {
|
|||||||
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
|
const { getReferenceProps, getFloatingProps } = useInteractions([click, dismiss, role]);
|
||||||
const headingId = useId();
|
const headingId = useId();
|
||||||
|
|
||||||
|
const handleMenuClick = () => {
|
||||||
|
if (cid) {
|
||||||
|
setIsMenuOpen((prev) => !prev);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleClose = () => setIsMenuOpen(false);
|
const handleClose = () => setIsMenuOpen(false);
|
||||||
|
|
||||||
const isInBoardView = isBoardView(useLocation().pathname, useParams());
|
const isInBoardView = isBoardView(useLocation().pathname, useParams());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span className={styles.postMenuBtn} title='Post menu' onClick={() => setIsMenuOpen((prev) => !prev)} ref={refs.setReference} {...getReferenceProps()}>
|
<span className={styles.postMenuBtn} title='Post menu' onClick={handleMenuClick} ref={refs.setReference} {...getReferenceProps()}>
|
||||||
...
|
...
|
||||||
</span>
|
</span>
|
||||||
{isMenuOpen &&
|
{isMenuOpen &&
|
||||||
|
cid &&
|
||||||
createPortal(
|
createPortal(
|
||||||
<FloatingFocusManager context={context} modal={false}>
|
<FloatingFocusManager context={context} modal={false}>
|
||||||
<div className={styles.postMenu} ref={refs.setFloating} style={floatingStyles} aria-labelledby={headingId} {...getFloatingProps()}>
|
<div className={styles.postMenu} ref={refs.setFloating} style={floatingStyles} aria-labelledby={headingId} {...getFloatingProps()}>
|
||||||
@@ -171,7 +178,7 @@ const PostMenuMobile = ({ post }: { post: Comment }) => {
|
|||||||
</FloatingFocusManager>,
|
</FloatingFocusManager>,
|
||||||
document.body,
|
document.body,
|
||||||
)}
|
)}
|
||||||
{(isAccountMod || isAccountCommentAuthor) && (
|
{(isAccountMod || isAccountCommentAuthor) && cid && (
|
||||||
<span className={styles.checkbox}>
|
<span className={styles.checkbox}>
|
||||||
<EditMenu isAccountCommentAuthor={isAccountCommentAuthor} isAccountMod={isAccountMod} isCommentAuthorMod={isCommentAuthorMod} post={post} />
|
<EditMenu isAccountCommentAuthor={isAccountCommentAuthor} isAccountMod={isAccountMod} isCommentAuthorMod={isCommentAuthorMod} post={post} />
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user