-
Notifications
You must be signed in to change notification settings - Fork 19
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
Conversation
WalkthroughWalkthroughThe recent updates focus on enhancing the campaign manager module in the micro-ui web application. Key improvements include introducing new components like Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
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
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/hooks/services/useSearchCampaign.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/MyCampaign.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/index.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/Module.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CycleDetaisPreview.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/pages/employee/CycleConfiguration.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/CampaignConfig.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/UICustomizations.js (1)
Pattern
**/*.js
: checkmicro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/myCampaignConfig.js (1)
Pattern
**/*.js
: checkmicro-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 aboveuseSearchCampaign
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
) touseSearchCampaign
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 thatt("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 versions1.0.3-campaign
and1.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
: > 📝 NOTEThis 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 componentsCampaignSummary
andCycleDetaisPreview
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 ofCampaignSummary
andCycleDetaisPreview
to thecomponentsToRegister
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 theCycleDetaisPreview
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 ofuseState
anduseEffect
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 theUICustomizations
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 thetenantId
andmoduleName
in themyCampaignConfig
object are correctly implemented. This ensures that the configurations are correctly scoped to the intended tenant and module.
212-254
: > 📝 NOTEThis 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
: TheonClick
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 anid
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 thedata
is null or empty to enhance the user experience.
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"; |
There was a problem hiding this comment.
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.
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"; |
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, | ||
}, |
There was a problem hiding this comment.
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.
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} />; |
<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} |
There was a problem hiding this comment.
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.
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; |
There was a problem hiding this comment.
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.
const [tabData, setTabData] = useState( | ||
myCampaignConfig?.myCampaignConfig?.map((i, n) => ({ key: n, label: i.label, active: n === 0 ? true : false })) | ||
); |
There was a problem hiding this comment.
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.
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 })) | |
); |
...o-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignCard.js
Show resolved
Hide resolved
...i/web/micro-ui-internals/packages/modules/campaign-manager/src/components/CampaignSummary.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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
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
There was a problem hiding this 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
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
There was a problem hiding this 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
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 detailedHCM_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 theHCM_CAMPAIGN_CYCLE_CONFIGURE
configuration dynamic or externally configurable to accommodate different cycle configurations without modifying the code.
57-121
: Evaluate the possibility of making theHCM_CAMPAIGN_DELIVERY_DATA
configuration dynamic or externally configurable to allow for flexibility in defining delivery rules for different campaigns.
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js
Show resolved
Hide resolved
micro-ui/web/micro-ui-internals/packages/modules/campaign-manager/src/configs/previewConfig.js
Show resolved
Hide resolved
There was a problem hiding this 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
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
Summary by CodeRabbit
CampaignSummary
andCycleDetailsPreview
components for enhanced campaign management.CampaignCard
component.DetailsTable
component for customizable tables with summary rows.useSearchCampaign
custom hook for campaign search functionality.CycleConfiguration
.@egovernments/digit-ui-css
for styling consistency.