Skip to content

Commit

Permalink
Removing unused toggle/info logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
timmyc committed Mar 9, 2016
1 parent 0f294ba commit 4909647
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 80 deletions.
1 change: 0 additions & 1 deletion calypso

This file was deleted.

10 changes: 1 addition & 9 deletions client/my-sites/stats/all-time/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import classNames from 'classnames';
import observe from 'lib/mixins/data-observe';
import Card from 'components/card';
import User from 'lib/user';
import toggle from '../mixin-toggle';
import StatsTabs from '../stats-tabs';
import StatsTab from '../stats-tabs/tab';
import SectionHeader from 'components/section-header';
Expand All @@ -20,15 +19,14 @@ const user = User();
export default React.createClass( {
displayName: 'StatsAllTime',

mixins: [ toggle( 'allTimeList' ), observe( 'allTimeList' ) ],
mixins: [observe( 'allTimeList' ) ],

propTypes: {
allTimeList: PropTypes.object.isRequired
},

render() {
const allTimeList = this.props.allTimeList.response;
const { showInfo, showModule } = this.state;
const isLoading = this.props.allTimeList.isLoading();

let bestDay;
Expand All @@ -38,8 +36,6 @@ export default React.createClass( {
}

const classes = {
'is-expanded': showModule,
'is-showing-info': showInfo,
'is-loading': this.props.allTimeList.isLoading(),
'is-non-en': user.data.localeSlug && ( user.data.localeSlug !== 'en' )
};
Expand All @@ -51,10 +47,6 @@ export default React.createClass( {
<SectionHeader label={ this.translate( 'All-time posts, views, and visitors' ) }></SectionHeader>
<Card className={ classNames( 'stats-module', 'stats-all-time', classes ) }>
<div className="module-content">
<div className="module-content-text module-content-text-info">
<p>{ this.translate( 'These are your site\'s overall total number of Posts, Views and Visitors as well as the day when you had the most number of Views.' ) }</p>
</div>

<StatsTabs borderless>
<StatsTab
gridicon="posts"
Expand Down
12 changes: 2 additions & 10 deletions client/my-sites/stats/most-popular/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ var React = require( 'react' ),
*/
var Card = require( 'components/card' ),
observe = require( 'lib/mixins/data-observe' ),
toggle = require( 'my-sites/stats/mixin-toggle' ),
Gridicon = require( 'components/gridicon' ),
SectionHeader = require( 'components/section-header' );

module.exports = React.createClass( {
Expand All @@ -20,11 +18,10 @@ module.exports = React.createClass( {
insightsList: React.PropTypes.object.isRequired
},

mixins: [ observe( 'insightsList' ), toggle( 'mostPopular' ) ],
mixins: [ observe( 'insightsList' ) ],

render: function() {
var emptyMessage = null,
infoIcon = this.state.showInfo ? 'info' : 'info-outline',
data,
isLoading,
isEmpty,
Expand All @@ -39,8 +36,6 @@ module.exports = React.createClass( {
'stats-most-popular',
'is-site-overview',
{
'is-expanded': this.state.showModule,
'is-showing-info': this.state.showInfo,
'is-loading': isLoading,
'is-empty': isEmpty
}
Expand All @@ -63,11 +58,8 @@ module.exports = React.createClass( {
return (
<div>
<SectionHeader label={ this.translate( 'Most popular day and hour' ) }></SectionHeader>
<Card className={ classNames.apply( null, classes ) }>
<Card className={ classNames( classes ) }>
<div className="module-content">
<div className="module-content-text module-content-text-info">
<p>{ this.translate( 'This is the day and hour when you have been getting the most Views on average. The best timing for publishing a post may be around this period.' ) }</p>
</div>
<div className="stats-popular">
<div className="stats-popular__item">
<span className="stats-popular__label">{ this.translate( 'Most popular day' ) }</span>
Expand Down
2 changes: 1 addition & 1 deletion client/my-sites/stats/post-trends/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export default React.createClass( {
'is-loading': this.props.streakList.isLoading()
} );

if( touchDetect.hasTouch() ) {
if ( touchDetect.hasTouch() ) {
return null;
}

Expand Down
14 changes: 2 additions & 12 deletions client/my-sites/stats/stats-comments/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import Card from 'components/card';
import Gridicon from 'components/gridicon';
import CommentTab from './comment-tab';
import StatsErrorPanel from '../stats-error';
import StatsModuleHeader from '../stats-module/header';
import StatsModulePlaceholder from '../stats-module/placeholder';
import StatsModuleContent from '../stats-module/content-text';
import StatsModuleSelectDropdown from '../stats-module/select-dropdown';
Expand Down Expand Up @@ -109,8 +108,8 @@ export default React.createClass( {
},

render() {
const { activeFilter, showInfo, showModule } = this.state;
const { commentsList, followList, path, site } = this.props;
const { activeFilter } = this.state;
const { commentsList, followList } = this.props;
const hasError = commentsList.isError();
const noData = commentsList.isEmpty( 'authors' );
const data = this.data();
Expand All @@ -122,9 +121,7 @@ export default React.createClass( {
const classes = classNames(
'stats-module',
{
'is-expanded': true,
'is-loading': ! data,
'is-showing-info': this.state.showInfo,
'has-no-data': noData,
'is-showing-error': hasError || noData
}
Expand All @@ -135,13 +132,6 @@ export default React.createClass( {
<SectionHeader label={ this.translate( 'Comments' ) }></SectionHeader>
<Card className={ classes }>
<div className="module-content">
<StatsModuleContent className="module-content-text-info">
<p>{ this.translate( 'If you allow comments on your site, track your top commenters and discover what content sparks the liveliest conversations, based on the most recent 1,000 comments.' ) }</p>
<ul className="documentation">
<li><a href="http://en.support.wordpress.com/enable-disable-comments/" target="_blank"><Gridicon icon="help-outline" /> { this.translate( 'How do I turn on/off comments?' ) }</a></li>
<li><a href="http://en.support.wordpress.com/category/comments/" target="_blank"><Gridicon icon="folder" /> { this.translate( 'About Comments' ) }</a></li>
</ul>
</StatsModuleContent>

{ ( noData && ! hasError ) ? <StatsErrorPanel className="is-empty-message" message={ this.translate( 'No comments posted' ) } /> : null }

Expand Down
5 changes: 1 addition & 4 deletions client/my-sites/stats/stats-countries/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import toggle from '../mixin-toggle';
import Geochart from '../geochart';
import StatsList from '../stats-list';
import observe from 'lib/mixins/data-observe';
import skeleton from '../mixin-skeleton';
import DownloadCsv from '../stats-download-csv';
import DatePicker from '../stats-date-picker';
import ErrorPanel from '../stats-error';
Expand All @@ -26,7 +25,7 @@ import Button from 'components/button';
export default React.createClass( {
displayName: 'StatCountries',

mixins: [ toggle( 'Countries' ), skeleton( 'data' ), observe( 'dataList' ) ],
mixins: [ toggle( 'Countries' ), observe( 'dataList' ) ],

data( nextProps ) {
var props = nextProps || this.props;
Expand Down Expand Up @@ -65,10 +64,8 @@ export default React.createClass( {
'stats-module',
'is-countries',
{
'is-expanded': this.state.showModule,
summary: this.props.summary,
'is-loading': isLoading,
'is-showing-info': this.state.showInfo,
'has-no-data': noData,
'is-showing-error': hasError || noData
}
Expand Down
47 changes: 11 additions & 36 deletions client/my-sites/stats/stats-followers/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var toggle = require( '../mixin-toggle' ),
StatsList = require( '../stats-list' ),
observe = require( 'lib/mixins/data-observe' ),
ErrorPanel = require( '../stats-error' ),
skeleton = require( '../mixin-skeleton' ),
analytics = require( 'analytics' ),
Card = require( 'components/card' ),
Gridicon = require( 'components/gridicon' ),
Expand All @@ -25,7 +24,7 @@ var toggle = require( '../mixin-toggle' ),
module.exports = React.createClass( {
displayName: 'StatModuleFollowers',

mixins: [ toggle( 'Followers' ), skeleton( 'data' ), observe( 'wpcomFollowersList', 'emailFollowersList' ) ],
mixins: [ toggle( 'Followers' ), observe( 'wpcomFollowersList', 'emailFollowersList' ) ],

data: function( list ) {
if ( list && this.props[ list ] ) {
Expand All @@ -52,12 +51,12 @@ module.exports = React.createClass( {

if ( filter !== this.state.activeFilter ) {
switch ( filter ) {
case 'wpcom-followers':
gaEvent = 'Clicked By WordPress.com Followers Toggle';
break;
case 'email-followers':
gaEvent = 'Clicked Email Followers Toggle';
break;
case 'wpcom-followers':
gaEvent = 'Clicked By WordPress.com Followers Toggle';
break;
case 'email-followers':
gaEvent = 'Clicked Email Followers Toggle';
break;
}

if ( gaEvent ) {
Expand Down Expand Up @@ -91,20 +90,15 @@ module.exports = React.createClass( {
},

render: function() {
debug( 'Rendering stats followers module' );

var wpcomData = this.data( 'wpcomFollowersList' ),
emailData = this.data( 'emailFollowersList' ),
noData = this.props.wpcomFollowersList.isEmpty( 'subscribers' ) && this.props.emailFollowersList.isEmpty( 'subscribers' ),
hasError = ( this.props.wpcomFollowersList.isError() || this.props.emailFollowersList.isError() ),
infoIcon = this.state.showInfo ? 'info' : 'info-outline',
isLoading = this.props.wpcomFollowersList.isLoading() || this.props.emailFollowersList.isLoading(),
wpcomFollowers,
emailFollowers,
wpcomTotalFollowers,
emailTotalFollowers,
moduleHeaderTitle,
moduleToggle,
summaryPageLink,
viewSummary,
activeFilter,
Expand All @@ -123,9 +117,7 @@ module.exports = React.createClass( {
'is-followers',
activeFilterClass,
{
'is-expanded': this.state.showModule,
'is-loading': isLoading,
'is-showing-info': this.state.showInfo,
'has-no-data': noData,
'is-showing-error': hasError || noData
}
Expand All @@ -138,11 +130,11 @@ module.exports = React.createClass( {
}

if ( wpcomData && wpcomData.subscribers ) {
wpcomFollowers = <StatsList moduleName='wpcomFollowers' data={ wpcomData.subscribers } followList={ this.props.followList } />;
wpcomFollowers = <StatsList moduleName="wpcomFollowers" data={ wpcomData.subscribers } followList={ this.props.followList } />;
}

if ( emailData && emailData.subscribers ) {
emailFollowers = <StatsList moduleName='EmailFollowers' data={ emailData.subscribers } />;
emailFollowers = <StatsList moduleName="EmailFollowers" data={ emailData.subscribers } />;
}

if ( wpcomData && wpcomData.total ) {
Expand All @@ -153,19 +145,9 @@ module.exports = React.createClass( {
emailTotalFollowers = <p>{ this.translate( 'Total Email Followers' ) }: { this.numberFormat( emailData.total ) }</p>;
}

if ( ! this.props.summary ) {
moduleToggle = (
<li className="module-header-action toggle-services">
<a href="#" className="module-header-action-link" aria-label={ this.translate( 'Expand or collapse panel', { context: 'Stats panel action' } ) } title={ this.translate( 'Expand or collapse panel', { context: 'Stats panel action' } ) } onClick={ this.toggleModule }>
<Gridicon icon="chevron-down" />
</a>
</li>
);
}

if ( ( wpcomData && wpcomData.viewAll ) || ( emailData && emailData.viewAll ) ) {
viewSummary = (
<div key='view-all' className='module-expand'>
<div key="view-all" className="module-expand">
<a href={ summaryPageLink }>{ this.translate( 'View All', { context: 'Stats: Button label to expand a panel' } ) }<span className="right"></span></a>
</div>
);
Expand All @@ -179,14 +161,7 @@ module.exports = React.createClass( {
<Card className={ classNames.apply( null, classes ) }>
<div className="followers">
<div className="module-content">
<div className="module-content-text module-content-text-info">
<p>{ this.translate( 'Keep track of your overall number of followers, and how long each one has been following your site.' ) }</p>
<ul className="documentation">
<li><a href="http://en.support.wordpress.com/followers/" target="_blank"><Gridicon icon="folder" /> { this.translate( 'About Followers' ) }</a></li>
</ul>
</div>

{ noData && ! hasError ? <ErrorPanel className='is-empty-message' message={ this.translate( 'No followers' ) } /> : null }
{ noData && ! hasError ? <ErrorPanel className="is-empty-message" message={ this.translate( 'No followers' ) } /> : null }

{ this.filterSelect() }

Expand Down
3 changes: 1 addition & 2 deletions client/my-sites/stats/stats-insights/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import StatsModule from '../stats-module';
import statsStrings from '../stats-strings';
import MostPopular from 'my-sites/stats/most-popular';
import LatestPostSummary from '../post-performance';
import touchDetect from 'lib/touch-detect';

export default React.createClass( {
displayName: 'StatsInsights',
Expand Down Expand Up @@ -80,7 +79,7 @@ export default React.createClass( {
summaryData={ summaryData }
path={ '/stats/day' }
insights={ true }
/>
/>
<AllTime allTimeList={ allTimeList } />
<MostPopular insightsList={ insightsList } />
<div className="stats-nonperiodic has-recent">
Expand Down
6 changes: 1 addition & 5 deletions client/my-sites/stats/stats-module/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import classNames from 'classnames';
/**
* Internal dependencies
*/
import toggle from '../mixin-toggle';
import skeleton from '../mixin-skeleton';
import observe from 'lib/mixins/data-observe';
import ErrorPanel from '../stats-error';
import StatsList from '../stats-list';
Expand All @@ -25,7 +23,7 @@ import Button from 'components/button';
export default React.createClass( {
displayName: 'StatModule',

mixins: [ toggle(), skeleton( 'data' ), observe( 'dataList' ) ],
mixins: [ observe( 'dataList' ) ],

data() {
return this.props.dataList.response.data;
Expand Down Expand Up @@ -75,9 +73,7 @@ export default React.createClass( {
classes = classNames(
'stats-module',
{
'is-expanded': this.state.showModule,
'is-loading': isLoading,
'is-showing-info': this.state.showInfo,
'has-no-data': noData,
'is-showing-error': hasError || noData
}
Expand Down

0 comments on commit 4909647

Please sign in to comment.