show ongoing audio call in LeftPanel

This commit is contained in:
Matthew Hodgson 2016-09-01 00:13:32 +01:00
parent dae250b3a3
commit a23d8e313d

View file

@ -41,6 +41,16 @@ module.exports = React.createClass({
// a callback which is called when the content in the callview changes // a callback which is called when the content in the callview changes
// in a way that is likely to cause a resize. // in a way that is likely to cause a resize.
onResize: React.PropTypes.func, 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() { componentDidMount: function() {
@ -71,9 +81,15 @@ module.exports = React.createClass({
this.props.ConferenceHandler.getConferenceCallForRoom(roomId) : this.props.ConferenceHandler.getConferenceCallForRoom(roomId) :
null null
); );
if (this.call) {
this.setState({ call: call });
}
} }
else { else {
call = CallHandler.getAnyActiveCall(); call = CallHandler.getAnyActiveCall();
this.setState({ call: call });
} }
if (call) { if (call) {
@ -108,11 +124,21 @@ module.exports = React.createClass({
render: function(){ render: function(){
var VideoView = sdk.getComponent('voip.VideoView'); 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 = <div className="mx_CallView_voice" onClick={ this.props.onClick }>Active call ({ callRoom.name })</div>;
}
return ( return (
<VideoView ref="video" onClick={ this.props.onClick } <div>
onResize={ this.props.onResize } <VideoView ref="video" onClick={ this.props.onClick }
maxHeight={ this.props.maxVideoHeight } onResize={ this.props.onResize }
/> maxHeight={ this.props.maxVideoHeight }
/>
{ voice }
</div>
); );
} }
}); });