Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Migrate AppPermissionsReviewModal from JS to TS #26498

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/meteor/client/views/admin/apps/AppInstallPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function AppInstallPage() {
<AppPermissionsReviewModal
appPermissions={permissions}
cancel={cancelAction}
confirm={(permissions) => sendFile(permissions, appFile, appId)}
confirm={(permissionsGranted) => sendFile(permissionsGranted, appFile, appId)}
/>,
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<Modal {...modalProps}>
<Modal {...props}>
<Modal.Header>
<Icon color='warning' name='modal-warning' size={25} />
<Modal.Title>{t('Apps_Permissions_Review_Modal_Title')}</Modal.Title>
Expand All @@ -33,7 +39,7 @@ const AppPermissionsReviewModal = ({ appPermissions, cancel, confirm, modalProps
? appPermissions.map((permission, count) => (
<li key={permission.name}>
<b>{count + 1} - </b>
{t(`Apps_Permissions_${permission.name.replace('.', '_')}`)}
{t(`Apps_Permissions_${permission.name.replace('.', '_')}` as TranslationKey)}
{permission.required && <span style={{ color: 'red' }}> ({t('required')})</span>}
</li>
))
Expand Down
1 change: 1 addition & 0 deletions apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down