import React from 'react'; import { Track } from 'livekit-client'; import LetterTile from './letter-tile.jsx'; import VCCarouselItem from './vc-carousel-item.jsx'; import { VC_CAROUSEL_ITEM_GAP } from '../constants.js'; export default class VCCarousel extends React.Component { constructor(props) { super(props); this.handlePrevClick = this.handlePrevClick.bind(this); this.handleNextClick = this.handleNextClick.bind(this); this.carouselRef = React.createRef(); this.contentRef = React.createRef(); this.prevRef = React.createRef(); this.nextRef = React.createRef(); } handlePrevClick() { const gap = VC_CAROUSEL_ITEM_GAP; const width = this.carouselRef.current.offsetWidth; this.carouselRef.current.scrollBy(-(width + gap), 0); if (this.carouselRef.current.scrollLeft - width - gap <= 0) { this.prevRef.current.style.display = 'none'; } if (!this.contentRef.current.scrollWidth - width - gap <= this.carouselRef.current.scrollLeft + width) { this.nextRef.current.style.display = 'flex'; } } handleNextClick() { const gap = VC_CAROUSEL_ITEM_GAP; const width = this.carouselRef.current.offsetWidth; this.carouselRef.current.scrollBy(width + gap, 0); if (this.carouselRef.current.scrollWidth !== 0) { this.prevRef.current.style.display = 'flex'; } if (this.contentRef.current.scrollWidth - width - gap <= this.carouselRef.current.scrollLeft + width) { this.nextRef.current.style.display = 'none'; } } render() { let peers = []; if (this.props.participants) { Object.entries(this.props.participants).forEach(([identity, party], i) => { const participant = party.participant; const cameraPub = participant.getTrack(Track.Source.Camera); const micPub = participant.getTrack(Track.Source.Microphone); peers.push(); }); } return ( <> ); } }