diff --git a/client/my-sites/stats/stats-module/index.jsx b/client/my-sites/stats/stats-module/index.jsx index 851ee0bfa2d5b..55cd448c7011b 100644 --- a/client/my-sites/stats/stats-module/index.jsx +++ b/client/my-sites/stats/stats-module/index.jsx @@ -44,14 +44,18 @@ export default React.createClass( { }, viewAllHandler( event ) { - var summaryPageLink = '/stats/' + this.props.period.period + '/' + this.props.path + '/' + this.props.site.slug + '?startDate=' + this.props.date; + var summaryPageLink; - event.preventDefault(); + if ( this.props.period && this.props.path && this.props.site ) { + summaryPageLink = '/stats/' + this.props.period.period + '/' + this.props.path + '/' + this.props.site.slug + '?startDate=' + this.props.date; - if ( this.props.beforeNavigate ) { - this.props.beforeNavigate(); + event.preventDefault(); + + if ( this.props.beforeNavigate ) { + this.props.beforeNavigate(); + } + page( summaryPageLink ); } - page( summaryPageLink ); }, getModuleLabel() { @@ -62,6 +66,19 @@ export default React.createClass( { return ( ); }, + renderViewAllButton() { + // Some modules do not have view all abilities + if ( ! this.props.summary && this.props.period ) { + return ( + + ); + } + + return null; + }, + render() { var data = this.data(), noData = this.props.dataList.isEmpty(), @@ -86,13 +103,7 @@ export default React.createClass( { { ! this.props.summary - ? ( ) + ? this.renderViewAllButton() : ( ) }