-
Notifications
You must be signed in to change notification settings - Fork 46
breadcum issue fixed in pgr service #2992
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
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughExpanded the breadcrumb display condition in the PGR employee UI to show the "Inbox" breadcrumb on both "inbox" and "complaint-details" routes within the employee page component. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Router
participant EmployeePage
participant Breadcrumbs
User->>Router: Navigate to route
Router->>EmployeePage: Render with current path
EmployeePage->>Breadcrumbs: Determine visibility (path includes "inbox" or "complaint-details")
alt Matches condition
Breadcrumbs-->>User: Show "Inbox" breadcrumb
else
Breadcrumbs-->>User: Hide "Inbox" breadcrumb
end
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration 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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
health/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/index.js
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
check
Files:
health/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/index.js
🧠 Learnings (1)
📚 Learning: 2024-11-07T11:02:33.520Z
Learnt from: rachana-egov
PR: egovernments/DIGIT-Frontend#1770
File: health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js:320-322
Timestamp: 2024-11-07T11:02:33.520Z
Learning: In `health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/pages/employee/viewVillage.js`, the `data?.additionalFields` object is guaranteed to be defined, so checking for its existence before accessing its keys is unnecessary.
Applied to files:
health/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/index.js
⏰ Context from checks skipped due to timeout of 10000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (actions)
🔇 Additional comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/pgr/src/pages/employee/index.js (1)
55-58
: Inbox breadcrumb now correctly appears on complaint-detailsExpanding the condition to include complaint-details ensures the trail becomes Home > Inbox > Complaint Details, which matches expected UX. This aligns with the PR objective.
internalLink: `/${window?.contextPath}/employee/pgr/inbox-v2`, | ||
content: t("PGR_INBOX"), | ||
show: location.pathname.includes("inbox"), | ||
show: location.pathname.includes("inbox") || location.pathname.includes("complaint-details"), | ||
}, |
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.
🧹 Nitpick (assertive)
Prefer route-aware matching (matchPath) over substring includes
Using includes on pathname can produce false positives and is brittle if routes evolve (e.g., inbox-v3 or localized paths). Suggest matching against the configured route patterns using react-router’s matchPath and the existing base path prop for consistency.
Apply this diff within the current segment to delegate to a named boolean:
- show: location.pathname.includes("inbox") || location.pathname.includes("complaint-details"),
+ show: showInboxCrumb,
Add the following supporting changes elsewhere in this file:
- Import:
import { matchPath } from "react-router-dom";
- Compute the booleans (place after useLocation and before the return):
const showInboxCrumb = Boolean(
matchPath(location.pathname, { path: `${path}/inbox-v2`, exact: false }) ||
matchPath(location.pathname, { path: `${path}/complaint-details/:id`, exact: false })
);
Summary by CodeRabbit