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-5334: UI fixes, Preview screen added #250

Merged
merged 11 commits into from
Apr 3, 2024
Merged

Conversation

nabeelmd-eGov
Copy link
Contributor

@nabeelmd-eGov nabeelmd-eGov commented Apr 2, 2024

Summary by CodeRabbit

  • New Features
    • Introduced CampaignSummary and CycleDetailsPreview components for enhanced campaign management.
    • Added new actions "Test Preview Campaign" and "Test My Campaign" in the CampaignCard component.
    • Implemented a DetailsTable component for customizable tables with summary rows.
    • Introduced a useSearchCampaign custom hook for campaign search functionality.
  • Style
    • Added new CSS classes and styling rules for improved UI in the campaign management module.
  • Refactor
    • Updated configurations in the campaign management module for better flexibility and customization.
    • Adjusted session management for date ranges in CycleConfiguration.
  • Chores
    • Updated version of @egovernments/digit-ui-css for styling consistency.

Copy link
Contributor

coderabbitai bot commented Apr 2, 2024

Walkthrough

Walkthrough

The recent updates focus on enhancing the campaign manager module in the micro-ui web application. Key improvements include introducing new components like CampaignSummary and CycleDetailsPreview for better campaign and cycle visualization, adding a custom hook for campaign search functionality, updating UI styling across various employee pages, and refining configurations and action options to enhance user experience and functionality.

Changes

Files Change Summary
.../micro-ui/web/micro-ui-internals/example/public/index.html, .../web/public/index.html Updated @egovernments/digit-ui-css version.
.../css/src/pages/employee/campaignCycle.scss, .../css/src/pages/employee/index.scss Added new CSS classes and styling rules for components.
.../modules/campaign-manager/src/Module.js, .../modules/campaign-manager/src/components/CampaignCard.js Registered new components and expanded action options in CampaignCard.
.../modules/campaign-manager/src/components/CampaignSummary.js, .../modules/campaign-manager/src/components/CycleDetaisPreview.js, .../modules/campaign-manager/src/components/DetailsTable.js Introduced new components for detailed campaign and cycle views.
.../modules/campaign-manager/src/configs/... Updated campaign configurations and UI customizations.
.../modules/campaign-manager/src/hooks/..., .../modules/campaign-manager/src/hooks/services/useSearchCampaign.js Added useSearchCampaign custom hook for campaign search functionality using react-query.
.../modules/campaign-manager/src/pages/employee/CycleConfiguration.js, .../modules/campaign-manager/src/pages/employee/MyCampaign.js, .../modules/campaign-manager/src/pages/employee/index.js Adjusted session data management, tab data initialization, and added CampaignSummary to a new route.

Poem

Among lines of code and digital sprites,
A rabbit danced through bugs and bytes.
With each hop, a change unfurled,
In campaign realms where data whirled.
🌟 "For better UIs, let's bound and play," it cried,
As features fresh and fixes stride.
"Let's rejoice," it hopped with glee,
"For campaigns improved, for you and me!" 🚀

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

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

