Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

masterbar/stats-item: ES6ify some more, rename to stats #2036

Merged
merged 2 commits into from
Jan 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/layout/masterbar/logged-in.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from 'react';
*/
import Masterbar from './masterbar';
import Item from './item';
import StatsItem from './stats-item';
import Stats from './stats';
import Publish from './publish';
import Notifications from './notifications';
import Gravatar from 'components/gravatar';
Expand Down Expand Up @@ -61,7 +61,7 @@ export default React.createClass( {
render() {
return (
<Masterbar>
<StatsItem
<Stats
icon={ this.wordpressIcon() }
onClick={ this.clickMySites }
isActive={ this.isActive( 'sites' ) }
Expand All @@ -71,7 +71,7 @@ export default React.createClass( {
? this.translate( 'My Sites', { comment: 'Toolbar, must be shorter than ~12 chars' } )
: this.translate( 'My Site', { comment: 'Toolbar, must be shorter than ~12 chars' } )
}
</StatsItem>
</Stats>
<Item
url="/"
icon="reader"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ import Item from './item';
import siteStatsStickyTabStore from 'lib/site-stats-sticky-tab/store';

export default React.createClass( {
displayName: 'MasterbarStatsItem',
displayName: 'MasterbarStats',

propTypes: {
children: PropTypes.node
},

getInitialState: function() {
getInitialState() {
return {
url: siteStatsStickyTabStore.getUrl()
};
},

componentDidMount: function() {
componentDidMount() {
siteStatsStickyTabStore.on( 'change', this.handleStatsStickyTabChange );
},

componentWillUnmount: function() {
componentWillUnmount() {
siteStatsStickyTabStore.off( 'change', this.handleStatsStickyTabChange );
},

handleStatsStickyTabChange: function() {
handleStatsStickyTabChange() {
var url = siteStatsStickyTabStore.getUrl();

if ( url !== this.state.url ) {
Expand All @@ -40,7 +40,7 @@ export default React.createClass( {
}
},

render: function() {
render() {
return (
<Item { ...this.props } url={ this.state.url }>
{ this.props.children }
Expand Down