0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

fix(console): fix app creation modal footer

This commit is contained in:
Darcy Ye 2024-10-22 00:20:34 +08:00
parent 3022d2eba1
commit 1488665499
No known key found for this signature in database
GPG key ID: B46F4C07EDEFC610

View file

@ -42,83 +42,83 @@ function Footer({ selectedType, isLoading, onClickCreate, isThirdParty }: Props)
} = useUserPreferences(); } = useUserPreferences();
if (selectedType) { if (selectedType) {
if ( if (selectedType === ApplicationType.MachineToMachine) {
selectedType === ApplicationType.MachineToMachine && if (hasMachineToMachineAppsReachedLimit) {
hasMachineToMachineAppsReachedLimit && if (
// Just in case the enterprise plan has reached the resource limit, we still need to show charge notice. // Just in case the enterprise plan has reached the resource limit, we still need to show charge notice.
isPaidPlan(planId, isEnterprisePlan) && isPaidPlan(planId, isEnterprisePlan) &&
!m2mUpsellNoticeAcknowledged !m2mUpsellNoticeAcknowledged
) { ) {
return ( return (
<AddOnNoticeFooter <AddOnNoticeFooter
isLoading={isLoading} isLoading={isLoading}
buttonTitle="applications.create" buttonTitle="applications.create"
onClick={() => { onClick={() => {
void update({ m2mUpsellNoticeAcknowledged: true }); void update({ m2mUpsellNoticeAcknowledged: true });
onClickCreate(); onClickCreate();
}} }}
> >
<Trans <Trans
components={{ components={{
span: <span className={styles.strong} />, span: <span className={styles.strong} />,
a: <TextLink to={addOnPricingExplanationLink} />, a: <TextLink to={addOnPricingExplanationLink} />,
}} }}
> >
{t('add_on.footer.machine_to_machine_app', { {t('add_on.footer.machine_to_machine_app', {
price: machineToMachineAddOnUnitPrice, price: machineToMachineAddOnUnitPrice,
})} })}
</Trans> </Trans>
</AddOnNoticeFooter> </AddOnNoticeFooter>
); );
} }
if ( // For paid plan (pro plan), we don't guard the m2m app creation since it's an add-on feature.
selectedType === ApplicationType.MachineToMachine && if (currentSku.id === ReservedPlanId.Free) {
hasMachineToMachineAppsReachedLimit && return (
// For paid plan (pro plan), we don't guard the m2m app creation since it's an add-on feature. <QuotaGuardFooter>
currentSku.id === ReservedPlanId.Free <Trans
) { components={{
return ( a: <ContactUsPhraseLink />,
<QuotaGuardFooter> }}
<Trans >
components={{ {t('paywall.machine_to_machine_feature')}
a: <ContactUsPhraseLink />, </Trans>
}} </QuotaGuardFooter>
> );
{t('paywall.machine_to_machine_feature')} }
</Trans> }
</QuotaGuardFooter> } else {
); // Third party app is only available for paid plan (pro plan).
} if (isThirdParty && hasThirdPartyAppsReachedLimit) {
return (
<QuotaGuardFooter>
<Trans
components={{
a: <ContactUsPhraseLink />,
}}
>
{t('paywall.third_party_apps')}
</Trans>
</QuotaGuardFooter>
);
}
// Third party app is only available for paid plan (pro plan). if (hasAppsReachedLimit) {
if (isThirdParty && hasThirdPartyAppsReachedLimit) { return (
return ( <QuotaGuardFooter>
<QuotaGuardFooter> <Trans
<Trans components={{
components={{ a: <ContactUsPhraseLink />,
a: <ContactUsPhraseLink />, planName: <SkuName skuId={planId} isEnterprisePlan={isEnterprisePlan} />,
}} }}
> >
{t('paywall.third_party_apps')} {t('paywall.applications', {
</Trans> count: currentSubscriptionQuota.applicationsLimit ?? 0,
</QuotaGuardFooter> })}
); </Trans>
} </QuotaGuardFooter>
);
if (hasAppsReachedLimit) { }
return (
<QuotaGuardFooter>
<Trans
components={{
a: <ContactUsPhraseLink />,
planName: <SkuName skuId={planId} isEnterprisePlan={isEnterprisePlan} />,
}}
>
{t('paywall.applications', { count: currentSubscriptionQuota.applicationsLimit ?? 0 })}
</Trans>
</QuotaGuardFooter>
);
} }
} }