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); }, this);
return ( return (
React.DOM.div({className: "tab-view-container"}, 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 tabs
) )
); );
@ -475,7 +477,12 @@ loop.panel = (function(_, mozL10n) {
}, },
_onStatusChanged: function() { _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(); this.updateServiceErrors();
}, },
@ -508,7 +515,7 @@ loop.panel = (function(_, mozL10n) {
React.DOM.div(null, React.DOM.div(null,
NotificationListView({notifications: this.props.notifications, NotificationListView({notifications: this.props.notifications,
clearOnDocumentHidden: true}), clearOnDocumentHidden: true}),
TabView({ref: "tabView"}, TabView({ref: "tabView", buttonsHidden: !this.state.userProfile},
Tab({name: "call"}, Tab({name: "call"},
React.DOM.div({className: "content-area"}, React.DOM.div({className: "content-area"},
CallUrlResult({client: this.props.client, CallUrlResult({client: this.props.client,

View File

@ -55,7 +55,9 @@ loop.panel = (function(_, mozL10n) {
}, this); }, this);
return ( return (
<div className="tab-view-container"> <div className="tab-view-container">
<ul className="tab-view">{tabButtons}</ul> {!this.props.buttonsHidden
? <ul className="tab-view">{tabButtons}</ul>
: null}
{tabs} {tabs}
</div> </div>
); );
@ -475,7 +477,12 @@ loop.panel = (function(_, mozL10n) {
}, },
_onStatusChanged: function() { _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(); this.updateServiceErrors();
}, },
@ -508,7 +515,7 @@ loop.panel = (function(_, mozL10n) {
<div> <div>
<NotificationListView notifications={this.props.notifications} <NotificationListView notifications={this.props.notifications}
clearOnDocumentHidden={true} /> clearOnDocumentHidden={true} />
<TabView ref="tabView"> <TabView ref="tabView" buttonsHidden={!this.state.userProfile}>
<Tab name="call"> <Tab name="call">
<div className="content-area"> <div className="content-area">
<CallUrlResult client={this.props.client} <CallUrlResult client={this.props.client}