CodeRabbit Configration 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/coderabbit-overrides.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: 7

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4fc29c7 and cde7444.
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 (17)
  • micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/campaignCycle.scss (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (1 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/CampaignCard.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDetaisPreview.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DetailsTable.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/CampaignConfig.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js (9 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/index.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/useSearchCampaign.js (1 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CycleConfiguration.js (3 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (2 hunks)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (2 hunks)
  • micro-ui/web/public/index.html (1 hunks)
Files skipped from review due to trivial changes (2)
  • micro-ui/web/micro-ui-internals/example/public/index.html
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/DetailsTable.js
Additional Context Used
Path-based Instructions (12)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/index.js (1)

Pattern **/*.js: check

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

Pattern **/*.js: check

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/components/CampaignCard.js (1)

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.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/CycleDetaisPreview.js (1)

Pattern **/*.js: check

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

Pattern **/*.js: check

micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/CampaignConfig.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/configs/myCampaignConfig.js (1)

Pattern **/*.js: check

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

Pattern **/*.js: check

Additional comments not posted (19)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/index.js (1)

15-15: Add a brief comment above useSearchCampaign explaining its purpose or functionality for better code readability and maintainability.

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

19-20: Validate the inputs (tenantId, filter, pagination) to useSearchCampaign to ensure they meet expected formats or conditions before proceeding with the query.

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

25-25: Ensure that t("CAMPAIGN_SEARCH_TITLE") is correctly defined in your localization files to avoid displaying an untranslated key to the user.

micro-ui/web/public/index.html (1)

13-14: Confirm that the versions 1.0.3-campaign and 1.8.2-coreui.1 of @egovernments/digit-ui-css are correct and available. It's also important to ensure that these versions do not conflict with each other.

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

33-104: Ensure that the new CSS classes do not conflict with existing styles or classes. It's also a good practice to check for responsiveness and cross-browser compatibility of these styles.

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

27-33: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [30-46]

Confirm that the CampaignSummary component is correctly registered in the ComponentRegistryService to avoid runtime errors when navigating to the /preview route.

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

204-207: Verify that the .search-button-wrapper class's properties do not cause layout issues in different screen sizes or browsers. It may be beneficial to test this in a responsive design checker.

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

16-17: Ensure the newly added components CampaignSummary and CycleDetaisPreview are properly imported and their paths are correct. This is crucial for the components to be registered and used within the module.


53-54: The addition of CampaignSummary and CycleDetaisPreview to the componentsToRegister object is correctly implemented. This will allow these components to be dynamically loaded and used within the application.

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

1-113: The implementation of the CycleDetaisPreview component is well-structured and follows React component best practices. Ensure that all data passed to this component is properly validated upstream to prevent any potential issues.

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

56-64: The use of useState and useEffect for managing session data and date ranges is correctly implemented. This approach ensures that the component's state is updated based on session data changes.

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

200-217: The addition of a new object for the campaign preview component is correctly implemented. This configuration aligns with the PR objectives of enhancing the campaign management process.

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

14-249: The expansion of the UICustomizations object to include configurations for different campaign types is well-implemented. Ensure that all custom functions and data manipulations are thoroughly tested to prevent any unintended behavior.

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

2-3: The updates to the tenantId and moduleName in the myCampaignConfig object are correctly implemented. This ensures that the configurations are correctly scoped to the intended tenant and module.


212-254: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [7-381]

Ensure that all labels and field names updated in the myCampaignConfig object are consistent with the application's i18n standards for localization. This is crucial for maintaining a consistent user experience across different languages.

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

29-31: The onClick handler directly modifies the history object without any validation or error handling. Consider wrapping navigation logic in a function that includes error handling to prevent potential navigation issues.


423-425: The loading state is correctly handled by rendering a <Loader /> component. This is a good practice for improving user experience during asynchronous operations.


427-437: The conditional rendering based on the absence of an id is a good practice for handling different states of the component. However, ensure that the user is informed about why they are seeing this alternative view, possibly by adding a message or alert.


440-448: The final return statement correctly renders the component's UI based on the loaded data. The use of <React.Fragment> and <ViewComposer> is appropriate for this scenario. However, consider adding a fallback or error message if the data is null or empty to enhance the user experience.

Comment on lines 1 to 5
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { EditIcon, Header, Loader, ViewComposer } from "@egovernments/digit-ui-react-components";
// import { previewConfig } from "../configs/previewConfig";
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider removing the commented-out import statement on line 5 if it's no longer needed. Keeping the codebase clean from unused code is a good practice for maintainability.

- // import { previewConfig } from "../configs/previewConfig";

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.

Suggested change
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { EditIcon, Header, Loader, ViewComposer } from "@egovernments/digit-ui-react-components";
// import { previewConfig } from "../configs/previewConfig";
import React, { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { EditIcon, Header, Loader, ViewComposer } from "@egovernments/digit-ui-react-components";

Comment on lines 14 to 138
key: "CAMPAIGN_NAME",
value: data?.[0]?.campaignName || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_START_DATE",
value: Digit.Utils.date.convertEpochToDate(data?.[0]?.campaignDetails?.startDate) || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_END_DATE",
value: Digit.Utils.date.convertEpochToDate(data?.[0]?.campaignDetails?.endDate) || t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
{
sections: [
{
type: "DATA",
cardHeader: { value: t("TARGET_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(2)}>
<EditIcon />
</div>
),
values: [
{
key: "CAMPAIGN_TYPE",
value: data?.[0]?.hierarchyType || t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
...data?.[0]?.campaignDetails?.deliveryRules?.map((item, index) => ({
sections: [
{
type: "COMPONENT",
cardHeader: { value: t("DELIVERY_CYCLE_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
component: "CycleDetaisPreview",
props: {
data: data?.[0],
item: item,
index: index,
},
// values: [
// {
// key: "CAMPAIGN_TYPE",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// {
// key: "CAMPAIGN_NAME",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// {
// key: "CAMPAIGN_START_DATE",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// {
// key: "CAMPAIGN_END_DATE",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// ],
},
],
})),
{
sections: [
{
type: "DATA",
cardHeader: { value: t("DELIVERY_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
values: [
{
key: "CAMPAIGN_TYPE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_NAME",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_START_DATE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_END_DATE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
],
};
},
staleTime: 0,
cacheTime: 0,
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling for the useSearchCampaign hook. While the loading state is handled, there seems to be no explicit handling for potential errors that could arise from the API call. Consider adding error handling to improve the robustness of the component.

+ const { isLoading, data, error } = Digit.Hooks.campaign.useSearchCampaign({
...
+ if (error) return <ErrorComponent message={error.message} />;

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.

Suggested change
const { isLoading, data } = Digit.Hooks.campaign.useSearchCampaign({
tenantId: tenantId,
filter: {
ids: [id],
},
config: {
select: (data) => {
return {
cards: [
{
sections: [
{
type: "DATA",
cardHeader: { value: t("CAMPAIGN_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(1)}>
<EditIcon />
</div>
),
values: [
{
key: "CAMPAIGN_TYPE",
value: data?.[0]?.projectType || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_NAME",
value: data?.[0]?.campaignName || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_START_DATE",
value: Digit.Utils.date.convertEpochToDate(data?.[0]?.campaignDetails?.startDate) || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_END_DATE",
value: Digit.Utils.date.convertEpochToDate(data?.[0]?.campaignDetails?.endDate) || t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
{
sections: [
{
type: "DATA",
cardHeader: { value: t("TARGET_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(2)}>
<EditIcon />
</div>
),
values: [
{
key: "CAMPAIGN_TYPE",
value: data?.[0]?.hierarchyType || t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
...data?.[0]?.campaignDetails?.deliveryRules?.map((item, index) => ({
sections: [
{
type: "COMPONENT",
cardHeader: { value: t("DELIVERY_CYCLE_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
component: "CycleDetaisPreview",
props: {
data: data?.[0],
item: item,
index: index,
},
// values: [
// {
// key: "CAMPAIGN_TYPE",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// {
// key: "CAMPAIGN_NAME",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// {
// key: "CAMPAIGN_START_DATE",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// {
// key: "CAMPAIGN_END_DATE",
// value: t("CAMPAIGN_SUMMARY_NA"),
// },
// ],
},
],
})),
{
sections: [
{
type: "DATA",
cardHeader: { value: t("DELIVERY_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
values: [
{
key: "CAMPAIGN_TYPE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_NAME",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_START_DATE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_END_DATE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
],
};
},
staleTime: 0,
cacheTime: 0,
},
const { isLoading, data, error } = Digit.Hooks.campaign.useSearchCampaign({
tenantId: tenantId,
filter: {
ids: [id],
},
config: {
select: (data) => {
return {
cards: [
{
sections: [
{
type: "DATA",
cardHeader: { value: t("CAMPAIGN_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(1)}>
<EditIcon />
</div>
),
values: [
{
key: "CAMPAIGN_TYPE",
value: data?.[0]?.projectType || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_NAME",
value: data?.[0]?.campaignName || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_START_DATE",
value: Digit.Utils.date.convertEpochToDate(data?.[0]?.campaignDetails?.startDate) || t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_END_DATE",
value: Digit.Utils.date.convertEpochToDate(data?.[0]?.campaignDetails?.endDate) || t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
{
sections: [
{
type: "DATA",
cardHeader: { value: t("TARGET_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: (
<div onClick={() => handleRedirect(2)}>
<EditIcon />
</div>
),
values: [
{
key: "CAMPAIGN_TYPE",
value: data?.[0]?.hierarchyType || t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
...data?.[0]?.campaignDetails?.deliveryRules?.map((item, index) => ({
sections: [
{
type: "COMPONENT",
cardHeader: { value: t("DELIVERY_CYCLE_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
component: "CycleDetaisPreview",
props: {
data: data?.[0],
item: item,
index: index,
},
},
],
})),
{
sections: [
{
type: "DATA",
cardHeader: { value: t("DELIVERY_DETAILS"), inlineStyles: { marginTop: 0 } },
cardSecondaryAction: <EditIcon />,
values: [
{
key: "CAMPAIGN_TYPE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_NAME",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_START_DATE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
{
key: "CAMPAIGN_END_DATE",
value: t("CAMPAIGN_SUMMARY_NA"),
},
],
},
],
},
],
};
},
staleTime: 0,
cacheTime: 0,
},
if (error) return <ErrorComponent message={error.message} />;

Comment on lines +117 to +129
<TextInput
type="date"
value={cycleData?.find((j) => j.key === index + 1)?.fromDate}
min={dateRange?.startDate}
max={dateRange?.endDate}
onChange={(d) => selectFromDate(index + 1, d)}
/>
{console.log("cycleData?.find((j) => j.key === index + 1)?.toDate", cycleData?.find((j) => j.key === index + 1)?.fromDate)}
<TextInput
type="date"
value={cycleData?.find((j) => j.key === index + 1)?.toDate}
min={cycleData?.find((j) => j.key === index + 1)?.fromDate}
max={dateRange?.endDate}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider validating the date inputs to ensure they fall within the expected range before allowing the form submission. This can prevent potential issues with campaign configurations that have invalid date ranges.

Comment on lines +3 to +16
const searchCampaignService = async ({ tenantId, filter, pagination }) => {
const response = await Digit.CustomService.getResponse({
url: "/project-factory/v1/project-type/search",
body: {
CampaignDetails: {
tenantId: tenantId,
...filter,
pagination: {
...pagination,
},
},
},
});
return response?.CampaignDetails;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper error handling in searchCampaignService. Consider adding a try-catch block around the API call to handle potential errors gracefully.

Comment on lines 14 to 16
const [tabData, setTabData] = useState(
myCampaignConfig?.myCampaignConfig?.map((i, n) => ({ key: n, label: i.label, active: n === 0 ? true : false }))
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using a more descriptive variable name than i and n in the map function for better readability.

- myCampaignConfig?.myCampaignConfig?.map((i, n) => ({ key: n, label: i.label, active: n === 0 ? true : false }))
+ myCampaignConfig?.myCampaignConfig?.map((configItem, index) => ({ key: index, label: configItem.label, active: index === 0 ? true : false }))

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.

Suggested change
const [tabData, setTabData] = useState(
myCampaignConfig?.myCampaignConfig?.map((i, n) => ({ key: n, label: i.label, active: n === 0 ? true : false }))
);
const [tabData, setTabData] = useState(
myCampaignConfig?.myCampaignConfig?.map((configItem, index) => ({ key: index, label: configItem.label, active: index === 0 ? true : false }))
);

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 Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between cde7444 and 2a9c7cd.
Files selected for processing (2)
  • micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
  • micro-ui/web/public/index.html (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • micro-ui/web/micro-ui-internals/example/public/index.html
  • micro-ui/web/public/index.html

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 Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 2a9c7cd and ad9c4fd.
Files selected for processing (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js

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

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ad9c4fd and 3838a86.
Files selected for processing (2)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js (1 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 (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js
Additional Context Used
Path-based Instructions (1)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js (1)

Pattern **/*.js: check

Additional comments not posted (4)
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js (4)

2-6: Consider making the campaign start and end dates dynamic or externally configurable to accommodate different campaign periods without needing to modify the code.


8-31: Verify if the detailed HCM_CAMPAIGN_TYPE configuration is necessary within this file, or if it could be fetched from an external source to improve maintainability and flexibility.


37-55: Consider making the HCM_CAMPAIGN_CYCLE_CONFIGURE configuration dynamic or externally configurable to accommodate different cycle configurations without modifying the code.


57-121: Evaluate the possibility of making the HCM_CAMPAIGN_DELIVERY_DATA configuration dynamic or externally configurable to allow for flexibility in defining delivery rules for different campaigns.

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 Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3838a86 and 7a4f743.
Files selected for processing (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js

@jagankumar-egov jagankumar-egov merged commit 0806166 into campaign Apr 3, 2024
2 checks passed
@jagankumar-egov jagankumar-egov deleted the HLM-5334 branch April 3, 2024 05:41
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