[OSDEV-2366] Add sidebar to the production location page#900
[OSDEV-2366] Add sidebar to the production location page#900protsack-stephan merged 9 commits intomainfrom
Conversation
React App | Jest test suite - Code coverage reportTotal: 41.66%Your code coverage diff: 0.21% ▴ ✅ All code changes are covered |
Dedupe Hub App | Unittest test suite - Code coverage reportTotal: 55.73%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Countries App | Unittest test suite - Code coverage reportTotal: 100%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Contricleaner App | Unittest test suite - Code coverage reportTotal: 98.75%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
Django App | Unittest test suite - Code coverage reportTotal: 81.97%Your code coverage diff: 0.00% ▴ ✅ All code changes are covered |
📝 WalkthroughWalkthroughAdds a "Jump to" sidebar to the Production Location page: three new SVG icon components, a dynamic NavBar that smooth-scrolls to sections, BackToSearch converted to an anchor (dispatches RESET_SINGLE_FACILITY and navigates to /facilities), sidebar made sticky via styles, plus tests and a release-note entry. (50 words) Changes
Sequence Diagram(s)mermaid mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
src/react/src/components/Icons/Overview.jsx (1)
5-17: Mark decorative SVGs as non-announced for assistive tech.This icon is used next to visible text labels, so it should be hidden from screen readers to avoid redundant output.
♿ Suggested tweak
<svg xmlns="http://www.w3.org/2000/svg" width={props.width || '24'} height={props.height || '24'} viewBox={props.viewBox || '0 0 24 24'} + aria-hidden="true" + focusable="false" fill="none" stroke="currentColor"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/react/src/components/Icons/Overview.jsx` around lines 5 - 17, This SVG is decorative and should be hidden from assistive tech: add aria-hidden="true" and focusable="false" to the <svg> element in Overview.jsx (and ensure those attributes are applied after or override the {...props} spread so consumers can't accidentally re-enable it), e.g., set aria-hidden and focusable on the SVG element and keep no title/role that would expose it.src/react/src/components/ProductionLocation/Sidebar/BackToSearch/BackToSearch.jsx (1)
29-29: Use the existing JSS class for icon styling instead of inline style.Line 29 applies rotation inline while
classes.iconalready exists in the paired styles module.♻️ Proposed cleanup
- <ArrowRightAlt style={{ transform: 'rotate(180deg)' }} /> + <ArrowRightAlt className={classes.icon} />🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/react/src/components/ProductionLocation/Sidebar/BackToSearch/BackToSearch.jsx` at line 29, The ArrowRightAlt icon is being rotated with an inline style instead of using the existing JSS rule; remove the inline style on the ArrowRightAlt element in BackToSearch.jsx and apply the pre-defined classes.icon className to the icon (ensure the icon JSX uses className={classes.icon}), and if the rotation rule is missing in the JSS for classes.icon, add the rotation there so styling is centralized.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx`:
- Line 92: The JSX references classes.sidebarContainer in
ProductionLocationDetailsContainer (Grid item at the top) but styles for
sidebarContainer are missing; add a matching rule named sidebarContainer to
ProductionLocationDetailsContainer/styles.js (or rename the JSX reference to an
existing class key) so the class is defined; ensure the new sidebarContainer
style includes the intended layout/spacing (e.g., width, padding/margin, or
responsive rules) to match the original design expectations.
In
`@src/react/src/components/ProductionLocation/Sidebar/BackToSearch/BackToSearch.jsx`:
- Around line 16-20: The onClick handler in BackToSearch.jsx currently always
calls event.preventDefault(), which blocks native modified-clicks; change the
onClick to only preventDefault and perform clearFacility() +
push(facilitiesRoute) when the user did a primary (left) click without modifier
keys (check event.button === 0 and ensure !event.metaKey && !event.ctrlKey &&
!event.shiftKey && !event.altKey), otherwise return and allow the browser to
handle Ctrl/Cmd/middle-clicks. Apply the same conditional fix to the other
similar click handler referenced around lines 24-27, keeping references to
clearFacility, push and facilitiesRoute.
In `@src/react/src/components/ProductionLocation/Sidebar/NavBar/NavBar.jsx`:
- Around line 15-27: The nav items never provide an active flag and the NavBar
component destructures `active`, so update the NavBar logic to track which item
is active locally: add a React state (e.g., `const [activeItem, setActiveItem] =
useState(...)`) in the NavBar component, derive `active` by comparing each
item's `to` or `label` with `activeItem` when rendering the `navItems` array,
and add an onClick that calls `setActiveItem(item.to)` (or similar) to toggle
active; ensure the render uses that computed `active` to apply the active class
instead of expecting `navItems` to include an `active` property.
- Around line 29-34: In handleClick, don't call event.preventDefault() before
confirming the target exists; instead extract the id from the to param, look up
the DOM node via document.getElementById(id), and only call
event.preventDefault() if element is found, then call element.scrollIntoView({
behavior: 'smooth', block: 'start' }); also guard id extraction (e.g., handle
cases where to is falsy) so handleClick returns early and lets default
navigation proceed when no element is present.
In `@src/react/src/components/ProductionLocation/Sidebar/NavBar/styles.js`:
- Around line 31-33: The active menu style currently sets color on
menuItemActive using `${theme.palette.primary.main}14`; change this to set
backgroundColor instead (i.e., replace the color property with backgroundColor
using the same translucent value derived from theme.palette.primary.main) so the
active row is highlighted as a background rather than changing text color; keep
the Object.freeze and existing value expression intact.
---
Nitpick comments:
In `@src/react/src/components/Icons/Overview.jsx`:
- Around line 5-17: This SVG is decorative and should be hidden from assistive
tech: add aria-hidden="true" and focusable="false" to the <svg> element in
Overview.jsx (and ensure those attributes are applied after or override the
{...props} spread so consumers can't accidentally re-enable it), e.g., set
aria-hidden and focusable on the SVG element and keep no title/role that would
expose it.
In
`@src/react/src/components/ProductionLocation/Sidebar/BackToSearch/BackToSearch.jsx`:
- Line 29: The ArrowRightAlt icon is being rotated with an inline style instead
of using the existing JSS rule; remove the inline style on the ArrowRightAlt
element in BackToSearch.jsx and apply the pre-defined classes.icon className to
the icon (ensure the icon JSX uses className={classes.icon}), and if the
rotation rule is missing in the JSS for classes.icon, add the rotation there so
styling is centralized.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 11ff5d21-6abc-4d6a-9af3-7042f47e0222
📒 Files selected for processing (12)
doc/release/RELEASE-NOTES.mdsrc/react/src/__tests__/components/NavBar.test.jssrc/react/src/__tests__/components/ProductionLocationDetailsBackToSearch.test.jssrc/react/src/components/Icons/GeneralInformation.jsxsrc/react/src/components/Icons/OperationalDetails.jsxsrc/react/src/components/Icons/Overview.jsxsrc/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsxsrc/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/styles.jssrc/react/src/components/ProductionLocation/Sidebar/BackToSearch/BackToSearch.jsxsrc/react/src/components/ProductionLocation/Sidebar/BackToSearch/styles.jssrc/react/src/components/ProductionLocation/Sidebar/NavBar/NavBar.jsxsrc/react/src/components/ProductionLocation/Sidebar/NavBar/styles.js
...ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx
Outdated
Show resolved
Hide resolved
src/react/src/components/ProductionLocation/Sidebar/BackToSearch/BackToSearch.jsx
Show resolved
Hide resolved
VadimKovalenkoSNF
left a comment
There was a problem hiding this comment.
Good work, approved!
…OSDEV-2366-add-sidebar
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx (1)
94-98: Consider using adivorBoxinstead ofGridfor the sidebar wrapper.The
<Grid>element here has nocontaineroritemprops and doesn't participate in the Grid layout system—it's purely a styled wrapper. While this works, using a plaindiv(or MUI'sBox) would be more semantically appropriate and avoid any confusion about Grid layout intent.Regarding the SonarCloud PropTypes warning for
classes.sidebar: this is common withwithStylesHOCs where theclassesshape is auto-generated. Adding explicit PropTypes for each class key is optional but can be considered if the project enforces strict PropTypes validation.♻️ Optional: Use div instead of Grid
- <Grid className={classes.sidebar}> + <div className={classes.sidebar}> <NavBar /> <ContributeFields osId={osID} /> <SupplyChain /> - </Grid> + </div>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx` around lines 94 - 98, The sidebar wrapper uses MUI Grid but isn't a Grid container/item—replace the <Grid className={classes.sidebar}> in ProductionLocationDetailsContainer with a semantic wrapper (either a plain div or MUI Box) to avoid implying Grid layout; update imports (remove Grid if unused) and keep the class reference as className={classes.sidebar} so NavBar, ContributeFields, and SupplyChain remain children. Also address the SonarCloud PropTypes warning by adding an explicit PropTypes definition for the injected classes (e.g., PropTypes.shape({...sidebar: PropTypes.string.isRequired, ...})) on ProductionLocationDetailsContainer or relax the rule if project policy allows.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx`:
- Around line 94-98: The sidebar wrapper uses MUI Grid but isn't a Grid
container/item—replace the <Grid className={classes.sidebar}> in
ProductionLocationDetailsContainer with a semantic wrapper (either a plain div
or MUI Box) to avoid implying Grid layout; update imports (remove Grid if
unused) and keep the class reference as className={classes.sidebar} so NavBar,
ContributeFields, and SupplyChain remain children. Also address the SonarCloud
PropTypes warning by adding an explicit PropTypes definition for the injected
classes (e.g., PropTypes.shape({...sidebar: PropTypes.string.isRequired, ...}))
on ProductionLocationDetailsContainer or relax the rule if project policy
allows.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 86970899-f5b2-4f3d-a407-b988d3a330e8
📒 Files selected for processing (1)
src/react/src/components/ProductionLocation/ProductionLocationDetailsContainer/ProductionLocationDetailsContainer.jsx



Redesign the sidebar navigation ("Jump to") with custom SVG icons (Overview, General Information, Operational Details) and smooth-scroll click handling.
Restyle the "Back to search results" link, replace the MUI
Button+ArrowBackwith a plain<a>tag and a rotatedArrowRightAlticon and make the sidebar sticky so it stays visible while scrolling the production location detailsChanges:
Icons/Overview,Icons/GeneralInformation,Icons/OperationalDetailsNavBarwith declarativenavItemsarray, scroll-into-view on click, new styles with hover/active statesBackToSearchcomponent switched from<Button>to<a>, simplified stylesProductionLocationDetailsContainerwrapped sidebar content in a sticky container.NavBarandBackToSearch