makin things work

This commit is contained in:
Connor Turland 2016-12-20 12:27:58 -05:00
parent f8c4520036
commit 85588825f0
3 changed files with 13 additions and 5 deletions

View file

@ -59,6 +59,8 @@ const ChatView = {
onClose: self.onClose, onClose: self.onClose,
leaveCall: Realtime.leaveCall, leaveCall: Realtime.leaveCall,
joinCall: Realtime.joinCall, joinCall: Realtime.joinCall,
inviteACall: Realtime.inviteACall,
inviteToJoin: Realtime.inviteToJoin,
participants: self.participants.models.map(p => p.attributes), participants: self.participants.models.map(p => p.attributes),
messages: self.messages.models.map(m => m.attributes), messages: self.messages.models.map(m => m.attributes),
videoToggleClick: self.videoToggleClick, videoToggleClick: self.videoToggleClick,
@ -92,7 +94,7 @@ const ChatView = {
mapper && mapper.set('isParticipating', true) mapper && mapper.set('isParticipating', true)
ChatView.render() ChatView.render()
}, },
mapperLeftCall: () => { mapperLeftCall: id => {
const mapper = ChatView.participants.findWhere({id}) const mapper = ChatView.participants.findWhere({id})
mapper && mapper.set('isParticipating', false) mapper && mapper.set('isParticipating', false)
ChatView.render() ChatView.render()

View file

@ -13,11 +13,11 @@ class Participant extends Component {
</div> </div>
{!self && !conversationLive && <button {!self && !conversationLive && <button
className='button chat-participant-invite-call' className='button chat-participant-invite-call'
onClick={this.props.inviteACall} // Realtime.inviteACall(id) onClick={() => this.props.inviteACall(id)} // Realtime.inviteACall(id)
/>} />}
{!self && mapperIsLive && !isParticipating && <button {!self && mapperIsLive && !isParticipating && <button
className="button chat-participant-invite-join" className="button chat-participant-invite-join"
onClick={this.props.inviteToJoin} // Realtime.inviteToJoin(id) onClick={() => this.props.inviteToJoin(id)} // Realtime.inviteToJoin(id)
/>} />}
{isParticipating && <span className="chat-participant-participating"> {isParticipating && <span className="chat-participant-participating">
<div className="green-dot"></div> <div className="green-dot"></div>
@ -37,7 +37,9 @@ Participant.propTypes = {
id: PropTypes.number, id: PropTypes.number,
image: PropTypes.string, // image url image: PropTypes.string, // image url
self: PropTypes.bool, self: PropTypes.bool,
username: PropTypes.string username: PropTypes.string,
inviteACall: PropTypes.func,
inviteToJoin: PropTypes.func
} }
export default Participant export default Participant

View file

@ -79,7 +79,7 @@ class MapChat extends Component {
render = () => { render = () => {
const rightOffset = this.state.open ? '0' : '-300px' const rightOffset = this.state.open ? '0' : '-300px'
const { conversationLive, isParticipating, participants, messages } = this.props const { conversationLive, isParticipating, participants, messages, inviteACall, inviteToJoin } = this.props
const { videosShowing, cursorsShowing, alertSound, unreadMessages } = this.state const { videosShowing, cursorsShowing, alertSound, unreadMessages } = this.state
return ( return (
<div className="chat-box" <div className="chat-box"
@ -103,6 +103,8 @@ class MapChat extends Component {
{participants.map(participant => <Participant {participants.map(participant => <Participant
key={participant.id} key={participant.id}
{...participant} {...participant}
inviteACall={inviteACall}
inviteToJoin={inviteToJoin}
conversationLive={conversationLive} conversationLive={conversationLive}
mapperIsLive={isParticipating}/> mapperIsLive={isParticipating}/>
)} )}
@ -138,6 +140,8 @@ MapChat.propTypes = {
onClose: PropTypes.func, onClose: PropTypes.func,
leaveCall: PropTypes.func, leaveCall: PropTypes.func,
joinCall: PropTypes.func, joinCall: PropTypes.func,
inviteACall: PropTypes.func,
inviteToJoin: PropTypes.func,
videoToggleClick: PropTypes.func, videoToggleClick: PropTypes.func,
cursorToggleClick: PropTypes.func, cursorToggleClick: PropTypes.func,
soundToggleClick: PropTypes.func, soundToggleClick: PropTypes.func,