Skip to content

Commit 75942c7

Browse files
authored
refactor: update create tenant modal tenant type card content (#7927)
* refactor: update create tenant modal tenant type card content * refactor: add key/translation for other languages
1 parent 228c706 commit 75942c7

File tree

19 files changed

+64
-27
lines changed

19 files changed

+64
-27
lines changed

packages/console/src/components/CreateTenantModal/EnvTagOptionContent/index.tsx

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,55 @@ import styles from './index.module.scss';
1212
type Props = {
1313
readonly tag: TenantTag;
1414
/**
15-
* Whether to hide the available production plan information.
15+
* Although this parameter is named `isPrivateRegion`, considering our business requirements,
16+
* it will also determine whether to hide the available production plan information.
1617
* Set to true when the available production plans should not be displayed,
1718
* for example, in contexts where this information is not relevant or should be hidden from the user.
1819
*/
19-
readonly isAvailableProductionPlanInvisible: boolean;
20+
readonly isPrivateRegion: boolean;
2021
};
2122

22-
const descriptionMap: Record<TenantTag, AdminConsoleKey> = {
23-
[TenantTag.Development]: 'tenants.create_modal.development_description',
24-
[TenantTag.Production]: 'tenants.create_modal.production_description',
23+
const getAdminConsoleKeyBy = (tenantTag: TenantTag, isPrivateRegion = false): AdminConsoleKey => {
24+
if (tenantTag === TenantTag.Production) {
25+
return 'tenants.create_modal.production_description';
26+
}
27+
if (isPrivateRegion) {
28+
return 'tenants.create_modal.development_description_for_private_regions';
29+
}
30+
return 'tenants.create_modal.development_description';
2531
};
2632

2733
const availableProductionPlanNames = [ReservedPlanName.Free, ReservedPlanName.Pro];
2834

29-
function EnvTagOptionContent({ tag, isAvailableProductionPlanInvisible = false }: Props) {
35+
function EnvTagOptionContent({ tag, isPrivateRegion = false }: Props) {
36+
const shouldShowHint = tag === TenantTag.Development || !isPrivateRegion;
37+
3038
return (
3139
<div className={styles.container}>
3240
<TenantEnvTag isAbbreviated={false} tag={tag} size="large" className={styles.tag} />
3341
<div className={styles.description}>
34-
<DynamicT forKey={descriptionMap[tag]} />
35-
</div>
36-
{(tag === TenantTag.Development || !isAvailableProductionPlanInvisible) && <Divider />}
37-
<div className={styles.hint}>
38-
{tag === TenantTag.Development && (
39-
<DynamicT forKey="tenants.create_modal.development_hint" />
40-
)}
41-
{tag === TenantTag.Production && !isAvailableProductionPlanInvisible && (
42-
<>
43-
<DynamicT forKey="tenants.create_modal.available_plan" />
44-
{availableProductionPlanNames.map((planName) => (
45-
<Tag key={planName} variant="cell" size="small" className={styles.planNameTag}>
46-
{planName}
47-
</Tag>
48-
))}
49-
</>
50-
)}
42+
<DynamicT forKey={getAdminConsoleKeyBy(tag, isPrivateRegion)} />
5143
</div>
44+
{shouldShowHint && (
45+
<>
46+
<Divider />
47+
<div className={styles.hint}>
48+
{tag === TenantTag.Development && (
49+
<DynamicT forKey="tenants.create_modal.development_hint" />
50+
)}
51+
{tag === TenantTag.Production && (
52+
<>
53+
<DynamicT forKey="tenants.create_modal.available_plan" />
54+
{availableProductionPlanNames.map((planName) => (
55+
<Tag key={planName} variant="cell" size="small" className={styles.planNameTag}>
56+
{planName}
57+
</Tag>
58+
))}
59+
</>
60+
)}
61+
</div>
62+
</>
63+
)}
5264
</div>
5365
);
5466
}

packages/console/src/components/CreateTenantModal/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,7 @@ function CreateTenantModal({ isOpen, onClose }: Props) {
298298
{currentRegion.tags.map((tag) => (
299299
<Radio key={tag} value={tag}>
300300
{/* If the region is private (for enterprise customers), we hide the available production plan. */}
301-
<EnvTagOptionContent
302-
tag={tag}
303-
isAvailableProductionPlanInvisible={currentRegion.isPrivate}
304-
/>
301+
<EnvTagOptionContent tag={tag} isPrivateRegion={currentRegion.isPrivate} />
305302
</Radio>
306303
))}
307304
</RadioGroup>

packages/phrases/src/locales/ar/translation/admin-console/tenants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const tenants = {
4949
subtitle: 'إنشاء مستأجر جديد يحتوي على موارد ومستخدمين معزولين.',
5050
tenant_usage_purpose: 'ماذا تريد استخدام هذا المستأجر ل؟',
5151
development_description: 'للاختبار فقط ويجب ألا يستخدم في الإنتاج. لا يلزم اشتراك.',
52+
development_description_for_private_regions: 'للاختبار فقط ويجب ألا يستخدم في الإنتاج.',
5253
development_hint: 'لديه جميع الميزات المهنية ولكن لديه قيود مثل لافتة تسجيل الدخول.',
5354
production_description: 'للاستخدام من قبل المستخدمين النهائيين وقد يتطلب اشتراكًا مدفوعًا.',
5455
available_plan: 'الخطة المتاحة:',

packages/phrases/src/locales/de/translation/admin-console/tenants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const tenants = {
5353
tenant_usage_purpose: 'Wofür möchten Sie diesen Mieter verwenden?',
5454
development_description:
5555
'Nur für Tests und sollte nicht in der Produktion verwendet werden. Es ist kein Abonnement erforderlich.',
56+
development_description_for_private_regions:
57+
'Nur für Tests und sollte nicht in der Produktion verwendet werden.',
5658
development_hint:
5759
'Es verfügt über alle Pro-Funktionen, hat jedoch Einschränkungen wie ein Anmeldebanner.',
5860
production_description:

packages/phrases/src/locales/en/translation/admin-console/tenants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const tenants = {
5353
tenant_usage_purpose: 'What do you want to use this tenant for?',
5454
development_description:
5555
"For testing only and shouldn't be used in production. No subscription is required.",
56+
development_description_for_private_regions:
57+
"For testing only and shouldn't be used in production.",
5658
development_hint: 'It has all the pro features but has limitations like a sign-in banner.',
5759
production_description: 'For use by end-users and may require a paid subscription.',
5860
available_plan: 'Available plan:',

packages/phrases/src/locales/es/translation/admin-console/tenants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const tenants = {
5353
tenant_usage_purpose: '¿Para qué desea usar este inquilino?',
5454
development_description:
5555
'Solo para pruebas y no debe usarse en producción. No se requiere suscripción.',
56+
development_description_for_private_regions:
57+
'Solo para pruebas y no debe usarse en producción.',
5658
development_hint:
5759
'Tiene todas las características profesionales pero tiene limitaciones como un banner de inicio de sesión.',
5860
production_description: 'Para uso de usuarios finales y puede requerir una suscripción paga.',

packages/phrases/src/locales/fr/translation/admin-console/tenants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const tenants = {
5353
tenant_usage_purpose: 'Dans quel but souhaitez-vous utiliser ce locataire?',
5454
development_description:
5555
"Uniquement pour les tests et ne devrait pas être utilisé en production. Aucune souscription n'est requise.",
56+
development_description_for_private_regions:
57+
'Uniquement pour les tests et ne devrait pas être utilisé en production.',
5658
development_hint:
5759
"Il possède toutes les fonctionnalités Pro mais présente des limitations telles qu'une bannière de connexion.",
5860
production_description:

packages/phrases/src/locales/it/translation/admin-console/tenants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ const tenants = {
5454
tenant_usage_purpose: 'Per cosa desideri utilizzare questo inquilino?',
5555
development_description:
5656
'Solo per scopi di test e non dovrebbe essere utilizzato in produzione. Non è richiesto alcun abbonamento.',
57+
development_description_for_private_regions:
58+
'Solo per scopi di test e non dovrebbe essere utilizzato in produzione.',
5759
development_hint:
5860
'Ha tutte le funzionalità professionali ma ha delle limitazioni come un banner di accesso.',
5961
production_description:

packages/phrases/src/locales/ja/translation/admin-console/tenants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const tenants = {
5151
tenant_usage_purpose: 'このテナントを使用する目的は何ですか?',
5252
development_description:
5353
'テスト用であり、本番で使用すべきではありません。サブスクリプションは必要ありません。',
54+
development_description_for_private_regions: 'テスト用であり、本番で使用すべきではありません。',
5455
development_hint: 'すべてのプロの機能がありますが、サインインバナーなどの制限があります。',
5556
production_description:
5657
'エンドユーザーに使用することを意図しており、有料のサブスクリプションが必要なアプリ向け。',

packages/phrases/src/locales/ko/translation/admin-console/tenants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ const tenants = {
5050
tenant_usage_purpose: '이 테넌트를 사용하는 목적은 무엇입니까?',
5151
development_description:
5252
'테스트 용으로만 사용하고 프로덕션에서 사용하지 마십시오. 구독이 필요하지 않습니다.',
53+
development_description_for_private_regions:
54+
'테스트 용으로만 사용하고 프로덕션에서 사용하지 마십시오.',
5355
development_hint: '로그인 배너와 같은 제한이 있지만 모든 프로 기능이 있습니다.',
5456
production_description: '최종 사용자가 사용하기 위한 것으로 유료 구독이 필요할 수 있습니다.',
5557
available_plan: '사용 가능한 요금제:',

0 commit comments

Comments
 (0)