From 7089db9425a5386827453f467ec210a628afbd4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9o=20Banno-Cloutier?=
 <leo.banno-cloutier@savoirfairelinux.com>
Date: Fri, 25 Aug 2023 16:41:32 -0400
Subject: [PATCH] jams-react-client: rename var and let to const

Change-Id: If8d406a4dfa188bb89b05472b18e5943c5f79d58
---
 .../CustomUiPreview/CustomUiPreview.tsx        | 16 +++++++++-------
 .../src/components/Footer/Footer.tsx           |  2 +-
 .../PasswordDialog/PasswordDialog.tsx          |  2 +-
 .../ServerParameters/ServerParameters.tsx      |  4 ++--
 .../src/components/Sidebar/Sidebar.tsx         |  6 +++---
 jams-react-client/src/tools.tsx                |  6 +++---
 .../src/views/Blueprints/Blueprints.tsx        |  2 +-
 .../views/Blueprints/CreateBlueprintDialog.tsx |  2 +-
 .../src/views/Contacts/Contacts.tsx            |  2 +-
 .../src/views/Groups/CreateGroupDialog.tsx     |  2 +-
 .../src/views/Groups/EditGroup.tsx             | 18 +++++++++---------
 jams-react-client/src/views/Groups/Groups.tsx  |  2 +-
 .../src/views/Settings/General.tsx             |  5 ++---
 .../views/UserProfile/AdminAddUserToGroup.tsx  |  2 +-
 .../views/UserProfile/DisplayUserProfile.tsx   |  4 ++--
 .../UserProfile/EditCreateUserProfile.tsx      |  5 ++---
 16 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/jams-react-client/src/components/CustomUiPreview/CustomUiPreview.tsx b/jams-react-client/src/components/CustomUiPreview/CustomUiPreview.tsx
