File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
client/my-sites/stats/features/modules/stats-authors Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
12
12
isRequestingSiteStatsForQuery ,
13
13
getSiteStatsNormalizedData ,
14
14
} from 'calypso/state/stats/lists/selectors' ;
15
+ import { getModuleToggles } from 'calypso/state/stats/module-toggles/selectors' ;
15
16
import { getSelectedSiteId } from 'calypso/state/ui/selectors' ;
16
17
import EmptyModuleCard from '../../../components/empty-module-card/empty-module-card' ;
17
18
import { SUPPORT_URL , JETPACK_SUPPORT_URL_TRAFFIC } from '../../../const' ;
@@ -45,6 +46,14 @@ const StatAuthors: React.FC< StatsDefaultModuleProps > = ( {
45
46
getSiteStatsNormalizedData ( state , siteId , statType , query )
46
47
) as [ id : number , label : string ] ;
47
48
49
+ // toggle the module if it's going to show just a single author
50
+ const isSingleAuthor = data ?. length === 1 ;
51
+
52
+ useSelector ( ( state ) => {
53
+ const pageModuleToggles = getModuleToggles ( state , siteId , [ 'traffic' ] ) ;
54
+ pageModuleToggles . authors = ! isSingleAuthor ;
55
+ } ) ;
56
+
48
57
return (
49
58
< >
50
59
{ ! shouldGateStatsModule && siteId && statType && (
You can’t perform that action at this time.
0 commit comments