// @flow import { URL, SHARE_DOMAIN_URL } from 'config'; import * as ICONS from 'constants/icons'; import React from 'react'; import classnames from 'classnames'; import { Menu, MenuButton, MenuList, MenuItem } from '@reach/menu-button'; import Icon from 'component/common/icon'; import { generateShareUrl } from 'util/url'; const SHARE_DOMAIN = SHARE_DOMAIN_URL || URL; type Props = { uri: string, claim: ?Claim, inline?: boolean, claimIsMine: boolean, channelIsMuted: boolean, channelIsBlocked: boolean, doToggleMuteChannel: (string) => void, doCommentModBlock: (string) => void, doCommentModUnBlock: (string) => void, }; function ClaimMenuList(props: Props) { const { uri, claim, inline = false, claimIsMine, doToggleMuteChannel, channelIsMuted, channelIsBlocked, doCommentModBlock, doCommentModUnBlock, } = props; const channelUri = claim && (claim.value_type === 'channel' ? claim.permanent_url : claim.signing_channel && claim.signing_channel.permanent_url); const shareUrl: string = generateShareUrl(SHARE_DOMAIN, uri); if (!channelUri || !claim) { return null; } function handleToggleMute() { doToggleMuteChannel(channelUri); } function handleToggleBlock() { if (channelIsBlocked) { doCommentModUnBlock(channelUri); } else { doCommentModBlock(channelUri); } } function handleCopyLink() { navigator.clipboard.writeText(shareUrl); } function handleReportContent() { window.open(`https://lbry.com/dmca/${claim.claim_id}`, '_blank', 'noopener'); } return ( { e.stopPropagation(); e.preventDefault(); }} > {!claimIsMine && ( <>
{channelIsBlocked ? __('Unblock Channel') : __('Block Channel')}
{channelIsMuted ? __('Unmute Channel') : __('Mute Channel')}

)}
{__('Copy Link')}
{!claimIsMine && (
{__('Report Content')}
)}
); } export default ClaimMenuList;