index 598aa8af..73dbb381 100644
--- a/jams-react-client/src/components/CustomUiPreview/CustomUiPreview.tsx
+++ b/jams-react-client/src/components/CustomUiPreview/CustomUiPreview.tsx
@@ -113,22 +113,24 @@ export const CustomUiPreview: FC<CustomUiPreviewProps> = ({
   opacity,
   uiCustomization,
 }) => {
-  let {
+  const {
     hasTitle,
-    title,
     hasDescription,
-    description,
     hasTips,
     hasBackground,
-    backgroundColor,
-    backgroundUrl,
     tipBoxAndIdColor,
     hasMainBoxColor,
-    mainBoxColor,
     hasLogo,
-    logoUrl,
     logoSize,
   } = uiCustomization;
+  let {
+    title,
+    description,
+    backgroundColor,
+    backgroundUrl,
+    mainBoxColor,
+    logoUrl,
+  } = uiCustomization;
 
   if (!title) {
     title = i18next.t("welcome_title", "Welcome to Jami");
diff --git a/jams-react-client/src/components/Footer/Footer.tsx b/jams-react-client/src/components/Footer/Footer.tsx
index 2586f390..96f0c805 100755
--- a/jams-react-client/src/components/Footer/Footer.tsx
+++ b/jams-react-client/src/components/Footer/Footer.tsx
@@ -4,7 +4,7 @@ import { makeStyles } from "@mui/styles";
 // core components
 import styles from "assets/jss/material-dashboard-react/components/footerStyle";
 
-const pjson = require("../../../package.json");
+import pjson from "../../../package.json";
 
 const useStyles = makeStyles(styles);
 
diff --git a/jams-react-client/src/components/PasswordDialog/PasswordDialog.tsx b/jams-react-client/src/components/PasswordDialog/PasswordDialog.tsx
index 60ad7486..a8dc9a3b 100644
--- a/jams-react-client/src/components/PasswordDialog/PasswordDialog.tsx
+++ b/jams-react-client/src/components/PasswordDialog/PasswordDialog.tsx
@@ -31,7 +31,7 @@ import IconButton from "@mui/material/IconButton";
 
 import { CopyToClipboard } from "react-copy-to-clipboard";
 
-let generator = require("generate-password");
+import generator from "generate-password";
 
 const styles = (theme) => ({
   root: {
diff --git a/jams-react-client/src/components/ServerParameters/ServerParameters.tsx b/jams-react-client/src/components/ServerParameters/ServerParameters.tsx
index 644e3026..2c0fa736 100644
--- a/jams-react-client/src/components/ServerParameters/ServerParameters.tsx
+++ b/jams-react-client/src/components/ServerParameters/ServerParameters.tsx
@@ -115,8 +115,8 @@ export default function ServerParameters({ setError, setErrorMessage }) {
 
   function handleSubmit(values: Settings) {
     let jsonData = {};
-    let re = new RegExp(/^http[s]?:\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/);
-    let nohttpre = new RegExp(/^\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/);
+    const re = new RegExp(/^http[s]?:\/\/\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/);
+    const nohttpre = new RegExp(/^\w+(\.\w+)*(:[0-9]+)?\/?(\/[.\w]*)*$/);
 
     if (values.domain.match(nohttpre))
       values.domain = window.location.protocol + "//" + values.domain;
diff --git a/jams-react-client/src/components/Sidebar/Sidebar.tsx b/jams-react-client/src/components/Sidebar/Sidebar.tsx
index d2750c6e..7dd27eb8 100755
--- a/jams-react-client/src/components/Sidebar/Sidebar.tsx
+++ b/jams-react-client/src/components/Sidebar/Sidebar.tsx
@@ -46,13 +46,13 @@ export default function Sidebar(props) {
   }
   const { color, logo, image, routes } = props;
 
-  var brand = (
+  const brand = (
     <Link to={"/"}>
       <img src={logo} alt="logo" className={classes.img} />
     </Link>
   );
 
-  var links = (
+  const links = (
     <List className={classes.list}>
       <ListItem className={classes.itemLink}>{brand}</ListItem>
       <div className={classes.itemLinkSeparator}>
@@ -113,7 +113,7 @@ export default function Sidebar(props) {
     </List>
   );
 
-  var bottomLinks = (
+  const bottomLinks = (
     <List className={classes.bottomlist}>
       {open && (
         <ListItem
diff --git a/jams-react-client/src/tools.tsx b/jams-react-client/src/tools.tsx
index c8bf330b..4ddaa510 100644
--- a/jams-react-client/src/tools.tsx
+++ b/jams-react-client/src/tools.tsx
@@ -11,11 +11,11 @@ export function buildSelectMenuItems(elements) {
 
 // read file content
 export function readSingleFile(evt, fieldContents) {
-  var f = evt.target.files[0];
+  const f = evt.target.files[0];
   if (f) {
-    var r = new FileReader();
+    const r = new FileReader();
     r.onload = function (e) {
-      var contents = e.target.result;
+      const contents = e.target.result;
       fieldContents = contents;
     };
     console.log(fieldContents);
diff --git a/jams-react-client/src/views/Blueprints/Blueprints.tsx b/jams-react-client/src/views/Blueprints/Blueprints.tsx
index 5579325c..9cd1caf3 100644
--- a/jams-react-client/src/views/Blueprints/Blueprints.tsx
+++ b/jams-react-client/src/views/Blueprints/Blueprints.tsx
@@ -100,7 +100,7 @@ export default function Blueprints() {
     }, 500);
     axios(configApiCall(api_path_blueprints + "?name=*", "GET", null, null))
       .then((response) => {
-        let allBluePrints = response.data;
+        const allBluePrints = response.data;
         if (allBluePrints.length === 0) setZeroBlueprint(true);
         else setZeroBlueprint(false);
         setBlueprints(allBluePrints);
diff --git a/jams-react-client/src/views/Blueprints/CreateBlueprintDialog.tsx b/jams-react-client/src/views/Blueprints/CreateBlueprintDialog.tsx
index bf1d2cbb..84f3aaf2 100644
--- a/jams-react-client/src/views/Blueprints/CreateBlueprintDialog.tsx
+++ b/jams-react-client/src/views/Blueprints/CreateBlueprintDialog.tsx
@@ -75,7 +75,7 @@ export default function CreateBlueprintDialog({ open, setOpen }) {
   );
 
   const handleCreateBlueprint = () => {
-    let defaultPolicyData = {
+    const defaultPolicyData = {
       videoEnabled: true,
       publicInCalls: false,
       allowCertFromContact: true,
diff --git a/jams-react-client/src/views/Contacts/Contacts.tsx b/jams-react-client/src/views/Contacts/Contacts.tsx
index 394f8852..21728582 100644
--- a/jams-react-client/src/views/Contacts/Contacts.tsx
+++ b/jams-react-client/src/views/Contacts/Contacts.tsx
@@ -107,7 +107,7 @@ export default function Users(props) {
       )
     )
       .then((response) => {
-        let profiles = [];
+        const profiles = [];
         const profilesResults = response.data.profiles;
         profilesResults.forEach((profile) => {
           if (profile.username !== props.username) {
diff --git a/jams-react-client/src/views/Groups/CreateGroupDialog.tsx b/jams-react-client/src/views/Groups/CreateGroupDialog.tsx
index 9661ac59..47b5e7f3 100644
--- a/jams-react-client/src/views/Groups/CreateGroupDialog.tsx
+++ b/jams-react-client/src/views/Groups/CreateGroupDialog.tsx
@@ -66,7 +66,7 @@ export default function CreateGroupDialog({
       )
     )
       .then((response) => {
-        let allGroups = response.data;
+        const allGroups = response.data;
         setDisableCreate(false);
         setGroupNameExits(false);
         allGroups.forEach((group) => {
diff --git a/jams-react-client/src/views/Groups/EditGroup.tsx b/jams-react-client/src/views/Groups/EditGroup.tsx
index 44bb81bc..e9284f89 100644
--- a/jams-react-client/src/views/Groups/EditGroup.tsx
+++ b/jams-react-client/src/views/Groups/EditGroup.tsx
@@ -143,7 +143,7 @@ export default function EditGroup(props) {
   const getGroup = () => {
     axios(configApiCall(api_path_get_group + props.groupid, "GET", null, null))
       .then((response) => {
-        let group = response.data;
+        const group = response.data;
 
         axios(configApiCall(api_path_blueprints + "?name=*", "GET", null, null))
           .then((response) => {
@@ -172,10 +172,10 @@ export default function EditGroup(props) {
           )
         )
           .then((response) => {
-            let members = response.data;
+            const members = response.data;
             members.forEach((member) => {
               getUserInfo(member.username).then((userInfo) => {
-                let newGroupMembers = groupMembers;
+                const newGroupMembers = groupMembers;
                 newGroupMembers.push(userInfo);
                 setGroupMembers(newGroupMembers);
 
@@ -210,7 +210,7 @@ export default function EditGroup(props) {
   );
 
   const updateGroup = (blueprintValue) => {
-    let data = {
+    const data = {
       name: newName,
       blueprint: blueprintValue ? blueprintValue : selectedBlueprint.label,
     };
@@ -241,7 +241,7 @@ export default function EditGroup(props) {
       )
     )
       .then((response) => {
-        let profiles = [];
+        const profiles = [];
         const profilesResults = response.data.profiles;
         profilesResults.forEach((profile) => {
           let existingUser = false;
@@ -262,7 +262,7 @@ export default function EditGroup(props) {
   };
 
   const addUserInGroup = (user) => {
-    let data = {
+    const data = {
       username: user.username,
     };
     axios(
@@ -274,7 +274,7 @@ export default function EditGroup(props) {
       )
     )
       .then(() => {
-        let newGroupMembers = groupMembers;
+        const newGroupMembers = groupMembers;
         newGroupMembers.push(user);
         setGroupMembers(newGroupMembers);
 
@@ -290,7 +290,7 @@ export default function EditGroup(props) {
   };
 
   const deleteUserFromGroup = (user) => {
-    let data = {
+    const data = {
       username: user.username,
     };
     axios(
@@ -302,7 +302,7 @@ export default function EditGroup(props) {
       )
     )
       .then(() => {
-        let newGroupMembers = groupMembers;
+        const newGroupMembers = groupMembers;
         newGroupMembers.splice(newGroupMembers.indexOf(user), 1);
         setGroupMembers(newGroupMembers);
 
diff --git a/jams-react-client/src/views/Groups/Groups.tsx b/jams-react-client/src/views/Groups/Groups.tsx
index 63b8adb2..2213d7fc 100644
--- a/jams-react-client/src/views/Groups/Groups.tsx
+++ b/jams-react-client/src/views/Groups/Groups.tsx
@@ -139,7 +139,7 @@ export default function Groups() {
 
     axios(configApiCall(api_path_get_list_group, "GET", null, null))
       .then((response) => {
-        let allGroups = response.data;
+        const allGroups = response.data;
 
         allGroups.forEach((group) => {
           axios(
diff --git a/jams-react-client/src/views/Settings/General.tsx b/jams-react-client/src/views/Settings/General.tsx
index 2d8ade87..ff62940e 100644
--- a/jams-react-client/src/views/Settings/General.tsx
+++ b/jams-react-client/src/views/Settings/General.tsx
@@ -30,9 +30,8 @@ import i18next from "i18next";
 
 import LanguagePicker from "../../components/LanguagePicker/LanguagePicker";
 
-const pjson = require("../../../package.json");
-
-let generator = require("generate-password");
+import pjson from "../../../package.json";
+import generator from "generate-password";
 
 const useStyles = makeStyles((theme) => ({
   paper: {
diff --git a/jams-react-client/src/views/UserProfile/AdminAddUserToGroup.tsx b/jams-react-client/src/views/UserProfile/AdminAddUserToGroup.tsx
index 9423c60d..a05f7b58 100644
--- a/jams-react-client/src/views/UserProfile/AdminAddUserToGroup.tsx
+++ b/jams-react-client/src/views/UserProfile/AdminAddUserToGroup.tsx
@@ -91,7 +91,7 @@ const AdminAddUserToGroup: FC<AdminAddUserToGroupProps> = ({
       )
     )
       .then(() => {
-        let newGroupMemberships = groupMemberships;
+        const newGroupMemberships = groupMemberships;
         newGroupMemberships.push({
           groupId: group.id,
           name: group.name,
diff --git a/jams-react-client/src/views/UserProfile/DisplayUserProfile.tsx b/jams-react-client/src/views/UserProfile/DisplayUserProfile.tsx
index 19216cd8..bed01123 100644
--- a/jams-react-client/src/views/UserProfile/DisplayUserProfile.tsx
+++ b/jams-react-client/src/views/UserProfile/DisplayUserProfile.tsx
@@ -230,7 +230,7 @@ const DisplayUserProfile: FC<DisplayUserProfileProps> = ({
       )
     )
       .then(() => {
-        let newGroupMemberships = groupMemberships;
+        const newGroupMemberships = groupMemberships;
         newGroupMemberships.splice(newGroupMemberships.indexOf(group), 1);
         setGroupMemberships(newGroupMemberships);
       })
@@ -265,7 +265,7 @@ const DisplayUserProfile: FC<DisplayUserProfileProps> = ({
         null
       )
     ).then((userGroups) => {
-      let userGroupsData: UserGroup[] = userGroups.data;
+      const userGroupsData: UserGroup[] = userGroups.data;
       userGroupsData.forEach((group) => {
         axios(
           configApiCall(api_path_get_group + group.groupId, "GET", null, null)
diff --git a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.tsx b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.tsx
index 0cfde311..32ffc281 100644
--- a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.tsx
+++ b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.tsx
@@ -73,8 +73,7 @@ import LinearProgress from "@mui/material/LinearProgress";
 
 import i18next from "i18next";
 
-let generator = require("generate-password");
-
+import generator from "generate-password";
 const fileUpload = require("fuctbase64");
 
 const styles = (theme) => ({
@@ -637,7 +636,7 @@ export default function EditCreateUserProfile(props) {
                           alt="..."
                           className={classes.editProfilePicture}
                           onClick={() => {
-                            let pictureChange = document.getElementById(
+                            const pictureChange = document.getElementById(
                               "change-profile-picture"
                             );
                             pictureChange.click();
-- 
GitLab