From dd8bcce278102b14220ea5d058542467154d4c21 Mon Sep 17 00:00:00 2001 From: rique223 Date: Fri, 5 Aug 2022 18:29:36 -0300 Subject: [PATCH] chore: :recycle: Migrate AppPermissionsReviewModal from JS to TS --- .../client/views/admin/apps/AppInstallPage.js | 2 +- ...Modal.js => AppPermissionsReviewModal.tsx} | 22 ++++++++++++------- .../rocketchat-i18n/i18n/en.i18n.json | 1 + 3 files changed, 16 insertions(+), 9 deletions(-) rename apps/meteor/client/views/admin/apps/{AppPermissionsReviewModal.js => AppPermissionsReviewModal.tsx} (71%) diff --git a/apps/meteor/client/views/admin/apps/AppInstallPage.js b/apps/meteor/client/views/admin/apps/AppInstallPage.js index 24ff2b6dae09..4ea0e0ad479d 100644 --- a/apps/meteor/client/views/admin/apps/AppInstallPage.js +++ b/apps/meteor/client/views/admin/apps/AppInstallPage.js @@ -84,7 +84,7 @@ function AppInstallPage() { sendFile(permissions, appFile, appId)} + confirm={(permissionsGranted) => sendFile(permissionsGranted, appFile, appId)} />, ); } diff --git a/apps/meteor/client/views/admin/apps/AppPermissionsReviewModal.js b/apps/meteor/client/views/admin/apps/AppPermissionsReviewModal.tsx similarity index 71% rename from apps/meteor/client/views/admin/apps/AppPermissionsReviewModal.js rename to apps/meteor/client/views/admin/apps/AppPermissionsReviewModal.tsx index 53a7e32c01fd..799273d1d3ad 100644 --- a/apps/meteor/client/views/admin/apps/AppPermissionsReviewModal.js +++ b/apps/meteor/client/views/admin/apps/AppPermissionsReviewModal.tsx @@ -1,24 +1,30 @@ import { Button, ButtonGroup, Icon, Modal } from '@rocket.chat/fuselage'; -import { useTranslation } from '@rocket.chat/ui-contexts'; -import React from 'react'; +import { TranslationKey, useTranslation } from '@rocket.chat/ui-contexts'; +import React, { ReactElement } from 'react'; -const AppPermissionsReviewModal = ({ appPermissions, cancel, confirm, modalProps = {} }) => { +type AppPermissionsReviewModalProps = { + appPermissions: Array<{ name: string; required?: boolean }>; + cancel: () => void; + confirm: (permissionsGranted: any) => void; +}; + +const AppPermissionsReviewModal = ({ appPermissions, cancel, confirm, ...props }: AppPermissionsReviewModalProps): ReactElement => { const t = useTranslation(); - const handleCloseButtonClick = () => { + const handleCloseButtonClick = (): void => { cancel(); }; - const handleCancelButtonClick = () => { + const handleCancelButtonClick = (): void => { cancel(); }; - const handleConfirmButtonClick = () => { + const handleConfirmButtonClick = (): void => { confirm(appPermissions); }; return ( - + {t('Apps_Permissions_Review_Modal_Title')} @@ -33,7 +39,7 @@ const AppPermissionsReviewModal = ({ appPermissions, cancel, confirm, modalProps ? appPermissions.map((permission, count) => (
  • {count + 1} - - {t(`Apps_Permissions_${permission.name.replace('.', '_')}`)} + {t(`Apps_Permissions_${permission.name.replace('.', '_')}` as TranslationKey)} {permission.required && ({t('required')})}
  • )) diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index b8f40ac9e1ac..ba33d42d4c44 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -321,6 +321,7 @@ "Agent_deactivated": "Agent was deactivated", "Agent_Without_Extensions": "Agent Without Extensions", "Agents": "Agents", + "Agree": "Agree", "Alerts": "Alerts", "Alias": "Alias", "Alias_Format": "Alias Format",