-
-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(console): add add-on display issues and refactor component PlanNa…
…me (#6471)
- Loading branch information
Showing
32 changed files
with
145 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { type TFuncKey } from 'i18next'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import { ReservedSkuId } from '@/types/subscriptions'; | ||
|
||
const registeredSkuIdNamePhraseMap: Record< | ||
string, | ||
TFuncKey<'translation', 'admin_console.subscription'> | undefined | ||
> = { | ||
quotaKey: undefined, | ||
[ReservedSkuId.Free]: 'free_plan', | ||
[ReservedSkuId.Pro]: 'pro_plan', | ||
[ReservedSkuId.Enterprise]: 'enterprise', | ||
}; | ||
|
||
type Props = { | ||
readonly skuId: string; | ||
}; | ||
|
||
function SkuName({ skuId }: Props) { | ||
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console.subscription' }); | ||
const skuNamePhrase = registeredSkuIdNamePhraseMap[skuId]; | ||
|
||
/** | ||
* Note: fallback to the plan name if the phrase is not registered. | ||
*/ | ||
const skuName = skuNamePhrase ? String(t(skuNamePhrase)) : skuId; | ||
|
||
return <span>{skuName}</span>; | ||
} | ||
|
||
export default SkuName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.