mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Merged v1.17.2 into main
v1.17.2 # Conflicts: # package.json # src/components/common/PlansSection.js
This commit is contained in:
commit
34cb651202
1 changed files with 3 additions and 2 deletions
|
@ -299,15 +299,16 @@ function PriceLabel({currencySymbol, price, interval}) {
|
|||
function addDiscountToPlans(plans) {
|
||||
const filteredPlans = plans.filter(d => d.id !== 'free');
|
||||
const monthlyPlan = plans.find((d) => {
|
||||
return d.name === 'Monthly' && !d.description && d.interval === 'month';
|
||||
return d.name === 'Monthly' && d.interval === 'month';
|
||||
});
|
||||
const yearlyPlan = plans.find((d) => {
|
||||
return d.name === 'Yearly' && !d.description && d.interval === 'year';
|
||||
return d.name === 'Yearly' && d.interval === 'year';
|
||||
});
|
||||
|
||||
if (filteredPlans.length === 2 && monthlyPlan && yearlyPlan) {
|
||||
const discount = calculateDiscount(monthlyPlan.amount, yearlyPlan.amount);
|
||||
yearlyPlan.description = discount > 0 ? `${discount}% discount` : '';
|
||||
monthlyPlan.description = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue