Bug 1000240 - Add a Call Failed view for Loop standalone UI. r=Standard8
This commit is contained in:
@@ -11,10 +11,12 @@ var loop = loop || {};
|
||||
loop.conversation = (function(mozL10n) {
|
||||
"use strict";
|
||||
|
||||
var sharedViews = loop.shared.views,
|
||||
sharedModels = loop.shared.models;
|
||||
var sharedViews = loop.shared.views;
|
||||
var sharedMixins = loop.shared.mixins;
|
||||
var sharedModels = loop.shared.models;
|
||||
|
||||
var IncomingCallView = React.createClass({displayName: 'IncomingCallView',
|
||||
mixins: [sharedMixins.DropdownMenuMixin],
|
||||
|
||||
propTypes: {
|
||||
model: React.PropTypes.object.isRequired,
|
||||
@@ -23,25 +25,11 @@ loop.conversation = (function(mozL10n) {
|
||||
|
||||
getDefaultProps: function() {
|
||||
return {
|
||||
showDeclineMenu: false,
|
||||
showMenu: false,
|
||||
video: true
|
||||
};
|
||||
},
|
||||
|
||||
getInitialState: function() {
|
||||
return {showDeclineMenu: this.props.showDeclineMenu};
|
||||
},
|
||||
|
||||
componentDidMount: function() {
|
||||
window.addEventListener("click", this.clickHandler);
|
||||
window.addEventListener("blur", this._hideDeclineMenu);
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
window.removeEventListener("click", this.clickHandler);
|
||||
window.removeEventListener("blur", this._hideDeclineMenu);
|
||||
},
|
||||
|
||||
clickHandler: function(e) {
|
||||
var target = e.target;
|
||||
if (!target.classList.contains('btn-chevron')) {
|
||||
@@ -67,15 +55,6 @@ loop.conversation = (function(mozL10n) {
|
||||
return false;
|
||||
},
|
||||
|
||||
_toggleDeclineMenu: function() {
|
||||
var currentState = this.state.showDeclineMenu;
|
||||
this.setState({showDeclineMenu: !currentState});
|
||||
},
|
||||
|
||||
_hideDeclineMenu: function() {
|
||||
this.setState({showDeclineMenu: false});
|
||||
},
|
||||
|
||||
/*
|
||||
* Generate props for <AcceptCallButton> component based on
|
||||
* incoming call type. An incoming video call will render a video
|
||||
@@ -109,16 +88,13 @@ loop.conversation = (function(mozL10n) {
|
||||
|
||||
render: function() {
|
||||
/* jshint ignore:start */
|
||||
var btnClassAccept = "btn btn-accept";
|
||||
var btnClassDecline = "btn btn-error btn-decline";
|
||||
var conversationPanelClass = "incoming-call";
|
||||
var dropdownMenuClassesDecline = React.addons.classSet({
|
||||
"native-dropdown-menu": true,
|
||||
"conversation-window-dropdown": true,
|
||||
"visually-hidden": !this.state.showDeclineMenu
|
||||
"visually-hidden": !this.state.showMenu
|
||||
});
|
||||
return (
|
||||
React.DOM.div({className: conversationPanelClass},
|
||||
React.DOM.div({className: "incoming-call"},
|
||||
React.DOM.h2(null, mozL10n.get("incoming_call_title2")),
|
||||
React.DOM.div({className: "btn-group incoming-call-action-group"},
|
||||
|
||||
@@ -128,13 +104,11 @@ loop.conversation = (function(mozL10n) {
|
||||
React.DOM.div({className: "btn-group-chevron"},
|
||||
React.DOM.div({className: "btn-group"},
|
||||
|
||||
React.DOM.button({className: btnClassDecline,
|
||||
React.DOM.button({className: "btn btn-decline",
|
||||
onClick: this._handleDecline},
|
||||
mozL10n.get("incoming_call_cancel_button")
|
||||
),
|
||||
React.DOM.div({className: "btn-chevron",
|
||||
onClick: this._toggleDeclineMenu}
|
||||
)
|
||||
React.DOM.div({className: "btn-chevron", onClick: this.toggleDropdownMenu})
|
||||
),
|
||||
|
||||
React.DOM.ul({className: dropdownMenuClassesDecline},
|
||||
|
||||
Reference in New Issue
Block a user