mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
refactor(console): use plan id to index plan descriptions (#4236)
This commit is contained in:
parent
a935f37d53
commit
64b7aed4bd
3 changed files with 10 additions and 10 deletions
|
@ -78,7 +78,7 @@ function PlanCardItem({ plan, onSelect }: Props) {
|
|||
</div>
|
||||
</div>
|
||||
<div className={styles.description}>
|
||||
<PlanDescription planName={planName} />
|
||||
<PlanDescription planId={planId} />
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import { type TFuncKey } from 'i18next';
|
||||
|
||||
import { ReservedPlanId } from '@/consts/subscriptions';
|
||||
import DynamicT from '@/ds-components/DynamicT';
|
||||
import { ReservedPlanName } from '@/types/subscriptions';
|
||||
|
||||
const registeredPlanDescriptionPhrasesMap: Record<
|
||||
string,
|
||||
TFuncKey<'translation', 'admin_console.subscription'> | undefined
|
||||
> = {
|
||||
[ReservedPlanName.Free]: 'free_plan_description',
|
||||
[ReservedPlanName.Hobby]: 'hobby_plan_description',
|
||||
[ReservedPlanName.Pro]: 'pro_plan_description',
|
||||
[ReservedPlanId.free]: 'free_plan_description',
|
||||
[ReservedPlanId.hobby]: 'hobby_plan_description',
|
||||
[ReservedPlanId.pro]: 'pro_plan_description',
|
||||
};
|
||||
|
||||
type Props = { planName: string };
|
||||
type Props = { planId: string };
|
||||
|
||||
function PlanDescription({ planName }: Props) {
|
||||
const description = registeredPlanDescriptionPhrasesMap[planName];
|
||||
function PlanDescription({ planId }: Props) {
|
||||
const description = registeredPlanDescriptionPhrasesMap[planId];
|
||||
|
||||
if (!description) {
|
||||
return null;
|
||||
|
|
|
@ -18,7 +18,7 @@ type Props = {
|
|||
};
|
||||
|
||||
function CurrentPlan({ subscription, subscriptionPlan, subscriptionUsage }: Props) {
|
||||
const { name } = subscriptionPlan;
|
||||
const { id, name } = subscriptionPlan;
|
||||
|
||||
return (
|
||||
<FormCard title="subscription.current_plan" description="subscription.current_plan_description">
|
||||
|
@ -27,7 +27,7 @@ function CurrentPlan({ subscription, subscriptionPlan, subscriptionUsage }: Prop
|
|||
<PlanName name={name} />
|
||||
</div>
|
||||
<div className={styles.description}>
|
||||
<PlanDescription planName={name} />
|
||||
<PlanDescription planId={id} />
|
||||
</div>
|
||||
</div>
|
||||
<FormField title="subscription.plan_usage">
|
||||
|
|
Loading…
Add table
Reference in a new issue