Bug 1121210: notify UITour when the active tab changes and don't show the get started info panel when the rooms tab is not selected. r=MattN

This commit is contained in:
Mike de Boer
2015-02-10 23:35:39 +01:00
parent 3322287d49
commit 9e2f60ee4b
7 changed files with 183 additions and 22 deletions

View File

@@ -25,7 +25,8 @@ loop.panel = (function(_, mozL10n) {
propTypes: {
buttonsHidden: React.PropTypes.array,
// The selectedTab prop is used by the UI showcase.
selectedTab: React.PropTypes.string
selectedTab: React.PropTypes.string,
mozLoop: React.PropTypes.object
},
getDefaultProps: function() {
@@ -34,6 +35,14 @@ loop.panel = (function(_, mozL10n) {
};
},
shouldComponentUpdate: function(nextProps, nextState) {
var tabChange = this.state.selectedTab !== nextState.selectedTab;
if (tabChange) {
this.props.mozLoop.notifyUITour("Loop:PanelTabChanged", nextState.selectedTab);
}
return tabChange;
},
getInitialState: function() {
// XXX Work around props.selectedTab being undefined initially.
// When we don't need to rely on the pref, this can move back to
@@ -799,7 +808,7 @@ loop.panel = (function(_, mozL10n) {
React.createElement(NotificationListView, {notifications: this.props.notifications,
clearOnDocumentHidden: true}),
React.createElement(TabView, {ref: "tabView", selectedTab: this.props.selectedTab,
buttonsHidden: hideButtons},
buttonsHidden: hideButtons, mozLoop: this.props.mozLoop},
React.createElement(Tab, {name: "rooms"},
React.createElement(RoomList, {dispatcher: this.props.dispatcher,
store: this.props.roomStore,