From 890279a95b19b69e6a95bdb9c133933fa5bce80a Mon Sep 17 00:00:00 2001 From: Rishabh Date: Tue, 13 Sep 2022 14:08:14 +0530 Subject: [PATCH] Added mock UI table for member source data refs https://github.com/TryGhost/Team/issues/1891 - uses mock stats data to show UI for which sources are driving member signups/conversions --- .../dashboard/charts/attribution.hbs | 42 +++++++++++++++++++ .../dashboard/charts/attribution.js | 25 +++++++++++ ghost/admin/app/templates/dashboard.hbs | 4 +- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 ghost/admin/app/components/dashboard/charts/attribution.hbs create mode 100644 ghost/admin/app/components/dashboard/charts/attribution.js diff --git a/ghost/admin/app/components/dashboard/charts/attribution.hbs b/ghost/admin/app/components/dashboard/charts/attribution.hbs new file mode 100644 index 0000000000..337a7c126d --- /dev/null +++ b/ghost/admin/app/components/dashboard/charts/attribution.hbs @@ -0,0 +1,42 @@ +
+
+
+
+
Sources
+
Free Signups
+
Paid Conversions
+
+
+ {{#each this.sources as |sourceData|}} +
+
+ {{sourceData.source}} +
+
+ + {{#if sourceData.freeSignups}} + {{format-number sourceData.freeSignups}} + {{else}} + — + {{/if}} + +
+
+ + {{#if sourceData.paidConversions}} + {{format-number sourceData.paidConversions}} + {{else}} + — + {{/if}} + +
+
+ {{else}} +
+

No sources.

+
+ {{/each}} +
+
+
+
diff --git a/ghost/admin/app/components/dashboard/charts/attribution.js b/ghost/admin/app/components/dashboard/charts/attribution.js new file mode 100644 index 0000000000..4c314b41ba --- /dev/null +++ b/ghost/admin/app/components/dashboard/charts/attribution.js @@ -0,0 +1,25 @@ +import Component from '@glimmer/component'; +import {action} from '@ember/object'; +import {inject as service} from '@ember/service'; +// import {tracked} from '@glimmer/tracking'; + +export default class Recents extends Component { + @service dashboardStats; + + @action + loadData() { + this.dashboardStats.loadMemberAttributionStats(); + } + + get sources() { + return this.dashboardStats?.membersAttributionSources90d || []; + } + + get areMembersEnabled() { + return this.dashboardStats.siteStatus?.membersEnabled; + } + + get areNewslettersEnabled() { + return this.dashboardStats.siteStatus?.newslettersEnabled; + } +} diff --git a/ghost/admin/app/templates/dashboard.hbs b/ghost/admin/app/templates/dashboard.hbs index cef5e121cd..a78dce241c 100644 --- a/ghost/admin/app/templates/dashboard.hbs +++ b/ghost/admin/app/templates/dashboard.hbs @@ -18,7 +18,9 @@
- + {{#if (feature 'sourceAttribution')}} + + {{/if}} {{#if this.areNewslettersEnabled}} {{/if}}