metamaps--metamaps/frontend/src/components/MapChat/Participant.js

44 lines
1.4 KiB
JavaScript
Raw Normal View History

import React, { PropTypes, Component } from 'react'
class Participant extends Component {
render() {
const { conversationLive, mapperIsLive, isParticipating, isPending, id, self, image, username, selfName, color } = this.props
return (
<div className={`participant participant-${id} ${self ? 'is-self' : ''}`}>
<div className="chat-participant-image">
<img src={image} style={{ border: `2px solid ${color}`}} />
</div>
<div className="chat-participant-name">
{username} {self ? '(me)' : ''}
</div>
{!self && !conversationLive && <button
className='button chat-participant-invite-call'
onClick={this.props.inviteACall} // Realtime.inviteACall(id)
/>}
{!self && mapperIsLive && !isParticipating && <button
className="button chat-participant-invite-join"
onClick={this.props.inviteToJoin} // Realtime.inviteToJoin(id)
/>}
{isParticipating && <span className="chat-participant-participating">
<div className="green-dot"></div>
</span>}
<div className="clearfloat"></div>
</div>
)
}
}
2016-12-19 00:08:48 -05:00
Participant.propTypes = {
conversationLive: PropTypes.bool,
mapperIsLive: PropTypes.bool,
isParticipating: PropTypes.bool,
isPending: PropTypes.bool,
2016-12-18 23:24:57 -05:00
color: PropTypes.string, // css color
id: PropTypes.number,
image: PropTypes.string, // image url
self: PropTypes.bool,
2016-12-18 23:24:57 -05:00
username: PropTypes.string
}
2016-12-19 00:08:48 -05:00
export default Participant