diff --git a/ghost/admin/app/components/dashboard/charts/attribution.hbs b/ghost/admin/app/components/dashboard/charts/attribution.hbs index 12f06eddf4..710920ae4d 100644 --- a/ghost/admin/app/components/dashboard/charts/attribution.hbs +++ b/ghost/admin/app/components/dashboard/charts/attribution.hbs @@ -1,11 +1,13 @@
- {{!--

Top sources

-
- {{svg-jar "members-outline"}} -

No new members in the past 7 days

-

Once someone signs up, you’ll be able to see where they came from here.

-
--}} + {{#if (is-empty this.sources)}} +

Top sources

+
+ {{svg-jar "members-outline"}} +

No new members in the past {{this.chartPeriod}} days

+

Once someone signs up, you’ll be able to see where they came from here.

+
+ {{else}}
{{#if option.name}}{{option.name}}{{else}}Unknown option{{/if}} @@ -48,5 +50,6 @@
+ {{/if}}
diff --git a/ghost/admin/app/components/dashboard/charts/attribution.js b/ghost/admin/app/components/dashboard/charts/attribution.js index 4ac5caa95e..aea1e5b23d 100644 --- a/ghost/admin/app/components/dashboard/charts/attribution.js +++ b/ghost/admin/app/components/dashboard/charts/attribution.js @@ -39,6 +39,15 @@ export default class Recents extends Component { return this.dashboardStats?.memberSourceAttributionCounts || []; } + // chartDays value for more than 7 days has an extra day to show all ticks + get chartPeriod() { + if (this.dashboardStats.chartDays > 7) { + return this.dashboardStats.chartDays - 1; + } + + return this.dashboardStats.chartDays; + } + get chartSources() { const counts = this.dashboardStats?.memberSourceAttributionCounts || []; // filter null source from the list