mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Added tier name on account home page
As a site can have multiple tiers, instead of just showing "Plan" on account home, this change shows name of the tier member is on.
This commit is contained in:
parent
fa64b00927
commit
cc994a0ef1
2 changed files with 14 additions and 5 deletions
|
@ -3,7 +3,7 @@ import MemberAvatar from '../common/MemberGravatar';
|
|||
import ActionButton from '../common/ActionButton';
|
||||
import CloseButton from '../common/CloseButton';
|
||||
import Switch from '../common/Switch';
|
||||
import {getMemberSubscription, getUpdatedOfferPrice, hasOnlyFreePlan, isComplimentaryMember} from '../../utils/helpers';
|
||||
import {getMemberSubscription, getMemberTierName, getUpdatedOfferPrice, hasMultipleProductsFeature, hasOnlyFreePlan, isComplimentaryMember} from '../../utils/helpers';
|
||||
import {getDateString} from '../../utils/date-time';
|
||||
import {ReactComponent as LoaderIcon} from '../../images/icons/loader.svg';
|
||||
import {ReactComponent as OfferTagIcon} from '../../images/icons/offer-tag.svg';
|
||||
|
@ -281,14 +281,17 @@ const PaidAccountActions = () => {
|
|||
price,
|
||||
default_payment_card_last4: defaultCardLast4
|
||||
} = subscription || {};
|
||||
let planLabel = 'Plan';
|
||||
|
||||
// Show name of tiers if there are multiple tiers
|
||||
if (hasMultipleProductsFeature({site}) && getMemberTierName({member})) {
|
||||
planLabel = getMemberTierName({member});
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<section>
|
||||
<div className='gh-portal-list-detail'>
|
||||
{/* Shows the name of the tier if there are multiple tiers */}
|
||||
{/* <h3>Bronze</h3> */}
|
||||
{/* Shows "Plan" if there are no multiple tiers */}
|
||||
<h3>Plan</h3>
|
||||
<h3>{planLabel}</h3>
|
||||
<PlanLabel price={price} isComplimentary={isComplimentary} subscription={subscription} />
|
||||
</div>
|
||||
<PlanUpdateButton isComplimentary={isComplimentary} />
|
||||
|
|
|
@ -119,6 +119,12 @@ export function getSubscriptionFromId({member, subscriptionId}) {
|
|||
return null;
|
||||
}
|
||||
|
||||
export function getMemberTierName({member}) {
|
||||
const subscription = getMemberSubscription({member});
|
||||
|
||||
return subscription?.tier?.name || '';
|
||||
}
|
||||
|
||||
export function hasOnlyFreePlan({plans, site = {}}) {
|
||||
plans = plans || getSitePrices({site});
|
||||
return !plans || plans.length === 0 || (plans.length === 1 && plans[0].type === 'free');
|
||||
|
|
Loading…
Add table
Reference in a new issue