mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(post menu): link to other clients was broken on description post
This commit is contained in:
@@ -14,8 +14,6 @@ import _ from 'lodash';
|
||||
interface PostMenuDesktopProps {
|
||||
cid: string;
|
||||
isDescription?: boolean;
|
||||
isInAllView?: boolean;
|
||||
isInSubscriptionsView?: boolean;
|
||||
isRules?: boolean;
|
||||
subplebbitAddress: string;
|
||||
onClose: () => void;
|
||||
@@ -70,17 +68,13 @@ const ImageSearchButton = ({ url, onClose }: { url: string; onClose: () => void
|
||||
);
|
||||
};
|
||||
|
||||
const ViewOnButton = ({ cid, isDescription, isInAllView, isInSubscriptionsView, isRules, subplebbitAddress, onClose }: PostMenuDesktopProps) => {
|
||||
const ViewOnButton = ({ cid, isDescription, isRules, subplebbitAddress, onClose }: PostMenuDesktopProps) => {
|
||||
const { t } = useTranslation();
|
||||
const [isClientRedirectMenuOpen, setIsClientRedirectMenuOpen] = useState(false);
|
||||
|
||||
const getViewOnOtherClientLink = () => {
|
||||
if (isDescription || isRules) {
|
||||
if (isInAllView || isInSubscriptionsView) {
|
||||
return `${isInAllView ? 'all' : isInSubscriptionsView && 'subscriptions'}`;
|
||||
} else {
|
||||
return `${subplebbitAddress}/${isDescription ? 'description' : isRules && 'rules'}`;
|
||||
}
|
||||
return `${subplebbitAddress}`;
|
||||
} else {
|
||||
return `${subplebbitAddress}/c/${cid}`;
|
||||
}
|
||||
@@ -203,15 +197,7 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => {
|
||||
</div>
|
||||
)}
|
||||
{link && isValidURL(link) && (type === 'image' || type === 'gif' || thumbnail) && url && <ImageSearchButton url={url} onClose={handleClose} />}
|
||||
<ViewOnButton
|
||||
cid={cid}
|
||||
isDescription={isDescription}
|
||||
isInAllView={isInAllView}
|
||||
isInSubscriptionsView={isInSubscriptionsView}
|
||||
isRules={isRules}
|
||||
subplebbitAddress={subplebbitAddress}
|
||||
onClose={handleClose}
|
||||
/>
|
||||
<ViewOnButton cid={cid} isDescription={isDescription} isRules={isRules} subplebbitAddress={subplebbitAddress} onClose={handleClose} />
|
||||
{!isDescription && !isRules && <BlockUserButton address={author?.address} />}
|
||||
{(isInAllView || isInSubscriptionsView) && <BlockBoardButton address={subplebbitAddress} />}
|
||||
</div>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { copyShareLinkToClipboard, isValidURL } from '../../../lib/utils/url-uti
|
||||
import useEditCommentPrivileges from '../../../hooks/use-author-privileges';
|
||||
import useHide from '../../../hooks/use-hide';
|
||||
import EditMenu from '../../edit-menu/edit-menu';
|
||||
import { isAllView, isBoardView, isPostPageView, isSubscriptionsView } from '../../../lib/utils/view-utils';
|
||||
import { isBoardView, isPostPageView } from '../../../lib/utils/view-utils';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
|
||||
interface PostMenuMobileProps {
|
||||
@@ -57,18 +57,10 @@ const ImageSearchButtons = ({ url, onClose }: { url: string; onClose: () => void
|
||||
|
||||
const ViewOnButtons = ({ cid, isDescription, isRules, subplebbitAddress, onClose }: PostMenuMobileProps) => {
|
||||
const { t } = useTranslation();
|
||||
const location = useLocation();
|
||||
const params = useParams();
|
||||
const isInAllView = isAllView(location.pathname);
|
||||
const isInSubscriptionsView = isSubscriptionsView(location.pathname, params);
|
||||
|
||||
const getViewOnOtherClientLink = () => {
|
||||
if (isDescription || isRules) {
|
||||
if (isInAllView || isInSubscriptionsView) {
|
||||
return `${isInAllView ? 'all' : isInSubscriptionsView && 'subscriptions'}`;
|
||||
} else {
|
||||
return `${subplebbitAddress}/${isDescription ? 'description' : isRules && 'rules'}`;
|
||||
}
|
||||
return `${subplebbitAddress}`;
|
||||
} else {
|
||||
return `${subplebbitAddress}/c/${cid}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user