0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-30 20:33:54 -05:00

fix(console): fix the subscription plan display in tenant dropdown (#6393)

This commit is contained in:
Darcy Ye 2024-08-04 17:42:40 +08:00 committed by GitHub
parent 2a6e6f2f75
commit 902e620e84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,5 @@
import { TenantTag } from '@logto/schemas';
import { conditional } from '@silverhand/essentials';
import classNames from 'classnames';
import { useContext, useMemo } from 'react';
@ -6,6 +7,7 @@ import Tick from '@/assets/icons/tick.svg?react';
import { type TenantResponse } from '@/cloud/types/router';
import PlanName from '@/components/PlanName';
import TenantEnvTag from '@/components/TenantEnvTag';
import { isDevFeaturesEnabled } from '@/consts/env';
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
import { DropdownItem } from '@/ds-components/Dropdown';
import DynamicT from '@/ds-components/DynamicT';
@ -27,8 +29,8 @@ function TenantDropdownItem({ tenantData, isSelected, onClick }: Props) {
} = tenantData;
const {
currentPlan,
subscriptionPlans,
currentSku,
currentSubscriptionUsage: usage,
currentSubscriptionQuota: quota,
} = useContext(SubscriptionDataContext);
@ -58,7 +60,7 @@ function TenantDropdownItem({ tenantData, isSelected, onClick }: Props) {
{tag === TenantTag.Development ? (
<DynamicT forKey="subscription.no_subscription" />
) : (
<PlanName skuId={currentSku.id} name={tenantSubscriptionPlan.name} />
<PlanName skuId={conditional(isDevFeaturesEnabled && planId)} name={currentPlan.name} />
)}
</div>
</div>