-
Notifications
You must be signed in to change notification settings - Fork 134
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
Fix highlight of duplicate sub-nav items #836
Conversation
Codecov Report
@@ Coverage Diff @@
## master #836 +/- ##
=======================================
Coverage 61.05% 61.05%
=======================================
Files 45 45
Lines 873 873
Branches 169 169
=======================================
Hits 533 533
Misses 277 277
Partials 63 63
|
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.
Looking good! Just one smaller improvement so apps can activate secondary items that are outside currently active app. Also would be nice to mention that in docs https://github.com/RedHatInsights/insights-chrome/blob/master/README.md#javascript-api
insights.chrome.appNavClick({id: 'ocp-on-aws', parentId: 'some-parent', secondaryNav: true})
src/js/redux/reducers.js
Outdated
@@ -54,7 +54,7 @@ export function appNavClick(state, { payload }) { | |||
globalNav: payload.custom ? state.globalNav && state.globalNav.map(item => ({ | |||
...item, | |||
active: payload && (item.id === payload.id || item.title === payload.id) | |||
|| (item.subItems && item.subItems.some(({ id }) => id === payload.id)) | |||
|| (item.subItems && item.subItems.some(({ id }) => id === payload.id) && item.id === state.appId) |
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.
Can you add payload parent here as well?
|| (item.subItems && item.subItems.some(({ id }) => id === payload.id) && item.id === state.appId) | |
|| (item.subItems && item.subItems.some(({ id }) => id === payload.id) && (item.id === state.appId || item.id === payload.parentId)) |
83c4b1b
to
0df15b6
Compare
* Fix highlight of duplicate sub-nav items * Add parentId verification to highlight condition * Add appNavClick - parentId param to docs
Fix highlight of duplicate sub-nav items (#836)
* Update all deps (#795) * Update PF and FEC deps to newest stable versions * Update all other deps to latest stable version * Fix linting errors * update case and split logout (#799) Co-authored-by: Karel Hala <[email protected]> * use a skeleton instead of logging in text (#792) * add en-us to automation platform link (#808) per james bailey on the customer portal side, this addition should resolve the issue with doc link in automation platform going to dead page. Co-authored-by: Ryan Long <[email protected]> * Bump @redhat-cloud-services/frontend-components-inventory (#809) * update sentry and add more apps (#802) * update sentry and add more apps * lint * Use direct imports of PF4 components (#814) * Bump @redhat-cloud-services/frontend-components from 1.0.24 to 1.0.28 (#815) * Add Catalog, Approval and Sources to about modal app list. (#834) * Update inv package to newest version 33 (#835) * Fix highlight of duplicate sub-nav items (#836) * Fix highlight of duplicate sub-nav items * Add parentId verification to highlight condition * Add appNavClick - parentId param to docs Co-authored-by: Ryan Long <[email protected]> Co-authored-by: Chris Budzilowicz <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Martin Maroši <[email protected]> Co-authored-by: Filip Hlavac <[email protected]>
This should fix the issue with multiple highlights when the sub-nav item name is already used by another top-level nav item.
Needed for: RedHatInsights/cloud-services-config#218
@karelhala