0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Fixed up the full width bar and other bugs with Paid Mix for new Dashboard

refs: https://github.com/TryGhost/Team/issues/1531
This commit is contained in:
James Morris 2022-05-12 14:57:33 +01:00
parent 47d6c17135
commit f564943aa9

View file

@ -388,7 +388,7 @@ export default class PaidMix extends Component {
// this is for tiers...
} else {
let tierPercentages = [];
if (!this.areTiersAllZero) {
let data = this.dashboardStats.paidMembersByTier.map(stat => stat.members);
let totalTiersAmount = 0;
@ -396,25 +396,15 @@ export default class PaidMix extends Component {
totalTiersAmount += data[i];
}
for (let i = 0; i < data.length; i++) {
let tierPercentage = Math.round(data[i] / totalTiersAmount * 100);
if (i === 0) {
tierPercentage = -tierPercentage;
}
tierPercentages.push(tierPercentage);
}
// sorting to ensure smallest to largest values in order always
tierPercentages.sort(function (a, b) {
return a - b;
});
let negativeTierPercentage = Math.round(data[0] / totalTiersAmount * 100);
ticksY = {
display: false,
min: tierPercentages[0],
max: tierPercentages[tierPercentages.length - 1] // get the last (biggest) in array
min: -negativeTierPercentage,
max: 100 - negativeTierPercentage // take the negative away from 100 to create a full width bar
};
}
}
return {
responsive: true,