Bug 1077332: hide tabs when not logged in with FxA. r=paolo

This commit is contained in:
Mike de Boer 2014-10-03 18:49:15 +02:00
parent 0ae54b5649
commit 525397604c
2 changed files with 20 additions and 6 deletions

View File

@ -55,7 +55,9 @@ loop.panel = (function(_, mozL10n) {
}, this);
return (
React.DOM.div({className: "tab-view-container"},
React.DOM.ul({className: "tab-view"}, tabButtons),
!this.props.buttonsHidden
? React.DOM.ul({className: "tab-view"}, tabButtons)
: null,
tabs
)
);
@ -479,7 +481,12 @@ loop.panel = (function(_, mozL10n) {
},
_onStatusChanged: function() {
this.setState({userProfile: navigator.mozLoop.userProfile});
var profile = navigator.mozLoop.userProfile;
if (profile != this.state.userProfile) {
// On profile change (login, logout), switch back to the default tab.
this.selectTab("call");
}
this.setState({userProfile: profile});
this.updateServiceErrors();
},
@ -512,7 +519,7 @@ loop.panel = (function(_, mozL10n) {
React.DOM.div(null,
NotificationListView({notifications: this.props.notifications,
clearOnDocumentHidden: true}),
TabView({ref: "tabView"},
TabView({ref: "tabView", buttonsHidden: !this.state.userProfile},
Tab({name: "call"},
React.DOM.div({className: "content-area"},
CallUrlResult({client: this.props.client,

View File

@ -55,7 +55,9 @@ loop.panel = (function(_, mozL10n) {
}, this);
return (
<div className="tab-view-container">
<ul className="tab-view">{tabButtons}</ul>
{!this.props.buttonsHidden
? <ul className="tab-view">{tabButtons}</ul>
: null}
{tabs}
</div>
);
@ -479,7 +481,12 @@ loop.panel = (function(_, mozL10n) {
},
_onStatusChanged: function() {
this.setState({userProfile: navigator.mozLoop.userProfile});
var profile = navigator.mozLoop.userProfile;
if (profile != this.state.userProfile) {
// On profile change (login, logout), switch back to the default tab.
this.selectTab("call");
}
this.setState({userProfile: profile});
this.updateServiceErrors();
},
@ -512,7 +519,7 @@ loop.panel = (function(_, mozL10n) {
<div>
<NotificationListView notifications={this.props.notifications}
clearOnDocumentHidden={true} />
<TabView ref="tabView">
<TabView ref="tabView" buttonsHidden={!this.state.userProfile}>
<Tab name="call">
<div className="content-area">
<CallUrlResult client={this.props.client}