mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post menu mobile): close after hiding reply
This commit is contained in:
@@ -70,14 +70,19 @@ const ViewOnButtons = ({ cid, isDescription, isRules, subplebbitAddress, onClose
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const HidePostButton = ({ cid, isReply, postCid }: PostMenuMobileProps) => {
|
const HidePostButton = ({ cid, isReply, onClose, postCid }: PostMenuMobileProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { hide, hidden, unhide } = useHide({ cid });
|
const { hide, hidden, unhide } = useHide({ cid });
|
||||||
const isInPostView = isPostPageView(useLocation().pathname, useParams());
|
const isInPostView = isPostPageView(useLocation().pathname, useParams());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
(!isInPostView || isReply) && (
|
(!isInPostView || isReply) && (
|
||||||
<div onClick={hidden ? unhide : hide}>
|
<div
|
||||||
|
onClick={() => {
|
||||||
|
hidden ? unhide() : hide();
|
||||||
|
onClose && onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div className={styles.postMenuItem}>
|
<div className={styles.postMenuItem}>
|
||||||
{hidden ? (postCid === cid ? t('unhide_thread') : t('unhide_post')) : postCid === cid ? t('hide_thread') : t('hide_post')}
|
{hidden ? (postCid === cid ? t('unhide_thread') : t('unhide_post')) : postCid === cid ? t('hide_thread') : t('hide_post')}
|
||||||
</div>
|
</div>
|
||||||
@@ -139,7 +144,7 @@ const PostMenuMobile = ({ post }: { post: Comment }) => {
|
|||||||
<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()}>
|
||||||
{cid && subplebbitAddress && <CopyLinkButton cid={cid} subplebbitAddress={subplebbitAddress} onClose={handleClose} />}
|
{cid && subplebbitAddress && <CopyLinkButton cid={cid} subplebbitAddress={subplebbitAddress} onClose={handleClose} />}
|
||||||
{cid && subplebbitAddress && <HidePostButton cid={cid} isReply={parentCid} postCid={post.postCid} />}
|
{cid && subplebbitAddress && <HidePostButton cid={cid} isReply={parentCid} postCid={post.postCid} onClose={handleClose} />}
|
||||||
{cid && subplebbitAddress && <BlockUserButton address={author?.address} />}
|
{cid && subplebbitAddress && <BlockUserButton address={author?.address} />}
|
||||||
{cid && subplebbitAddress && !isInBoardView && <BlockBoardButton address={subplebbitAddress} />}
|
{cid && subplebbitAddress && !isInBoardView && <BlockBoardButton address={subplebbitAddress} />}
|
||||||
{link && isValidURL(link) && (type === 'image' || type === 'gif' || thumbnail) && url && <ImageSearchButtons url={url} onClose={handleClose} />}
|
{link && isValidURL(link) && (type === 'image' || type === 'gif' || thumbnail) && url && <ImageSearchButtons url={url} onClose={handleClose} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user