import React from 'react'; import { connect } from 'react-redux'; import { participantListSelector } from '../../Selectors'; import classnames from 'classnames'; import { withStyles } from '@material-ui/core/styles'; import { withRoomContext } from '../../../RoomContext'; import PropTypes from 'prop-types'; import { Flipper, Flipped } from 'react-flip-toolkit'; import { FormattedMessage } from 'react-intl'; import ListPeer from './ListPeer'; import ListMe from './ListMe'; import ListModerator from './ListModerator'; import Volume from '../../Containers/Volume'; const styles = (theme) => ({ root : { width : '100%', overflowY : 'auto', padding : theme.spacing(1) }, list : { listStyleType : 'none', padding : theme.spacing(1), boxShadow : '0 2px 5px 2px rgba(0, 0, 0, 0.2)', backgroundColor : 'rgba(255, 255, 255, 1)' }, listheader : { fontWeight : 'bolder' }, listItem : { width : '100%', overflow : 'hidden', cursor : 'pointer', '&.selected' : { backgroundColor : 'rgba(55, 126, 255, 1)' }, '&:not(:last-child)' : { borderBottom : '1px solid #CBCBCB' } } }); class ParticipantList extends React.PureComponent { componentDidMount() { this.node.scrollTop = this.node.scrollHeight; } getSnapshotBeforeUpdate() { return this.node.scrollTop + this.node.offsetHeight === this.node.scrollHeight; } componentDidUpdate(prevProps, prevState, shouldScroll) { if (shouldScroll) { this.node.scrollTop = this.node.scrollHeight; } } render() { const { roomClient, advancedMode, isModerator, participants, spotlights, selectedPeerId, classes } = this.props; return (