// @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'; import Slide from '@mui/material/Slide'; type Props = { superChats: Array, superchatsHidden?: boolean, isMobile?: boolean, toggleSuperChat: () => void, }; export default function LivestreamSuperchats(props: Props) { const { superChats: superChatsByAmount, superchatsHidden, isMobile, 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 && (
); } type SliderProps = { superchatsHidden?: boolean, isMobile?: boolean, children: any, }; const Slider = (sliderProps: SliderProps) => { const { superchatsHidden, isMobile, children } = sliderProps; return isMobile ? ( {children} ) : ( <>{children} ); };