// @flow import 'scss/component/_livestream-chat.scss'; import { parseSticker, getStickerUrl } from 'util/comments'; import * as ICONS from 'constants/icons'; import Button from 'component/button'; import ChannelThumbnail from 'component/channelThumbnail'; import classnames from 'classnames'; import CreditAmount from 'component/common/credit-amount'; import OptimizedImage from 'component/optimizedImage'; import React from 'react'; import Tooltip from 'component/common/tooltip'; import UriIndicator from 'component/uriIndicator'; type Props = { superChats: Array, toggleSuperChat: () => void, }; export default function LivestreamSuperchats(props: Props) { const { superChats: superChatsByAmount, toggleSuperChat } = props; const superChatTopTen = React.useMemo(() => { return superChatsByAmount ? superChatsByAmount.slice(0, 10) : superChatsByAmount; }, [superChatsByAmount]); const stickerSuperChats = superChatsByAmount && superChatsByAmount.filter(({ comment }) => !!parseSticker(comment)); const showMore = superChatTopTen && superChatsByAmount && superChatTopTen.length < superChatsByAmount.length; return !superChatTopTen ? null : (
{superChatTopTen.map((superChat: Comment) => { const { comment, comment_id, channel_url, support_amount, is_fiat } = superChat; const isSticker = stickerSuperChats && stickerSuperChats.includes(superChat); const stickerImg = ; return (
{isSticker &&
{stickerImg}
}
); })} {showMore && (
); }