Files
ThreadNet-Web/src/skins/vector/views/molecules/voip/IncomingCallBox.js
T

76 lines
2.8 KiB
JavaScript
Raw Normal View History

2015-07-16 16:32:11 +01:00
/*
Copyright 2015 OpenMarket Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
'use strict';
var React = require('react');
2015-09-22 19:09:23 +01:00
var MatrixClientPeg = require('matrix-react-sdk/lib/MatrixClientPeg');
2015-07-16 16:32:11 +01:00
var IncomingCallBoxController = require(
2015-09-22 19:09:23 +01:00
"matrix-react-sdk/lib/controllers/molecules/voip/IncomingCallBox"
2015-07-16 16:32:11 +01:00
);
module.exports = React.createClass({
displayName: 'IncomingCallBox',
mixins: [IncomingCallBoxController],
getRingAudio: function() {
return this.refs.ringAudio.getDOMNode();
},
2015-07-16 16:32:11 +01:00
render: function() {
2015-10-27 12:59:04 +00:00
// NB: This block MUST be the first thing inside the <div> else react won't
// know that they refer to the same thing and so will clobber them between
// in-call / not-in-call resulting in no inbound audio.
var audioBlock = (
<audio ref="ringAudio" loop>
<source src="media/ring.ogg" type="audio/ogg" />
<source src="media/ring.mp3" type="audio/mpeg" />
</audio>
);
2015-07-19 01:58:04 +01:00
if (!this.state.incomingCall || !this.state.incomingCall.roomId) {
2015-07-16 16:32:11 +01:00
return (
<div>
2015-10-27 12:59:04 +00:00
{audioBlock}
</div>
2015-07-16 16:32:11 +01:00
);
}
2015-07-19 01:58:04 +01:00
var caller = MatrixClientPeg.get().getRoom(this.state.incomingCall.roomId).name;
2015-07-16 16:32:11 +01:00
return (
<div className="mx_IncomingCallBox">
2015-10-27 12:59:04 +00:00
{audioBlock}
2015-07-19 03:37:39 +01:00
<img className="mx_IncomingCallBox_chevron" src="img/chevron-left.png" width="9" height="16" />
2015-07-16 16:32:11 +01:00
<div className="mx_IncomingCallBox_title">
2015-07-19 01:58:04 +01:00
Incoming { this.state.incomingCall ? this.state.incomingCall.type : '' } call from { caller }
2015-07-16 16:32:11 +01:00
</div>
<div className="mx_IncomingCallBox_buttons">
2015-07-19 01:58:04 +01:00
<div className="mx_IncomingCallBox_buttons_cell">
<div className="mx_IncomingCallBox_buttons_decline" onClick={this.onRejectClick}>
Decline
</div>
2015-07-16 16:32:11 +01:00
</div>
2015-07-19 01:58:04 +01:00
<div className="mx_IncomingCallBox_buttons_cell">
<div className="mx_IncomingCallBox_buttons_accept" onClick={this.onAnswerClick}>
Accept
</div>
2015-07-16 16:32:11 +01:00
</div>
</div>
</div>
);
}
});