// @flow import * as ICONS from 'constants/icons'; import React from 'react'; import { MenuList, MenuItem } from '@reach/menu-button'; import ChannelThumbnail from 'component/channelThumbnail'; import Icon from 'component/common/icon'; type Props = { uri: string, closeInlinePlayer: () => void, authorUri: string, // full LBRY Channel URI: lbry://@channel#123... commentId: string, // sha256 digest identifying the comment claimIsMine: boolean, // if you control the claim which this comment was posted on commentIsMine: boolean, // if this comment was signed by an owned channel deleteComment: (string, ?string) => void, linkedComment?: any, isPinned: boolean, pinComment: (string, boolean) => Promise, blockChannel: string => void, fetchComments: string => void, handleEditComment: () => void, contentChannelPermanentUrl: any, activeChannelClaim: ?ChannelClaim, claimIsMine: boolean, isTopLevel: boolean, // commentModBlock: string => void, }; function CommentMenuList(props: Props) { const { uri, authorUri, commentIsMine, commentId, deleteComment, blockChannel, pinComment, claimIsMine, closeInlinePlayer, activeChannelClaim, contentChannelPermanentUrl, isTopLevel, isPinned, handleEditComment, fetchComments, // commentModBlock, // setActiveChannel, } = props; const activeChannelIsCreator = activeChannelClaim && activeChannelClaim.permanent_url === contentChannelPermanentUrl; // let authorChannel; // try { // const { claimName } = parseURI(authorUri); // authorChannel = claimName; // } catch (e) {} function handlePinComment(commentId, remove) { pinComment(commentId, remove).then(() => fetchComments(uri)); } function handleDeleteComment() { closeInlinePlayer(); deleteComment(commentId, commentIsMine ? undefined : contentChannelPermanentUrl); } function handleCommentBlock() { if (claimIsMine) { // Block them from commenting on future content // commentModBlock(authorUri); } blockChannel(authorUri); } // function handleChooseChannel() { // const { channelClaimId } = parseURI(authorUri); // setActiveChannel(channelClaimId); // } return ( {/* {commentIsMine && activeChannelClaim && activeChannelClaim.permanent_url !== authorUri && (
{__('Use this channel')}
{__('Switch to %channel_name% to interact with this comment', { channel_name: authorChannel })}.
)} */} {activeChannelIsCreator &&
{__('Creator tools')}
} {activeChannelIsCreator && isTopLevel && ( handlePinComment(commentId, true) : () => handlePinComment(commentId, false)} > {isPinned ? __('Unpin') : __('Pin')} )} {activeChannelClaim && (activeChannelClaim.permanent_url === authorUri || activeChannelClaim.permanent_url === contentChannelPermanentUrl) && (
{__('Remove')}
)} {commentIsMine && activeChannelClaim && activeChannelClaim.permanent_url === authorUri && ( {__('Edit')} )} {/* Disabled until we deal with current app blocklist parity */} {!commentIsMine && (
{__('Block')}
{/* {activeChannelIsCreator && ( Hide this channel's comments and block them from commenting. )} */}
)} {activeChannelClaim && (
Interacting as {activeChannelClaim.name}
)}
); } export default CommentMenuList;