mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Fixed layout for prices with custom description
One of the early betas for multiple products allowed adding custom description for prices, which Portal had an extra check for when rendering. The price description is not a valid scenario anymore, and this change allows Portal to ignore description of prices so it shows consistent layout for single tier scenario.
This commit is contained in:
parent
2403ee4d36
commit
920019da47
1 changed files with 5 additions and 4 deletions
|
@ -483,15 +483,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 = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -647,10 +648,10 @@ function getPlanClassNames({changePlan, cookiesDisabled, plans = [], selectedPla
|
|||
|
||||
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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue