refactor(web): remove typescript

This commit is contained in:
Ali BARIN
2024-02-27 15:23:23 +00:00
parent 636870a075
commit b3ae2d2748
337 changed files with 2067 additions and 4997 deletions

View File

@@ -1,29 +1,10 @@
import * as React from 'react';
import { Link } from 'react-router-dom';
import Menu from '@mui/material/Menu';
import type { PopoverProps } from '@mui/material/Popover';
import MenuItem from '@mui/material/MenuItem';
import type { IConnection } from 'types';
import * as URLS from 'config/urls';
import useFormatMessage from 'hooks/useFormatMessage';
type Action = {
type: 'test' | 'reconnect' | 'delete' | 'viewFlows';
};
type ContextMenuProps = {
appKey: string;
connection: IConnection;
onClose: () => void;
onMenuItemClick: (event: React.MouseEvent, action: Action) => void;
anchorEl: PopoverProps['anchorEl'];
disableReconnection: boolean;
};
export default function ContextMenu(
props: ContextMenuProps
): React.ReactElement {
export default function ContextMenu(props) {
const {
appKey,
connection,
@@ -33,18 +14,15 @@ export default function ContextMenu(
disableReconnection,
} = props;
const formatMessage = useFormatMessage();
const createActionHandler = React.useCallback(
(action: Action) => {
return function clickHandler(event: React.MouseEvent) {
(action) => {
return function clickHandler(event) {
onMenuItemClick(event, action);
onClose();
};
},
[onMenuItemClick, onClose]
[onMenuItemClick, onClose],
);
return (
<Menu
open={true}
@@ -70,7 +48,7 @@ export default function ContextMenu(
to={URLS.APP_RECONNECT_CONNECTION(
appKey,
connection.id,
connection.appAuthClientId
connection.appAuthClientId,
)}
onClick={createActionHandler({ type: 'reconnect' })}
>