mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 14:03:48 +03:00
Cleaned up attribution widget on analytics page
- updates attribution widget on analytics page to work same as dashboard with data
This commit is contained in:
parent
40c66dae6a
commit
5eae093b3c
@ -31,7 +31,6 @@
|
||||
<MemberAttribution::SourceAttributionTable
|
||||
@sources={{this.sources}}
|
||||
@sortColumn={{this.selectedSortColumn}}
|
||||
@setSortColumn={{this.setSortColumn}}
|
||||
class="gh-dashboard-attribution-list gh-dashboard-list"
|
||||
/>
|
||||
</div>
|
||||
@ -40,7 +39,6 @@
|
||||
<MemberAttribution::SourceAttributionChart
|
||||
@sources={{this.chartSources}}
|
||||
@sortColumn={{this.selectedSortColumn}}
|
||||
@setSortColumn={{this.setSortColumn}}
|
||||
/>
|
||||
</div>
|
||||
<div id="gh-dashboard-attribution-tooltip" class="gh-dashboard-tooltip">
|
||||
|
@ -4,8 +4,6 @@
|
||||
{{#if (eq @sortColumn "signups")}}
|
||||
<div
|
||||
class="gh-dashboard-list-title {{if (eq @sortColumn "signups") "sorted-by"}}"
|
||||
role="button" aria-label="Sort by free signups"
|
||||
{{on "click" (fn @setSortColumn "signups")}}
|
||||
>
|
||||
Free signups
|
||||
</div>
|
||||
@ -13,9 +11,7 @@
|
||||
{{#if (eq @sortColumn "paid")}}
|
||||
{{#if this.membersUtils.paidMembersEnabled}}
|
||||
<div
|
||||
role="button" aria-label="Sort by paid signups"
|
||||
class="gh-dashboard-list-title {{if (eq @sortColumn "paid") "sorted-by"}}"
|
||||
{{on "click" (fn @setSortColumn "paid")}}
|
||||
>
|
||||
<span class="hide-when-small">Paid </span>Conversions
|
||||
</div>
|
||||
|
@ -111,13 +111,14 @@
|
||||
<div class="gh-dashboard-select" style="top:40px;right:24px">
|
||||
<PowerSelect
|
||||
@selected={{this.selectedDisplayOption}}
|
||||
@options={{this.displayOptions}}
|
||||
@options={{this.allowedDisplayOptions}}
|
||||
@searchEnabled={{false}}
|
||||
@onChange={{this.onDisplayChange}}
|
||||
@triggerComponent={{component "gh-power-select/trigger"}}
|
||||
@triggerClass="gh-contentfilter-menu-trigger"
|
||||
@dropdownClass="gh-contentfilter-menu-dropdown is-narrow"
|
||||
@matchTriggerWidth={{false}}
|
||||
@disabled={{this.isDropdownDisabled}}
|
||||
@horizontalPosition="right"
|
||||
|
||||
as |option|
|
||||
@ -129,7 +130,6 @@
|
||||
<MemberAttribution::SourceAttributionTable
|
||||
@sources={{this.sources}}
|
||||
@sortColumn={{this.sortColumn}}
|
||||
@setSortColumn={{this.setSortColumn}}
|
||||
/>
|
||||
</div>
|
||||
<div class="gh-attribution-chart-column">
|
||||
@ -137,7 +137,6 @@
|
||||
<MemberAttribution::SourceAttributionChart
|
||||
@sources={{this.sources}}
|
||||
@sortColumn={{this.sortColumn}}
|
||||
@setSortColumn={{this.setSortColumn}}
|
||||
/>
|
||||
<div id="gh-dashboard-attribution-tooltip" class="gh-dashboard-tooltip">
|
||||
<div class="gh-dashboard-tooltip-value">
|
||||
|
@ -33,10 +33,57 @@ export default class Analytics extends Component {
|
||||
return this.args.post;
|
||||
}
|
||||
|
||||
get allowedDisplayOptions() {
|
||||
if (!this.hasPaidConversionData) {
|
||||
return this.displayOptions.filter(d => d.value === 'signups');
|
||||
}
|
||||
|
||||
if (!this.hasFreeSignups) {
|
||||
return this.displayOptions.filter(d => d.value === 'paid');
|
||||
}
|
||||
|
||||
return this.displayOptions;
|
||||
}
|
||||
|
||||
get isDropdownDisabled() {
|
||||
if (!this.hasPaidConversionData || !this.hasFreeSignups) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
get selectedDisplayOption() {
|
||||
if (!this.hasPaidConversionData) {
|
||||
return this.displayOptions.find(d => d.value === 'signups');
|
||||
}
|
||||
|
||||
if (!this.hasFreeSignups) {
|
||||
return this.displayOptions.find(d => d.value === 'paid');
|
||||
}
|
||||
|
||||
return this.displayOptions.find(d => d.value === this.sortColumn) ?? this.displayOptions[0];
|
||||
}
|
||||
|
||||
get selectedSortColumn() {
|
||||
if (!this.hasPaidConversionData) {
|
||||
return 'signups';
|
||||
}
|
||||
|
||||
if (!this.hasFreeSignups) {
|
||||
return 'paid';
|
||||
}
|
||||
return this.sortColumn;
|
||||
}
|
||||
|
||||
get hasPaidConversionData() {
|
||||
return this.sources.some(sourceData => sourceData.paidConversions > 0);
|
||||
}
|
||||
|
||||
get hasFreeSignups() {
|
||||
return this.sources.some(sourceData => sourceData.signups > 0);
|
||||
}
|
||||
|
||||
@action
|
||||
onDisplayChange(selected) {
|
||||
this.sortColumn = selected.value;
|
||||
|
Loading…
Reference in New Issue
Block a user