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

Hlm 6350 #1100

Merged
merged 9 commits into from
Jul 18, 2024
Merged

Hlm 6350 #1100

merged 9 commits into from
Jul 18, 2024

Conversation

Bhavya-egov
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Warning

Rate limit exceeded

@Bhavya-egov has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 48 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 0b17108 and 7b3e48e.

Walkthrough

Walkthrough

The recent changes enhance the styling and functionality of the campaign page in the micro-UI project. CSS adjustments improve visual layout and alignment, while a new TimelineComponent React component is introduced for dynamic timeline display. These updates provide a refined user experience and better campaign process visualization.

Changes

Files Change Summary
.../css/src/pages/employee/campaign.scss Adjusted spacing, display properties, and alignment; added new classes and refined existing styles.
.../campaign-manager/src/pages/employee/MyCampaign.js Added imports for TimelineComponent and PopUp, introduced an unused searchParams variable, and added extra empty lines.
.../campaign-manager/src/components/TimelineComponent.js Introduced TimelineComponent for dynamic timeline rendering, including functions for formatting dates, fetching credentials, and displaying process details.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant MyCampaignPage
    participant TimelineComponent
    participant DataService

    User->>MyCampaignPage: Navigate to Campaign Page
    MyCampaignPage->>TimelineComponent: Render TimelineComponent
    TimelineComponent->>DataService: Fetch campaign data
    DataService-->>TimelineComponent: Return campaign data
    TimelineComponent-->>MyCampaignPage: Display timeline with processes
    MyCampaignPage-->>User: Show updated campaign page with timeline
Loading

Poem

In the realm of code so bright,
Changes bring a new delight.
Timelines dance, alignments true,
Campaigns now with clearer view.
🐇✨ CSS refined, components new,
For users, a journey fresh and due.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Caution

Inline review comments failed to post

Actionable comments posted: 5

Outside diff range, codebase verification and nitpick comments (2)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1)

Line range hint 495-504: Consider removing commented-out code.

The commented-out code related to user credentials and the download button should be removed if it's no longer needed to keep the codebase clean.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)

16-39: Consider removing commented-out onActionSelect function.

The commented-out onActionSelect function should be removed if it's no longer needed to keep the codebase clean.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e84fca8 and 682f38d.

