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

This commit is contained in:
Mike de Boer 2014-10-06 16:35:45 +02:00
parent c4732bc1aa
commit db64275e82
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
)
);
@ -475,7 +477,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();
},
@ -508,7 +515,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>
);
@ -475,7 +477,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();
},
@ -508,7 +515,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}