mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Basic improvements to the Paid Mix empty state
refs: https://github.com/TryGhost/Team/issues/1531 - still not ideal, but better than it was and now not showing as broken
This commit is contained in:
parent
d364116948
commit
8bf30b3a68
2 changed files with 16 additions and 12 deletions
|
@ -67,6 +67,10 @@ export default class PaidMix extends Component {
|
|||
return 'horizontalBar';
|
||||
}
|
||||
|
||||
get hasData() {
|
||||
return (this.dashboardStats.paidMembersByCadence.month + this.dashboardStats.paidMembersByCadence.year) > 0;
|
||||
}
|
||||
|
||||
get chartData() {
|
||||
const totalCadence = this.dashboardStats.paidMembersByCadence.month + this.dashboardStats.paidMembersByCadence.year;
|
||||
const monthlyPercentage = Math.round(this.dashboardStats.paidMembersByCadence.month / totalCadence * 100);
|
||||
|
@ -78,14 +82,9 @@ export default class PaidMix extends Component {
|
|||
return {
|
||||
labels: ['Cadence'],
|
||||
datasets: [{
|
||||
label: 'Monthly',
|
||||
data: [60],
|
||||
backgroundColor: '#8E42FF',
|
||||
barThickness
|
||||
}, {
|
||||
label: 'Annual',
|
||||
data: [40],
|
||||
backgroundColor: '#FB76B4',
|
||||
label: 'All',
|
||||
data: [100],
|
||||
backgroundColor: '#EBEEF0',
|
||||
barThickness
|
||||
}]
|
||||
};
|
||||
|
@ -182,9 +181,14 @@ export default class PaidMix extends Component {
|
|||
},
|
||||
callbacks: {
|
||||
label: (tooltipItems, data) => {
|
||||
const label = data.datasets[tooltipItems.datasetIndex].label || '';
|
||||
const value = data.datasets[tooltipItems.datasetIndex].data[tooltipItems.index] || 0;
|
||||
document.querySelector('#gh-dashboard5-mix-tooltip .gh-dashboard5-tooltip-value').innerHTML = `${label} ${value}%`;
|
||||
const tooltipTextEl = document.querySelector('#gh-dashboard5-mix-tooltip .gh-dashboard5-tooltip-value');
|
||||
if (this.isTotalMembersZero) {
|
||||
tooltipTextEl.innerHTML = "Currently has no data";
|
||||
} else {
|
||||
const label = data.datasets[tooltipItems.datasetIndex].label || '';
|
||||
const value = data.datasets[tooltipItems.datasetIndex].data[tooltipItems.index] || 0;
|
||||
tooltipTextEl.innerHTML = `${label} ${value}%`;
|
||||
}
|
||||
},
|
||||
title: () => {
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div class="gh-dashboard5-zero">
|
||||
<div class="gh-dashboard5-zero-message">
|
||||
<h4>Welcome to your Dashboard</h4>
|
||||
<p>You'll find member analytics here<br />once someone signs up.</p>
|
||||
<p>You'll find member analytics here once<br />someone signs up.</p>
|
||||
<p><LinkTo @route="members">Add or import members →</LinkTo></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue