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-11 10:07:22 +01:00
parent e3756dc109
commit 6f042fe751
8 changed files with 185 additions and 23 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,