-
Notifications
You must be signed in to change notification settings - Fork 27
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
Customer Request #228421 [WEB ADMIN] Benificiary Reject and Dropout conditions changed as per State | Bug #222613 [WEB UI] : Prerak Edit | Aadhar Page | Back Button is not working #2240
base: release-2.8.1
Are you sure you want to change the base?
Conversation
WalkthroughThe changes introduce a new functional component named Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Profile
participant GetOptions
participant GetEnumValue
User->>Profile: Request to view beneficiaries
Profile->>GetOptions: Render with array, enumType, enumApiData
GetOptions->>GetEnumValue: Fetch labels for chips
GetEnumValue-->>GetOptions: Return labels
GetOptions-->>Profile: Render chips
Profile-->>User: Display beneficiaries with chips
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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
🧹 Outside diff range and nitpick comments (3)
apps/front-end/src/pages/admin/beneficiaries/Profile.js (3)
206-206
: Improved variable naming, but there's a typoThe variable naming has been improved for consistency and follows camelCase convention. However, there's a typo in
benificiary
that should be corrected.Consider changing
benificiary
tobeneficiary
for correct spelling:-const [benificiary, setBenificiary] = useState(); +const [beneficiary, setBeneficiary] = useState();Also applies to: 215-215, 217-217
Line range hint
465-489
: Improved status handling, but consider refactoring for readabilityThe
renderDropoutButton
function has been updated to handle more status cases, which improves its functionality. The use ofswitch (true)
allows for more complex conditions.Consider refactoring this function to improve readability. One approach could be to use an object lookup or a series of if-else statements. For example:
const renderDropoutButton = useMemo(() => { const status = benificiary?.result?.program_beneficiaries?.status; const dropoutEligibleStatuses = [ 'identified', 'ready_to_enroll', 'enrolled', 'approved_ip', 'activate', 'enrolled_ip_verified', 'sso_id_enrolled', 'sso_id_verified', null ]; const isEligibleForDropout = dropoutEligibleStatuses.includes(status) && (status !== 'enrolled' || state_name !== 'RAJASTHAN') && (status !== 'enrolled_ip_verified' || state_name !== 'RAJASTHAN') && (status !== 'sso_id_enrolled' || state_name === 'RAJASTHAN') && (status !== 'sso_id_verified' || state_name === 'RAJASTHAN'); if (isEligibleForDropout) { return ( <AdminTypo.Dangerbutton onPress={(e) => setIsOpenDropOut(true)} leftIcon={<IconByName name="UserUnfollowLineIcon" isDisabled />} > {t("MARK_AS_DROPOUT")} </AdminTypo.Dangerbutton> ); } return null; }, [benificiary, state_name, t]);This approach centralizes the logic and makes it easier to understand and maintain.
Line range hint
509-533
: Improved status handling, consider similar refactoringThe
renderRejectButton
function has been updated similarly torenderDropoutButton
, improving its functionality by handling more status cases.Consider applying a similar refactoring approach as suggested for
renderDropoutButton
to improve readability and maintainability. For example:const renderRejectButton = useMemo(() => { const status = benificiary?.result?.program_beneficiaries?.status; const rejectEligibleStatuses = [ 'identified', 'ready_to_enroll', 'enrolled', 'approved_ip', 'activate', 'enrolled_ip_verified', 'sso_id_enrolled', 'sso_id_verified', null ]; const isEligibleForReject = rejectEligibleStatuses.includes(status) && (status !== 'enrolled' || state_name !== 'RAJASTHAN') && (status !== 'enrolled_ip_verified' || state_name !== 'RAJASTHAN') && (status !== 'sso_id_enrolled' || state_name === 'RAJASTHAN') && (status !== 'sso_id_verified' || state_name === 'RAJASTHAN'); if (isEligibleForReject) { return ( <AdminTypo.Dangerbutton onPress={(e) => setIsOpenReject(true)} leftIcon={<IconByName name="UserUnfollowLineIcon" isDisabled />} > {t("REJECT")} </AdminTypo.Dangerbutton> ); } return null; }, [benificiary, state_name, t]);This refactoring would make the function more consistent with the suggested changes for
renderDropoutButton
and improve overall code maintainability.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
- apps/front-end/src/pages/admin/beneficiaries/Profile.js (16 hunks)
🧰 Additional context used
🔇 Additional comments (4)
apps/front-end/src/pages/admin/beneficiaries/Profile.js (4)
175-195
: New component looks good!The
GetOptions
component is well-structured and reusable. It efficiently renders a list of unique options as Chip components, utilizing existing utility functions and components.
197-202
: PropTypes are well-definedThe PropTypes for the
GetOptions
component are correctly specified, which is excellent for type checking and documentation.
1689-1689
: Correct usage of updated state variableThe error message display has been updated to use the corrected state variable name
aadhaarError
. This ensures that the error message will be displayed correctly.
Line range hint
1225-1229
: Verify the intentional removal ofisDisabled
propThe
isDisabled
prop has been removed from several Select components in the edit access modal. This change allows these components to be always enabled, regardless of theeditButton
state.Please confirm if this change is intentional. If not, consider re-adding the
isDisabled
prop to prevent unintended edits:-<Select +<Select + isDisabled={!editButton} selectedValue={status?.jan_aadhaar_card || ""} accessibilityLabel="Select" placeholder={status?.jan_aadhaar_card || "Select"} // ... other props >Apply this change to all affected Select components if necessary.
Also applies to: 1268-1272, 1307-1311, 1347-1351, 1387-1391, 1427-1431, 1468-1472
Quality Gate passedIssues Measures |
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
🧹 Outside diff range and nitpick comments (1)
apps/front-end/src/pages/front-end/facilitator/AadhaarDetails.js (1)
30-30
: LGTM! Consider parameterizing the navigation target.The addition of the
onPressBackButton
prop improves the component's navigation functionality, providing a clear way for users to return to the profile page. This is a good usability enhancement.Consider parameterizing the navigation target instead of hardcoding it. This would make the component more flexible and reusable. For example:
-onPressBackButton: () => navigate(`/profile`), +onPressBackButton: () => navigate(backUrl),Where
backUrl
could be passed as a prop or determined based on the component's context.
https://tracker.tekdi.net/issues/228421
https://tracker.tekdi.net/issues/222613
I have ensured that following
Pull Request Checklist
is taken care of before sending this PRSummary by CodeRabbit
New Features
GetOptions
component to render a list of chips based on provided data.Bug Fixes
Refactor