// @flow import * as ICONS from 'constants/icons'; import React from 'react'; import { parseURI } from 'util/lbryURI'; import Empty from 'component/common/empty'; import MarkdownPreview from 'component/common/markdown-preview'; import Tooltip from 'component/common/tooltip'; import ChannelThumbnail from 'component/channelThumbnail'; import { Menu, MenuButton } from '@reach/menu-button'; import Icon from 'component/common/icon'; import classnames from 'classnames'; import CommentMenuList from 'component/commentMenuList'; import Button from 'component/button'; import CreditAmount from 'component/common/credit-amount'; import DateTime from 'component/dateTime'; import OptimizedImage from 'component/optimizedImage'; import { parseSticker } from 'util/comments'; type Props = { comment: Comment, forceUpdate?: any, uri: string, // --- redux: claim: StreamClaim, stakedLevel: number, myChannelIds: ?Array, }; function LivestreamComment(props: Props) { const { comment, forceUpdate, uri, claim, stakedLevel, myChannelIds } = props; const { channel_url: authorUri, comment: message, support_amount: supportAmount, timestamp } = comment; const [hasUserMention, setUserMention] = React.useState(false); const commentIsMine = comment.channel_id && isMyComment(comment.channel_id); const commentByOwnerOfContent = claim && claim.signing_channel && claim.signing_channel.permanent_url === authorUri; const { claimName } = parseURI(authorUri || ''); const stickerFromMessage = parseSticker(message); const timePosted = timestamp * 1000; // todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine function isMyComment(channelId: string) { return myChannelIds ? myChannelIds.includes(channelId) : false; } return (
  • 0, 'livestream-comment--sticker': Boolean(stickerFromMessage), 'livestream-comment--mentioned': hasUserMention, })} > {supportAmount > 0 && (
    )}
    {supportAmount > 0 && }
    {comment.is_global_mod && ( )} {comment.is_moderator && ( )} {commentByOwnerOfContent && ( )} {comment.is_pinned && ( {__('Pinned')} )} {/* Use key to force timestamp update */} {comment.removed ? (
    ) : stickerFromMessage ? (
    ) : (
    )}
  • ); } export default LivestreamComment;