From a23d8e313d3fcd61d935a160ab573d3c84af738f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 1 Sep 2016 00:13:32 +0100 Subject: [PATCH] show ongoing audio call in LeftPanel --- src/components/views/voip/CallView.js | 34 +++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/components/views/voip/CallView.js b/src/components/views/voip/CallView.js index cc5289e7f1..f566ec21bb 100644 --- a/src/components/views/voip/CallView.js +++ b/src/components/views/voip/CallView.js @@ -41,6 +41,16 @@ module.exports = React.createClass({ // a callback which is called when the content in the callview changes // in a way that is likely to cause a resize. onResize: React.PropTypes.func, + + // render ongoing audio call details - useful when in LeftPanel + showVoice: React.PropTypes.bool, + }, + + getInitialState: function() { + return { + // the call this view is displaying (if any) + call: null, + }; }, componentDidMount: function() { @@ -71,9 +81,15 @@ module.exports = React.createClass({ this.props.ConferenceHandler.getConferenceCallForRoom(roomId) : null ); + + if (this.call) { + this.setState({ call: call }); + } + } else { call = CallHandler.getAnyActiveCall(); + this.setState({ call: call }); } if (call) { @@ -108,11 +124,21 @@ module.exports = React.createClass({ render: function(){ var VideoView = sdk.getComponent('voip.VideoView'); + + var voice; + if (this.state.call && this.state.call.type === "voice" && this.props.showVoice) { + var callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId); + voice =
Active call ({ callRoom.name })
; + } + return ( - +
+ + { voice } +
); } });