Added incomingCallBox to header and removed from roomTile
This commit is contained in:
parent
f95a74951e
commit
45f17eb973
3 changed files with 50 additions and 36 deletions
|
@ -326,39 +326,45 @@ module.exports = React.createClass({
|
||||||
_repositionIncomingCallBox: function(e, firstTime) {
|
_repositionIncomingCallBox: function(e, firstTime) {
|
||||||
var incomingCallBox = document.getElementById("incomingCallBox");
|
var incomingCallBox = document.getElementById("incomingCallBox");
|
||||||
if (incomingCallBox && incomingCallBox.parentElement) {
|
if (incomingCallBox && incomingCallBox.parentElement) {
|
||||||
var scroll = this._getScrollNode();
|
var scrollArea = this._getScrollNode();
|
||||||
var top = (scroll.offsetTop + incomingCallBox.parentElement.offsetTop - scroll.scrollTop);
|
// Use the offset of the top of the scroll area from the window
|
||||||
|
// as this is used to calculate the CSS fixed top position for the stickies
|
||||||
|
var scrollAreaOffset = scrollArea.getBoundingClientRect().top + window.pageYOffset;
|
||||||
|
|
||||||
if (firstTime) {
|
// var scroll = this._getScrollNode();
|
||||||
// scroll to make sure the callbox is on the screen...
|
// var top = (scroll.offsetTop + incomingCallBox.parentElement.offsetTop - scroll.scrollTop);
|
||||||
if (top < 10) { // 10px of vertical margin at top of screen
|
var top = (incomingCallBox.parentElement.getBoundingClientRect().top + window.pageYOffset)
|
||||||
scroll.scrollTop = incomingCallBox.parentElement.offsetTop - 10;
|
|
||||||
}
|
|
||||||
else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) {
|
|
||||||
scroll.scrollTop = incomingCallBox.parentElement.offsetTop - scroll.offsetHeight + incomingCallBox.offsetHeight - 50;
|
|
||||||
}
|
|
||||||
// recalculate top in case we clipped it.
|
|
||||||
top = (scroll.offsetTop + incomingCallBox.parentElement.offsetTop - scroll.scrollTop);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// stop the box from scrolling off the screen
|
|
||||||
if (top < 10) {
|
|
||||||
top = 10;
|
|
||||||
}
|
|
||||||
else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) {
|
|
||||||
top = scroll.clientHeight - incomingCallBox.offsetHeight + 50;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// slightly ugly hack to offset if there's a toolbar present.
|
// if (firstTime) {
|
||||||
// we really should be calculating our absolute offsets of top by recursing through the DOM
|
// // scroll to make sure the callbox is on the screen...
|
||||||
toolbar = document.getElementsByClassName("mx_MatrixToolbar")[0];
|
// if (top < 10) { // 10px of vertical margin at top of screen
|
||||||
if (toolbar) {
|
// scrollArea.scrollTop = incomingCallBox.parentElement.offsetTop - 10;
|
||||||
top += toolbar.offsetHeight;
|
// }
|
||||||
}
|
// else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) {
|
||||||
|
// scroll.scrollTop = incomingCallBox.parentElement.offsetTop - scroll.offsetHeight + incomingCallBox.offsetHeight - 50;
|
||||||
|
// }
|
||||||
|
// // recalculate top in case we clipped it.
|
||||||
|
// top = (scroll.offsetTop + incomingCallBox.parentElement.offsetTop - scroll.scrollTop);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// // stop the box from scrolling off the screen
|
||||||
|
// if (top < 10) {
|
||||||
|
// top = 10;
|
||||||
|
// }
|
||||||
|
// else if (top > scroll.clientHeight - incomingCallBox.offsetHeight + 50) {
|
||||||
|
// top = scroll.clientHeight - incomingCallBox.offsetHeight + 50;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // slightly ugly hack to offset if there's a toolbar present.
|
||||||
|
// // we really should be calculating our absolute offsets of top by recursing through the DOM
|
||||||
|
// toolbar = document.getElementsByClassName("mx_MatrixToolbar")[0];
|
||||||
|
// if (toolbar) {
|
||||||
|
// top += toolbar.offsetHeight;
|
||||||
|
// }
|
||||||
|
|
||||||
incomingCallBox.style.top = top + "px";
|
incomingCallBox.style.top = top + "px";
|
||||||
incomingCallBox.style.left = scroll.offsetLeft + scroll.offsetWidth + "px";
|
incomingCallBox.style.left = scrollArea.offsetLeft + scrollArea.offsetWidth + "px";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -267,11 +267,11 @@ module.exports = React.createClass({
|
||||||
tooltip = <RoomTooltip className="mx_RoomTile_tooltip" room={this.props.room} />;
|
tooltip = <RoomTooltip className="mx_RoomTile_tooltip" room={this.props.room} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
var incomingCallBox;
|
//var incomingCallBox;
|
||||||
if (this.props.incomingCall) {
|
//if (this.props.incomingCall) {
|
||||||
var IncomingCallBox = sdk.getComponent("voip.IncomingCallBox");
|
// var IncomingCallBox = sdk.getComponent("voip.IncomingCallBox");
|
||||||
incomingCallBox = <IncomingCallBox incomingCall={ this.props.incomingCall }/>;
|
// incomingCallBox = <IncomingCallBox incomingCall={ this.props.incomingCall }/>;
|
||||||
}
|
//}
|
||||||
|
|
||||||
var RoomAvatar = sdk.getComponent('avatars.RoomAvatar');
|
var RoomAvatar = sdk.getComponent('avatars.RoomAvatar');
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ module.exports = React.createClass({
|
||||||
{ label }
|
{ label }
|
||||||
{ badge }
|
{ badge }
|
||||||
</div>
|
</div>
|
||||||
{ incomingCallBox }
|
{/* { incomingCallBox } */}
|
||||||
{ tooltip }
|
{ tooltip }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,10 @@ var CallHandler = require("../../../CallHandler");
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'IncomingCallBox',
|
displayName: 'IncomingCallBox',
|
||||||
|
|
||||||
|
propTypes: {
|
||||||
|
incomingCall: React.PropTypes.object,
|
||||||
|
},
|
||||||
|
|
||||||
onAnswerClick: function() {
|
onAnswerClick: function() {
|
||||||
dis.dispatch({
|
dis.dispatch({
|
||||||
action: 'answer',
|
action: 'answer',
|
||||||
|
@ -36,9 +40,13 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
var room = null;
|
||||||
|
if (this.props.incomingCall) {
|
||||||
|
room = MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId);
|
||||||
|
}
|
||||||
|
|
||||||
var room = this.props.incomingCall ? MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId) : null;
|
|
||||||
var caller = room ? room.name : "unknown";
|
var caller = room ? room.name : "unknown";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx_IncomingCallBox" id="incomingCallBox">
|
<div className="mx_IncomingCallBox" id="incomingCallBox">
|
||||||
<img className="mx_IncomingCallBox_chevron" src="img/chevron-left.png" width="9" height="16" />
|
<img className="mx_IncomingCallBox_chevron" src="img/chevron-left.png" width="9" height="16" />
|
||||||
|
|
Loading…
Reference in a new issue