Files ignored due to path filters (4)
  • micro-ui/web/micro-ui-internals/example/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/css/package.json is excluded by !**/*.json
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/package.json is excluded by !**/*.json
Files selected for processing (8)
  • micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (4 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (6 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (3 hunks)
Files skipped from review due to trivial changes (1)
  • micro-ui/web/micro-ui-internals/example/public/index.html
Additional context used
Path-based instructions (6)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (1)

Pattern **/*.js: check

Additional comments not posted (23)
micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss (6)

80-81: LGTM!

The margin-bottom property for .infoClass is set correctly.


83-83: LGTM!

The display property for .headerWrapperClassName is set correctly.


87-88: LGTM!

The margin-top and margin-bottom properties for .whoLogo are set correctly.


92-102: LGTM!

The properties for .digit-popup-wrapper and its nested elements are set correctly.


108-112: LGTM!

The properties for .timeline-div are set correctly.


121-125: LGTM!

The properties for .timeline-user are set correctly.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (1)

6-7: LGTM!

The imports for TimelineComponent and PopUp are added correctly.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (2)

30-30: LGTM!

The import for TimelineComponent is added correctly.


102-102: LGTM!

The TimelineComponent is included in the componentsToRegister object correctly.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js (2)

1-6: LGTM!

The imports are added correctly.


35-178: LGTM!

The rest of the TimelineComponent function is implemented correctly.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (2)

153-153: Correctly initialized isPreview state variable.

The isPreview state variable is correctly initialized based on the query parameter "preview".


225-241: Conditional rendering of TimelineComponent is correct.

The TimelineComponent is conditionally rendered based on the isPreview state variable. This is implemented correctly.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (7)

4-6: Correct imports for new components.

The new imports for Fragment, Button, PopUp, and TimelineComponent are correctly added.


107-107: Correctly added state management for timeLine.

The state management for timeLine is correctly added using React.useState.


109-130: Correctly redefined onActionSelect function.

The onActionSelect function is correctly redefined within the additionalCustomizations function to handle different actions.


148-164: Correct adjustments to Button component.

The adjustments to the Button component, including the addition of options and the onOptionSelect handler, are correctly implemented.


164-173: Correct conditional rendering of PopUp.

The PopUp component is correctly rendered conditionally based on the timeLine state.


345-369: Correctly added onActionSelect function for MyCampaignConfigUpcoming.

The onActionSelect function is correctly added within the additionalCustomizations function for MyCampaignConfigUpcoming.


386-411: Correct adjustments to Button component and conditional rendering of PopUp for MyCampaignConfigUpcoming.

The adjustments to the Button component and the conditional rendering of PopUp based on the timeLine state for MyCampaignConfigUpcoming are correctly implemented.

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/UploadData.js (3)

48-54: Correctly reformatted Digit.Hooks.useCustomMDMS function call.

The Digit.Hooks.useCustomMDMS function call is correctly reformatted for better readability without breaking functionality.


187-189: Correctly refactored convertIntoSchema call for facility.

The asynchronous convertIntoSchema call for facility is correctly refactored for better code clarity.


195-197: Correctly refactored convertIntoSchema call for user.

The asynchronous convertIntoSchema call for user is correctly refactored for better code clarity.

Comments failed to post (5)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js

31-31: Remove unused variable.

The searchParams variable is not used in the code and should be removed to avoid confusion.

-  const searchParams = new URLSearchParams(location.search);
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.



32-34: Remove extra empty lines.

The extra empty lines do not serve any purpose and should be removed to maintain code readability.

-  
-  
-  
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.


micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/TimelineComponent.js

84-86: Use a constant for interval time.

Using a constant for the interval time improves code readability and maintainability.

-    }, 60000); // 60000ms = 1 minute
+    }, INTERVAL_TIME); // 60000ms = 1 minute
const INTERVAL_TIME = 60000;

35-38: Import location.

The location object is used but not imported. Ensure it is imported to avoid runtime errors.

+ import { useLocation } from "react-router-dom";
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.

import { useLocation } from "react-router-dom";

const TimelineComponent = ({campaignId, resourceId}) => {
  const { t } = useTranslation();
  const tenantId = Digit.ULBService.getCurrentTenantId();
  const searchParams = new URLSearchParams(location.search);

8-33: Remove redundant comment.

The comment on line 9 is redundant and can be removed to improve code readability.

-  // Create a new Date object using the epoch time
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.

function epochToDateTime(epoch) {
  const date = new Date(epoch ); 
  // Extract the date components
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are 0-based, so add 1
  const day = String(date.getDate()).padStart(2, '0');
  
  // Extract the time components
  let hours = date.getHours();
  const minutes = String(date.getMinutes()).padStart(2, '0');
  const seconds = String(date.getSeconds()).padStart(2, '0');
  
  // Determine AM/PM and convert to 12-hour format
  const ampm = hours >= 12 ? 'PM' : 'AM';
  hours = hours % 12;
  hours = hours ? hours : 12; // the hour '0' should be '12'
  const formattedHours = String(hours).padStart(2, '0');
  
  // Format the date and time
  const formattedDate = `${day}/${month}/${year}`;
  const formattedTime = `${formattedHours}:${minutes}:${seconds} ${ampm}`;
  
  // Return the formatted date and time
  return `${formattedDate} ${formattedTime}`;
}

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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 682f38d and 0b17108.

Files selected for processing (2)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaign.scss
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 18, 2024
@@ -49,45 +104,41 @@ const TimelineComponent = ({}) => {

const completedTimelines = completedProcesses?.map(process => ({
label: t(formatLabel(process.type)),
subElements: [Digit.Utils.date.convertEpochToDate(process.lastModifiedTime)],
subElements: [epochToDateTime(process.lastModifiedTime)],
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep both date and time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the function is taking both date and time.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jul 18, 2024
@jagankumar-egov jagankumar-egov merged commit 8e56e75 into campaign Jul 18, 2024
2 of 4 checks passed
@jagankumar-egov jagankumar-egov deleted the HLM-6350 branch July 18, 2024 11:36
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.

2 participants