diff --git a/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx b/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx index 0f4d9abd..d158368e 100644 --- a/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx +++ b/src/components/post-mobile/post-menu-mobile/post-menu-mobile.tsx @@ -90,7 +90,7 @@ const ImageSearchButtons = ({ url, onClose }: { url: string; onClose: () => void const HidePostButton = ({ cid, isReply, onClose, postCid }: HideButtonProps) => { const { t } = useTranslation(); - const { hide, hidden, unhide } = useHide({ cid }); + const { hide, hidden, unhide } = useHide({ cid: cid || '' }); const isInPostView = isPostPageView(useLocation().pathname, useParams()); return ( @@ -136,8 +136,11 @@ type PostMenuMobileProps = { const PostMenuMobile = ({ postMenu, editMenuPost }: PostMenuMobileProps) => { const { authorAddress, cid, deleted, link, linkHeight, linkWidth, parentCid, postCid, removed, subplebbitAddress, thumbnailUrl } = postMenu || {}; - const { isAccountMod, isAccountCommentAuthor } = useEditCommentPrivileges({ commentAuthorAddress: authorAddress, subplebbitAddress }); - const commentMediaInfo = getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight); + const { isAccountMod, isAccountCommentAuthor } = useEditCommentPrivileges({ + commentAuthorAddress: authorAddress || '', + subplebbitAddress: subplebbitAddress || '', + }); + const commentMediaInfo = getCommentMediaInfo(link || '', thumbnailUrl || '', linkWidth || 0, linkHeight || 0); const { thumbnail, type, url } = commentMediaInfo || {}; const [isMenuOpen, setIsMenuOpen] = useState(false); const { refs, floatingStyles, context } = useFloating({ diff --git a/src/lib/utils/url-utils.ts b/src/lib/utils/url-utils.ts index c7cf937a..a14cc9df 100644 --- a/src/lib/utils/url-utils.ts +++ b/src/lib/utils/url-utils.ts @@ -17,10 +17,11 @@ export const isValidURL = (url: string) => { } }; -export type ShareLinkType = 'thread'; +export type ShareLinkType = 'thread' | 'catalog'; // Copies a share link to clipboard for a board, thread, description, or rules page export function copyShareLinkToClipboard(boardIdentifier: string, linkType: 'thread', cid: string): Promise; +export function copyShareLinkToClipboard(boardIdentifier: string, linkType: Exclude): Promise; export async function copyShareLinkToClipboard(boardIdentifier: string, linkType: ShareLinkType, cid?: string): Promise { if (linkType === 'thread') { if (!cid) {