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

Added free price details handling

refs https://github.com/TryGhost/Team/issues/637

Since we allow setting custom name and description for free price now, this wires up the values for free membership price settings to API
This commit is contained in:
Rishabh 2021-05-07 22:53:44 +05:30 committed by Rishabh Garg
parent b73fdf66d1
commit 9f154dbcd2
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,5 @@
import React from 'react';
import React, { useContext } from 'react';
import AppContext from '../../AppContext';
import {isCookiesDisabled, formatNumber, hasOnlyFreePlan} from '../../utils/helpers';
export const PlanSectionStyles = `
@ -345,6 +346,8 @@ function PriceLabel({currencySymbol, price}) {
}
function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) {
const {site} = useContext(AppContext);
const {free_price_name: freePriceName, free_price_description: freePriceDescription} = site;
return plans.map(({name, currency_symbol: currencySymbol, price, description, id}) => {
const isChecked = selectedPlan === id;
const classes = (isChecked ? 'gh-portal-plan-section checked' : 'gh-portal-plan-section');
@ -352,7 +355,8 @@ function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) {
let displayName = name;
switch (name) {
case 'Free':
planDetails.feature = 'Free preview';
displayName = freePriceName || name;
planDetails.feature = freePriceDescription || 'Free preview';
break;
default:
planDetails.feature = description || 'Full access';

View file

@ -110,6 +110,8 @@ export const site = {
prices: prices,
allow_self_signup: true,
members_signup_access: 'all',
free_price_name: 'Free',
free_price_description: 'Free Preview',
is_stripe_configured: true,
portal_button: true,
portal_name: true,