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 {
|
interface PostMenuDesktopProps {
|
||||||
cid: string;
|
cid: string;
|
||||||
isDescription?: boolean;
|
isDescription?: boolean;
|
||||||
isInAllView?: boolean;
|
|
||||||
isInSubscriptionsView?: boolean;
|
|
||||||
isRules?: boolean;
|
isRules?: boolean;
|
||||||
subplebbitAddress: string;
|
subplebbitAddress: string;
|
||||||
onClose: () => void;
|
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 { t } = useTranslation();
|
||||||
const [isClientRedirectMenuOpen, setIsClientRedirectMenuOpen] = useState(false);
|
const [isClientRedirectMenuOpen, setIsClientRedirectMenuOpen] = useState(false);
|
||||||
|
|
||||||
const getViewOnOtherClientLink = () => {
|
const getViewOnOtherClientLink = () => {
|
||||||
if (isDescription || isRules) {
|
if (isDescription || isRules) {
|
||||||
if (isInAllView || isInSubscriptionsView) {
|
return `${subplebbitAddress}`;
|
||||||
return `${isInAllView ? 'all' : isInSubscriptionsView && 'subscriptions'}`;
|
|
||||||
} else {
|
|
||||||
return `${subplebbitAddress}/${isDescription ? 'description' : isRules && 'rules'}`;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return `${subplebbitAddress}/c/${cid}`;
|
return `${subplebbitAddress}/c/${cid}`;
|
||||||
}
|
}
|
||||||
@@ -203,15 +197,7 @@ const PostMenuDesktop = ({ post }: { post: Comment }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{link && isValidURL(link) && (type === 'image' || type === 'gif' || thumbnail) && url && <ImageSearchButton url={url} onClose={handleClose} />}
|
{link && isValidURL(link) && (type === 'image' || type === 'gif' || thumbnail) && url && <ImageSearchButton url={url} onClose={handleClose} />}
|
||||||
<ViewOnButton
|
<ViewOnButton cid={cid} isDescription={isDescription} isRules={isRules} subplebbitAddress={subplebbitAddress} onClose={handleClose} />
|
||||||
cid={cid}
|
|
||||||
isDescription={isDescription}
|
|
||||||
isInAllView={isInAllView}
|
|
||||||
isInSubscriptionsView={isInSubscriptionsView}
|
|
||||||
isRules={isRules}
|
|
||||||
subplebbitAddress={subplebbitAddress}
|
|
||||||
onClose={handleClose}
|
|
||||||
/>
|
|
||||||
{!isDescription && !isRules && <BlockUserButton address={author?.address} />}
|
{!isDescription && !isRules && <BlockUserButton address={author?.address} />}
|
||||||
{(isInAllView || isInSubscriptionsView) && <BlockBoardButton address={subplebbitAddress} />}
|
{(isInAllView || isInSubscriptionsView) && <BlockBoardButton address={subplebbitAddress} />}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { copyShareLinkToClipboard, isValidURL } from '../../../lib/utils/url-uti
|
|||||||
import useEditCommentPrivileges from '../../../hooks/use-author-privileges';
|
import useEditCommentPrivileges from '../../../hooks/use-author-privileges';
|
||||||
import useHide from '../../../hooks/use-hide';
|
import useHide from '../../../hooks/use-hide';
|
||||||
import EditMenu from '../../edit-menu/edit-menu';
|
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';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
|
|
||||||
interface PostMenuMobileProps {
|
interface PostMenuMobileProps {
|
||||||
@@ -57,18 +57,10 @@ const ImageSearchButtons = ({ url, onClose }: { url: string; onClose: () => void
|
|||||||
|
|
||||||
const ViewOnButtons = ({ cid, isDescription, isRules, subplebbitAddress, onClose }: PostMenuMobileProps) => {
|
const ViewOnButtons = ({ cid, isDescription, isRules, subplebbitAddress, onClose }: PostMenuMobileProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const location = useLocation();
|
|
||||||
const params = useParams();
|
|
||||||
const isInAllView = isAllView(location.pathname);
|
|
||||||
const isInSubscriptionsView = isSubscriptionsView(location.pathname, params);
|
|
||||||
|
|
||||||
const getViewOnOtherClientLink = () => {
|
const getViewOnOtherClientLink = () => {
|
||||||
if (isDescription || isRules) {
|
if (isDescription || isRules) {
|
||||||
if (isInAllView || isInSubscriptionsView) {
|
return `${subplebbitAddress}`;
|
||||||
return `${isInAllView ? 'all' : isInSubscriptionsView && 'subscriptions'}`;
|
|
||||||
} else {
|
|
||||||
return `${subplebbitAddress}/${isDescription ? 'description' : isRules && 'rules'}`;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return `${subplebbitAddress}/c/${cid}`;
|
return `${subplebbitAddress}/c/${cid}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user