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

CSS Issue fix, locaisation/mdms cache issue fix #1418

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

nabeelmd-eGov
Copy link
Contributor

No description provided.

@nabeelmd-eGov nabeelmd-eGov requested a review from a team as a code owner September 23, 2024 05:07
Copy link
Contributor

coderabbitai bot commented Sep 23, 2024

Walkthrough

Walkthrough

The changes encompass various updates across multiple files, primarily focusing on CSS styling enhancements for the .digit-card-component and modifications to control flow in JavaScript methods. New styles are introduced for the header and text of digit cards, while logic adjustments in the LocalizationStore and SetupMaster components ensure proper data handling. Additionally, formatting improvements in the MDMS.js file enhance code readability without altering functionality.

Changes

File Path Change Summary
micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss Introduced new styles for .digit-card-header and .digit-card-text within the .homeWrapper class to enhance the visual presentation of digit card components.
micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localization/service.js Added a conditional statement in the get method of LocalizationStore to include "digit-tenants" in the newModules array based on tenant configuration.
micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js Made formatting changes for better alignment and spacing of object properties. Adjusted logic in PersistantStorage.set to incorporate tenant configuration without altering overall functionality.
micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js Introduced a guard clause in the select function to return false if MdmsRes is empty, preventing further processing of the response.

Possibly related PRs

  • Application Management Updated #1359: Updates to the application management system, potentially related to UI enhancements.
  • side bar #1384: Modifications to the SetupMaster component, relevant to the changes in the main PR.
  • css fix  #1399: CSS fixes and enhancements that directly relate to the styling changes in the main PR.
  • Side component #1410: Introduction of the .homeWrapper class and related styles aligns with the main PR's changes.
  • sandbox enhancement #1411: Enhancements to sandbox component styling, relevant to the CSS changes affecting employee-related components.

Suggested reviewers

  • jagankumar-egov

🐇 In the garden where the changes bloom,
New styles and logic dispel the gloom.
With headers bright and texts so clear,
The code now dances, full of cheer!
A hop, a skip, through lines so neat,
A rabbit's joy in every beat! 🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 999c855 and a6223cc.

Files ignored due to path filters (1)
  • micro-ui/web/micro-ui-internals/packages/css/package.json is excluded by !**/*.json
Files selected for processing (4)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localization/service.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js (6 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (1 hunks)
Additional context used
Path-based instructions (3)
micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localization/service.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (1)

Pattern **/*.js: check

Biome
micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/MDMS.js

[error] 1037-1037: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)


[error] 1047-1047: Avoid the use of spread (...) syntax on accumulators.

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

(lint/performance/noAccumulatingSpread)

Additional comments not posted (3)
micro-ui/web/micro-ui-internals/packages/libraries/src/services/elements/Localization/service.js (1)

50-52: Please provide context and consider potential implications.

The addition of the "digit-tenants" module for multi-root tenants lacks clear documentation. Could you please:

  1. Add a comment explaining the purpose and implications of this change?
  2. Confirm if this change aligns with the PR objectives (CSS Issue fix, localisation/mdms cache issue fix)?
  3. Ensure comprehensive testing to verify that this change doesn't introduce unexpected behavior in the localization process, especially for different tenant configurations.

To help verify the impact and usage of this change, please run the following script:

This will help us understand the broader context and ensure consistent implementation across the codebase.

Verification successful

Verification Successful: The addition of "digit-tenants" is consistent with its existing usage in the codebase. No unexpected behavior was identified from the script results.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of getMultiRootTenant() and references to "digit-tenants"

echo "Searching for getMultiRootTenant() usage:"
rg --type js "getMultiRootTenant\(\)"

echo "\nSearching for 'digit-tenants' references:"
rg --type js "digit-tenants"

Length of output: 7221

micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/sandbox.scss (1)

438-456: Overall assessment: Styles are consistent but could be optimized.

