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

BUGFIX/HCMPRE-1634: fix for versions #149 #158 #2031

Merged
merged 6 commits into from
Dec 16, 2024
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
4 changes: 2 additions & 2 deletions health/micro-ui/web/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.6",
"@egovernments/digit-ui-module-workbench": "1.0.11",
"@egovernments/digit-ui-module-core": "1.8.11",
"@egovernments/digit-ui-module-core": "1.8.12",
"@egovernments/digit-ui-module-utilities": "1.0.10",
"@egovernments/digit-ui-components":"0.0.2-beta.56",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-module-hcmworkbench":"0.1.0",
"@egovernments/digit-ui-module-campaign-manager": "0.3.0",
"react": "17.0.2",
Expand Down
6 changes: 3 additions & 3 deletions health/micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"devDependencies": {
"@egovernments/digit-ui-libraries": "1.8.6",
"@egovernments/digit-ui-module-workbench": "1.0.11",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-module-core": "1.8.11",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"@egovernments/digit-ui-module-core": "1.8.12",
"@egovernments/digit-ui-module-utilities": "1.0.3",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-module-hcmworkbench": "0.1.0",
"@egovernments/digit-ui-module-campaign-manager": "0.3.0",
"@egovernments/digit-ui-module-microplan": "0.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<meta name="theme-color" content="#00bcd1" />
<title>DIGIT</title>
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.8.3/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.42/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.2/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.43/dist/index.css" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Switch to stable version 0.0.2-1 instead of beta

The package has a stable version 0.0.2-1 available which should be used instead of the beta version 0.0.2-beta.43 to ensure production stability. Update the CSS import URL to:

<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-1/dist/index.css" />
🔗 Analysis chain

Verify beta version stability in production

Using beta version (0.0.2-beta.43) in production could pose stability risks. Consider:

  1. Using a stable release version
  2. Documenting known limitations of the beta version
  3. Having a rollback plan if issues arise
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if there are any stable versions available
curl -s https://registry.npmjs.org/@egovernments/digit-ui-components-css | jq '.versions | keys[]' | grep -v beta

Length of output: 181

<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.3/dist/index.css" />
Comment on lines +14 to +15
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider adding integrity hashes for CDN resources

While using unpkg.com CDN is common, it's recommended to add integrity hashes to prevent potential security risks from CDN compromises.

Example implementation:

<link rel="stylesheet" 
      href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.43/dist/index.css"
      integrity="sha384-[calculated-hash]"
      crossorigin="anonymous" />



<!-- added below css for hcm-workbench module inclusion-->
Expand Down
4 changes: 2 additions & 2 deletions health/micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"*.{js,css,md}": "prettier --write"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"ajv": "8.12.0",
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},
"dependencies": {
"@cyntler/react-doc-viewer": "1.10.3",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"@egovernments/digit-ui-react-components": "1.8.12",
"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"react": "17.0.2",
"react-date-range": "^1.4.0",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const MicroplanSearch = () => {
const [tabData, setTabData] = useState(
TabSearchconfig?.TabSearchconfig?.map((configItem, index) => ({ key: index, label: configItem.label, active: index === 0 ? true : false }))
); // setting number of tab component and making first index enable as default
const [key,setKey] = useState(0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider extracting tab management logic into a custom hook.

Both MicroplanSearch and MyMicroplans components share identical tab management logic. Consider extracting this into a custom hook to improve code reusability and maintainability.

Example implementation:

// useTabManagement.js
const useTabManagement = (initialConfig) => {
  const [tabChangeCounter, setTabChangeCounter] = useState(0);
  const [tabData, setTabData] = useState(
    initialConfig?.map((configItem, index) => ({
      key: index,
      label: configItem.label,
      active: index === 0
    }))
  );

  const handleTabChange = (tabIndex) => {
    setTabData((prev) => 
      prev.map((tab, index) => ({ ...tab, active: index === tabIndex }))
    );
    setTabChangeCounter((prev) => prev + 1);
    
    const url = new URL(window.location.href);
    url.searchParams.set("tabId", `${tabIndex}`);
    window.history.replaceState({}, "", url);
  };

  return {
    tabChangeCounter,
    tabData,
    handleTabChange
  };
};

This would simplify both components and eliminate code duplication.

Also applies to: 32-32, 35-35

useEffect(() => {
// Set default values when component mounts
setDefaultValues(defaultSearchValues);
Expand All @@ -28,10 +29,10 @@ const MicroplanSearch = () => {
const url = new URL(window.location.href);
url.searchParams.set("tabId", `${n}`);
window.history.replaceState({}, "", url);

setKey(prev => prev+1)
};
return (
<React.Fragment>
<React.Fragment key={key}>

<Header styles={{ fontSize: "32px" }}>{ t(`SEARCH_${config?.label}`) }</Header>
<div className="inbox-search-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ const MyMicroplans = () => {
// Set default values when component mounts
setDefaultValues(defaultSearchValues);
}, []);

const [key,setKey] = useState(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider using a more descriptive name for the key state variable.

The key state is used for forcing re-renders on tab changes. Consider using a more semantic name like tabChangeCounter or rerenderKey to better convey its purpose.

-const [key, setKey] = useState(0);
+const [tabChangeCounter, setTabChangeCounter] = useState(0);

-setKey((prev)=>prev+1);
+setTabChangeCounter((prev)=>prev+1);

-<React.Fragment key={key}>
+<React.Fragment key={tabChangeCounter}>

Also applies to: 31-31, 34-34

const onTabChange = (n) => {

setTabData((prev) => prev.map((i, c) => ({ ...i, active: c === n ? true : false }))); //setting tab enable which is being clicked
// setConfig(TabSearchconfig?.TabSearchconfig?.[n]);// as per tab number filtering the config
const url = new URL(window.location.href);
url.searchParams.set("tabId", `${n}`);
window.history.replaceState({}, "", url);

setKey((prev)=>prev+1);
};
return (
<React.Fragment>
<React.Fragment key={key}>

<Header styles={{ fontSize: "32px" }}>{t("MY_MICROPLANS_HEADING")}</Header>
<div className="inbox-search-wrapper">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.0-beta.2",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-react-components": "1.8.12",
"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",
Expand Down
6 changes: 3 additions & 3 deletions health/micro-ui/web/microplan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"homepage": "/microplan-ui",
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.6",
"@egovernments/digit-ui-module-core": "1.8.11",
"@egovernments/digit-ui-module-core": "1.8.12",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.23",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-module-hcmmicroplanning": "0.0.2",
"@egovernments/digit-ui-module-microplan": "0.0.1",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"@egovernments/digit-ui-module-campaign-manager": "0.3.0",
"babel-loader": "8.1.0",
"clean-webpack-plugin": "4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions health/micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.2-beta.8",
"@egovernments/digit-ui-module-workbench": "1.0.2-beta.7",
"@egovernments/digit-ui-module-core": "1.8.11",
"@egovernments/digit-ui-module-core": "1.8.12",
"@egovernments/digit-ui-module-hrms": "1.8.0-beta.2",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"@egovernments/digit-ui-module-dss": "1.8.0-beta",
"@egovernments/digit-ui-module-common": "1.8.0-beta",
"@egovernments/digit-ui-module-utilities": "1.0.0-beta",
Expand Down
2 changes: 1 addition & 1 deletion health/micro-ui/web/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@400;500;700&family=Roboto:wght@400;500;700&display=swap"
rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-css@1.8.3/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.42/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.43/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.2/dist/index.css" />
Comment on lines +11 to 13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Version inconsistency detected between files

The version of digit-ui-health-css is inconsistent across files:

  • This file uses version 0.2.2
  • example/public/index.html uses version 0.2.3

This inconsistency could lead to UI discrepancies between environments.

Apply this update to maintain consistency:

-  <link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.2/dist/index.css" />
+  <link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.3/dist/index.css" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.43/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.2/dist/index.css" />
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-components-css@0.0.2-beta.43/dist/index.css" />
<!-- added below css for hcm-workbench module inclusion-->
<link rel="stylesheet" href="https://unpkg.com/@egovernments/digit-ui-health-css@0.2.3/dist/index.css" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
Expand Down
6 changes: 3 additions & 3 deletions health/micro-ui/web/workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@egovernments/digit-ui-libraries": "1.8.6",
"@egovernments/digit-ui-module-workbench": "1.0.11",
"@egovernments/digit-ui-module-core": "1.8.11",
"@egovernments/digit-ui-module-core": "1.8.12",
"@egovernments/digit-ui-module-utilities": "1.0.10",
"@egovernments/digit-ui-components": "0.0.2-beta.56",
"@egovernments/digit-ui-react-components": "1.8.10",
"@egovernments/digit-ui-components": "0.0.2-beta.58",
"@egovernments/digit-ui-react-components": "1.8.12",
"@egovernments/digit-ui-module-hcmworkbench":"0.1.0",
"@egovernments/digit-ui-module-campaign-manager": "0.3.0",
"react": "17.0.2",
Expand Down
Loading