From 66c6bf6ef1dffa52ccbfdd7221563a9092ba383c Mon Sep 17 00:00:00 2001
From: Sky Brewer <sky.brewer@ess.eu>
Date: Fri, 8 Nov 2024 15:21:04 +0100
Subject: [PATCH] Fix React and other imports

---
 .../IOC/IOCDeployDialog/IOCDeployDialog.tsx   | 13 +++++--
 src/components/Job/JobData.ts                 | 36 -------------------
 src/components/Job/JobIcons.tsx               | 28 ++++++++++++++-
 src/components/host/index.js                  |  4 +--
 src/index.jsx                                 |  6 ++--
 src/store/ReduxProvider.tsx                   |  3 +-
 src/typings.d.ts                              |  6 ++--
 7 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.tsx b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.tsx
index ef55d312..3e01e168 100644
--- a/src/components/IOC/IOCDeployDialog/IOCDeployDialog.tsx
+++ b/src/components/IOC/IOCDeployDialog/IOCDeployDialog.tsx
@@ -1,4 +1,11 @@
-import { useCallback, useEffect, useState, useMemo } from "react";
+import {
+  useCallback,
+  useEffect,
+  useState,
+  useMemo,
+  FormEvent,
+  SyntheticEvent
+} from "react";
 import {
   Button,
   TextField,
@@ -115,7 +122,7 @@ export function IOCDeployDialog({
     getTagOrCommitIds(gitProjectId, "", "CONTAINS");
   }, [gitProjectId, getTagOrCommitIds]);
 
-  const onSubmit = (event: React.FormEvent<HTMLFormElement>) => {
+  const onSubmit = (event: FormEvent<HTMLFormElement>) => {
     event.preventDefault();
     setButtonDisabled(true);
     const { git: gitText } = event.currentTarget
@@ -183,7 +190,7 @@ export function IOCDeployDialog({
               )
             }}
             onGitQueryValueSelect={(
-              _: React.SyntheticEvent<Element, Event>,
+              _: SyntheticEvent<Element, Event>,
               value: GitReference
             ) => {
               setRevision(value?.reference);
diff --git a/src/components/Job/JobData.ts b/src/components/Job/JobData.ts
index 0a2dc39a..8b77ed29 100644
--- a/src/components/Job/JobData.ts
+++ b/src/components/Job/JobData.ts
@@ -1,12 +1,3 @@
-import {
-  DeployIcon,
-  UndeployIcon,
-  BatchDeployIcon,
-  BatchUndeployIcon,
-  StartIcon,
-  StopIcon
-} from "./JobIcons";
-
 export const ACTION_TYPES = {
   DEPLOY: "DEPLOY",
   UNDEPLOY: "UNDEPLOY",
@@ -15,30 +6,3 @@ export const ACTION_TYPES = {
   START: "START",
   STOP: "STOP"
 };
-
-export const ActionTypesComponent = {
-  DEPLOY: {
-    label: "Deployment",
-    icon: DeployIcon
-  },
-  UNDEPLOY: {
-    label: "Undeployment",
-    icon: UndeployIcon
-  },
-  BATCH_DEPLOY: {
-    label: "Batch deployment",
-    icon: BatchDeployIcon
-  },
-  BATCH_UNDEPLOY: {
-    label: "Batch undeployment",
-    icon: BatchUndeployIcon
-  },
-  START: {
-    label: "Set active",
-    icon: StartIcon
-  },
-  STOP: {
-    label: "Set inactive",
-    icon: StopIcon
-  }
-};
diff --git a/src/components/Job/JobIcons.tsx b/src/components/Job/JobIcons.tsx
index 0f9e0fcb..6b09c427 100644
--- a/src/components/Job/JobIcons.tsx
+++ b/src/components/Job/JobIcons.tsx
@@ -7,7 +7,6 @@ import {
 } from "@mui/icons-material";
 import { BatchDeploySymbol } from "../../icons/BatchDeploySymbol";
 import { BatchUndeploySymbol } from "../../icons/BatchUndeploySymbol";
-import { ActionTypesComponent } from "./JobData";
 
 const batchIconDefaultProps = { width: "25px", height: "25px" };
 
@@ -43,6 +42,33 @@ export interface ActionType {
   STOP: string;
 }
 
+const ActionTypesComponent = {
+  DEPLOY: {
+    label: "Deployment",
+    icon: DeployIcon
+  },
+  UNDEPLOY: {
+    label: "Undeployment",
+    icon: UndeployIcon
+  },
+  BATCH_DEPLOY: {
+    label: "Batch deployment",
+    icon: BatchDeployIcon
+  },
+  BATCH_UNDEPLOY: {
+    label: "Batch undeployment",
+    icon: BatchUndeployIcon
+  },
+  START: {
+    label: "Set active",
+    icon: StartIcon
+  },
+  STOP: {
+    label: "Set inactive",
+    icon: StopIcon
+  }
+};
+
 export const ActionTypeIconText = ({ action }: ActionTypeIconTextProps) => {
   const Icon = ActionTypesComponent[action as keyof ActionType].icon;
 
diff --git a/src/components/host/index.js b/src/components/host/index.js
index a86de3b9..30cfa0eb 100644
--- a/src/components/host/index.js
+++ b/src/components/host/index.js
@@ -1,3 +1,3 @@
-import { HostTable, rowDescription, createRow } from "./HostTable";
+import { HostTable } from "./HostTable";
 
-export { HostTable, rowDescription, createRow };
+export { HostTable };
diff --git a/src/index.jsx b/src/index.jsx
index 8c20f94e..5768ea6f 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -1,4 +1,4 @@
-import React from "react";
+import { StrictMode } from "react";
 import { createRoot } from "react-dom/client";
 import App from "./App";
 import { LicenseInfo } from "@mui/x-license-pro";
@@ -10,7 +10,7 @@ const container = document.getElementById("root");
 const root = createRoot(container);
 
 root.render(
-  <React.StrictMode>
+  <StrictMode>
     <App />
-  </React.StrictMode>
+  </StrictMode>
 );
diff --git a/src/store/ReduxProvider.tsx b/src/store/ReduxProvider.tsx
index e6be89a0..80e11b43 100644
--- a/src/store/ReduxProvider.tsx
+++ b/src/store/ReduxProvider.tsx
@@ -1,8 +1,9 @@
+import { ReactNode } from "react";
 import { Provider } from "react-redux";
 import { store } from "./store";
 
 interface ReduxProviderProps {
-  children: React.ReactNode;
+  children: ReactNode;
 }
 
 export const ReduxProvider = ({ children }: ReduxProviderProps) => {
diff --git a/src/typings.d.ts b/src/typings.d.ts
index ba496eba..054cc31c 100644
--- a/src/typings.d.ts
+++ b/src/typings.d.ts
@@ -1,9 +1,9 @@
 declare module "@ess-ics/ce-ui-common";
 declare module "*.svg" {
-  import * as React from "react";
+  import { FunctionComponent, SVGProps, SVGSVGElement } from "react";
 
-  export const ReactComponent: React.FunctionComponent<
-    React.SVGProps<SVGSVGElement> & { title?: string }
+  export const ReactComponent: FunctionComponent<
+    SVGProps<SVGSVGElement> & { title?: string }
   >;
   const content: string;
   export default content;
-- 
GitLab