The changes to the .homeWrapper class introduce styles for .digit-card-component that are consistent with the existing styles for .digit-employee-card. This consistency is good for maintaining a uniform look across components.

However, there are opportunities to improve the CSS:

  1. Avoid using !important flags by refactoring to use more specific selectors or reorganizing the CSS structure.
  2. Consider using consistent and rounded values for font sizes (e.g., 2rem instead of 1.87rem).
  3. If these styles are meant to be shared between .digit-card-component and .digit-employee-card, consider creating a shared class or using a mixin to reduce code duplication.

These optimizations would improve the maintainability and flexibility of the stylesheet.

micro-ui/web/micro-ui-internals/packages/modules/sandbox/src/pages/employee/applicationMgmt/SetupMaster.js (1)

69-71: Good addition, but consider these improvements

The added check for empty MdmsRes is a good practice to prevent processing empty data. However, there are a few points to consider:

  1. Ensure that Lodash is properly imported if you're using _.isEmpty().
  2. The indentation of the new code block is inconsistent. Consider aligning it with the rest of the function.
  3. Returning false for empty data might affect the component's behavior. Ensure this is the intended outcome.

Consider applying these changes:

 select: (data) => {
-        if (_.isEmpty(data?.MdmsRes)) {
-          return false
-        }
+   if (_.isEmpty(data?.MdmsRes)) {
+     return false;
+   }
   const resp = data?.MdmsRes;
   const checkMasterDataCompleteness = Object.values(resp).every((category) =>
     Object.values(category).every((items) => items.every((item) => parseInt(item.count) > 0))
   );

Also, verify that Lodash is imported at the top of the file:

import _ from 'lodash';

To ensure Lodash is properly imported, run this script:

Comment on lines +438 to +447
.homeWrapper{
.digit-card-component{
.digit-card-header{
color: #0b4b66 !important;
font-size: 1.87rem !important;
text-align: center;
font-weight: 700;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring to avoid !important and use consistent font sizes.

The new styles for .digit-card-component within .homeWrapper are similar to the existing styles for .digit-employee-card. However, there are a few points to consider:

  1. The use of !important flags might indicate specificity issues. Consider refactoring the CSS to avoid using !important by increasing the specificity of the selectors.

  2. The font size of 1.87rem is unusual. For better maintainability and consistency, consider using a rounded value like 1.9rem or 2rem.

Here's a suggested refactoring:

.homeWrapper {
  .digit-card-component {
    .digit-card-header {
      color: #0b4b66;
      font-size: 2rem;
      text-align: center;
      font-weight: 700;
    }
  }
}

This change removes the !important flags and rounds the font size to 2rem for better consistency.

Comment on lines +449 to +456
.homeWrapper{
.digit-card-component{
.digit-card-text{
font-size: 1rem !important;
font-weight: 700;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider refactoring to avoid !important and improve selector specificity.

The new styles for .digit-card-text within .digit-card-component in .homeWrapper are consistent with the existing styles for .digit-employee-card. However, there's an opportunity for improvement:

  1. The use of !important flag on font-size might indicate specificity issues. Consider refactoring the CSS to avoid using !important by increasing the specificity of the selectors.

Here's a suggested refactoring:

.homeWrapper {
  .digit-card-component {
    .digit-card-text {
      font-size: 1rem;
      font-weight: 700;
    }
  }
}

This change removes the !important flag. If you still encounter specificity issues, consider using more specific selectors or reorganizing your CSS structure to avoid the need for !important.

@jagankumar-egov jagankumar-egov merged commit 15a5fbb into develop Sep 23, 2024
2 checks passed
@jagankumar-egov jagankumar-egov deleted the new-build-sandbox branch September 23, 2024 05:25
@nabeelmd-eGov nabeelmd-eGov restored the new-build-sandbox branch September 23, 2024 05:36
This was referenced Sep 30, 2024
@coderabbitai coderabbitai bot mentioned this pull request Oct 18, 2024
@coderabbitai coderabbitai bot mentioned this pull request Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants