From 14008e198b04b168aa500e306e54951a512a4fef Mon Sep 17 00:00:00 2001 From: Gao Sun Date: Fri, 20 Oct 2023 16:56:08 +0800 Subject: [PATCH] refactor(console): use correct delete confirmation text --- .../src/pages/Organizations/ActionsButton/index.tsx | 11 ++++++----- .../pages/Organizations/PermissionsField/index.tsx | 2 +- .../src/pages/Organizations/RolesField/index.tsx | 2 +- .../de/translation/admin-console/organizations.ts | 6 ++++++ .../en/translation/admin-console/organizations.ts | 4 ++++ .../es/translation/admin-console/organizations.ts | 6 ++++++ .../fr/translation/admin-console/organizations.ts | 6 ++++++ .../it/translation/admin-console/organizations.ts | 6 ++++++ .../ja/translation/admin-console/organizations.ts | 6 ++++++ .../ko/translation/admin-console/organizations.ts | 6 ++++++ .../pl-pl/translation/admin-console/organizations.ts | 6 ++++++ .../pt-br/translation/admin-console/organizations.ts | 6 ++++++ .../pt-pt/translation/admin-console/organizations.ts | 6 ++++++ .../ru/translation/admin-console/organizations.ts | 6 ++++++ .../tr-tr/translation/admin-console/organizations.ts | 6 ++++++ .../zh-cn/translation/admin-console/organizations.ts | 6 ++++++ .../zh-hk/translation/admin-console/organizations.ts | 6 ++++++ .../zh-tw/translation/admin-console/organizations.ts | 6 ++++++ 18 files changed, 96 insertions(+), 7 deletions(-) diff --git a/packages/console/src/pages/Organizations/ActionsButton/index.tsx b/packages/console/src/pages/Organizations/ActionsButton/index.tsx index a4be48f55..387b7d4e9 100644 --- a/packages/console/src/pages/Organizations/ActionsButton/index.tsx +++ b/packages/console/src/pages/Organizations/ActionsButton/index.tsx @@ -1,5 +1,5 @@ import { type AdminConsoleKey } from '@logto/phrases'; -import { useCallback, useState, type ReactNode } from 'react'; +import { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import Delete from '@/assets/icons/delete.svg'; @@ -7,6 +7,7 @@ import Edit from '@/assets/icons/edit.svg'; import More from '@/assets/icons/more.svg'; import ActionMenu, { ActionMenuItem } from '@/ds-components/ActionMenu'; import ConfirmModal from '@/ds-components/ConfirmModal'; +import DynamicT from '@/ds-components/DynamicT'; import useActionTranslation from '@/hooks/use-action-translation'; import * as styles from './index.module.scss'; @@ -16,8 +17,8 @@ type Props = { onDelete: () => void | Promise; /** A function that will be called when the user clicks the edit button. */ onEdit: () => void | Promise; - /** The text or content to display in the confirmation modal. */ - content: ReactNode; + /** The translation key of the content that will be displayed in the confirmation modal. */ + deleteConfirmation: AdminConsoleKey; /** The name of the field that is being operated. */ fieldName: AdminConsoleKey; }; @@ -28,7 +29,7 @@ type Props = { * - Edit * - Delete */ -function ActionsButton({ onDelete, onEdit, content, fieldName }: Props) { +function ActionsButton({ onDelete, onEdit, deleteConfirmation, fieldName }: Props) { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const tAction = useActionTranslation(); const [isModalOpen, setIsModalOpen] = useState(false); @@ -72,7 +73,7 @@ function ActionsButton({ onDelete, onEdit, content, fieldName }: Props) { }} onConfirm={handleDelete} > - {content} + ); diff --git a/packages/console/src/pages/Organizations/PermissionsField/index.tsx b/packages/console/src/pages/Organizations/PermissionsField/index.tsx index ceb1cba24..c5701c811 100644 --- a/packages/console/src/pages/Organizations/PermissionsField/index.tsx +++ b/packages/console/src/pages/Organizations/PermissionsField/index.tsx @@ -75,7 +75,7 @@ function PermissionsField() { render: (data) => ( { setEditData(data); setIsModalOpen(true); diff --git a/packages/console/src/pages/Organizations/RolesField/index.tsx b/packages/console/src/pages/Organizations/RolesField/index.tsx index ba4e5a557..1798baa1b 100644 --- a/packages/console/src/pages/Organizations/RolesField/index.tsx +++ b/packages/console/src/pages/Organizations/RolesField/index.tsx @@ -89,7 +89,7 @@ function RolesField() { render: (data) => ( { setEditData(data); setIsModalOpen(true); diff --git a/packages/phrases/src/locales/de/translation/admin-console/organizations.ts b/packages/phrases/src/locales/de/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/de/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/de/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/en/translation/admin-console/organizations.ts b/packages/phrases/src/locales/en/translation/admin-console/organizations.ts index 3aece376d..295534da8 100644 --- a/packages/phrases/src/locales/en/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/en/translation/admin-console/organizations.ts @@ -7,11 +7,15 @@ const organization = { 'Authorization in a multi-tenancy applications is often designed to make sure that tenant isolation is maintained throughout an application and that tenants can access only their own resources.', organization_permission: 'Organization permission', organization_permission_other: 'Organization permissions', + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', create_permission_placeholder: 'Read appointment history.', permission: 'Permission', permission_other: 'Permissions', organization_role: 'Organization role', organization_role_other: 'Organization roles', + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', role: 'Role', create_role_placeholder: 'Users with view-only permissions.', search_permission_placeholder: 'Type to search for permissions.', diff --git a/packages/phrases/src/locales/es/translation/admin-console/organizations.ts b/packages/phrases/src/locales/es/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/es/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/es/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/fr/translation/admin-console/organizations.ts b/packages/phrases/src/locales/fr/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/fr/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/fr/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/it/translation/admin-console/organizations.ts b/packages/phrases/src/locales/it/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/it/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/it/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/ja/translation/admin-console/organizations.ts b/packages/phrases/src/locales/ja/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/ja/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/ja/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/ko/translation/admin-console/organizations.ts b/packages/phrases/src/locales/ko/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/ko/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/ko/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/pl-pl/translation/admin-console/organizations.ts b/packages/phrases/src/locales/pl-pl/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/pl-pl/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/pl-pl/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/pt-br/translation/admin-console/organizations.ts b/packages/phrases/src/locales/pt-br/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/pt-br/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/pt-br/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/pt-pt/translation/admin-console/organizations.ts b/packages/phrases/src/locales/pt-pt/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/pt-pt/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/pt-pt/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/ru/translation/admin-console/organizations.ts b/packages/phrases/src/locales/ru/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/ru/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/ru/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/tr-tr/translation/admin-console/organizations.ts b/packages/phrases/src/locales/tr-tr/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/tr-tr/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/tr-tr/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/zh-cn/translation/admin-console/organizations.ts b/packages/phrases/src/locales/zh-cn/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/zh-cn/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/zh-cn/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/zh-hk/translation/admin-console/organizations.ts b/packages/phrases/src/locales/zh-hk/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/zh-hk/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/zh-hk/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.', diff --git a/packages/phrases/src/locales/zh-tw/translation/admin-console/organizations.ts b/packages/phrases/src/locales/zh-tw/translation/admin-console/organizations.ts index ef5fab635..f49a1d782 100644 --- a/packages/phrases/src/locales/zh-tw/translation/admin-console/organizations.ts +++ b/packages/phrases/src/locales/zh-tw/translation/admin-console/organizations.ts @@ -14,6 +14,9 @@ const organizations = { /** UNTRANSLATED */ organization_permission_other: 'Organization permissions', /** UNTRANSLATED */ + organization_permission_delete_confirm: + 'If this permission is deleted, all organization roles including this permission will lose this permission, and users who had this permission will lose the access granted by it.', + /** UNTRANSLATED */ create_permission_placeholder: 'Read appointment history.', /** UNTRANSLATED */ permission: 'Permission', @@ -24,6 +27,9 @@ const organizations = { /** UNTRANSLATED */ organization_role_other: 'Organization roles', /** UNTRANSLATED */ + organization_role_delete_confirm: + 'Doing so will remove the permissions associated with this role from the affected users and delete the relations among organization roles, members in the organization, and organization permissions.', + /** UNTRANSLATED */ role: 'Role', /** UNTRANSLATED */ create_role_placeholder: 'Users with view-only permissions.',