0
Fork 0
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:
Rishabh 2022-03-25 00:06:17 +05:30
commit 34cb651202

View file

@ -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 = '';
}
}