mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: resolve typescript errors in post menu components
This commit is contained in:
@@ -90,7 +90,7 @@ const ImageSearchButtons = ({ url, onClose }: { url: string; onClose: () => void
|
|||||||
|
|
||||||
const HidePostButton = ({ cid, isReply, onClose, postCid }: HideButtonProps) => {
|
const HidePostButton = ({ cid, isReply, onClose, postCid }: HideButtonProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { hide, hidden, unhide } = useHide({ cid });
|
const { hide, hidden, unhide } = useHide({ cid: cid || '' });
|
||||||
const isInPostView = isPostPageView(useLocation().pathname, useParams());
|
const isInPostView = isPostPageView(useLocation().pathname, useParams());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -136,8 +136,11 @@ type PostMenuMobileProps = {
|
|||||||
|
|
||||||
const PostMenuMobile = ({ postMenu, editMenuPost }: PostMenuMobileProps) => {
|
const PostMenuMobile = ({ postMenu, editMenuPost }: PostMenuMobileProps) => {
|
||||||
const { authorAddress, cid, deleted, link, linkHeight, linkWidth, parentCid, postCid, removed, subplebbitAddress, thumbnailUrl } = postMenu || {};
|
const { authorAddress, cid, deleted, link, linkHeight, linkWidth, parentCid, postCid, removed, subplebbitAddress, thumbnailUrl } = postMenu || {};
|
||||||
const { isAccountMod, isAccountCommentAuthor } = useEditCommentPrivileges({ commentAuthorAddress: authorAddress, subplebbitAddress });
|
const { isAccountMod, isAccountCommentAuthor } = useEditCommentPrivileges({
|
||||||
const commentMediaInfo = getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight);
|
commentAuthorAddress: authorAddress || '',
|
||||||
|
subplebbitAddress: subplebbitAddress || '',
|
||||||
|
});
|
||||||
|
const commentMediaInfo = getCommentMediaInfo(link || '', thumbnailUrl || '', linkWidth || 0, linkHeight || 0);
|
||||||
const { thumbnail, type, url } = commentMediaInfo || {};
|
const { thumbnail, type, url } = commentMediaInfo || {};
|
||||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||||
const { refs, floatingStyles, context } = useFloating({
|
const { refs, floatingStyles, context } = useFloating({
|
||||||
|
|||||||
@@ -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
|
// Copies a share link to clipboard for a board, thread, description, or rules page
|
||||||
export function copyShareLinkToClipboard(boardIdentifier: string, linkType: 'thread', cid: string): Promise<void>;
|
export function copyShareLinkToClipboard(boardIdentifier: string, linkType: 'thread', cid: string): Promise<void>;
|
||||||
|
export function copyShareLinkToClipboard(boardIdentifier: string, linkType: Exclude<ShareLinkType, 'thread'>): Promise<void>;
|
||||||
export async function copyShareLinkToClipboard(boardIdentifier: string, linkType: ShareLinkType, cid?: string): Promise<void> {
|
export async function copyShareLinkToClipboard(boardIdentifier: string, linkType: ShareLinkType, cid?: string): Promise<void> {
|
||||||
if (linkType === 'thread') {
|
if (linkType === 'thread') {
|
||||||
if (!cid) {
|
if (!cid) {
|
||||||
|
|||||||
Reference in New Issue
Block a user