Skip to content
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

Merged
merged 3 commits into from
Jun 10, 2020

Conversation

fhlavac
Copy link
Contributor

@fhlavac fhlavac commented Jun 10, 2020

This should fix the issue with multiple highlights when the sub-nav item name is already used by another top-level nav item.

001

Needed for: RedHatInsights/cloud-services-config#218

@karelhala

@codecov-commenter
Copy link

codecov-commenter commented Jun 10, 2020

Codecov Report

Merging #836 into master will not change coverage.
The diff coverage is 0.00%.

Impacted file tree graph

@@           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           
Impacted Files Coverage Δ
src/js/redux/reducers.js 40.74% <0.00%> (ø)

Copy link
Contributor

@karelhala karelhala left a 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})

@@ -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)
Copy link
Contributor

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?

Suggested change
|| (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))

@karelhala karelhala merged commit c12dcf2 into RedHatInsights:master Jun 10, 2020
karelhala pushed a commit to karelhala/insights-chrome that referenced this pull request Jun 10, 2020
* Fix highlight of duplicate sub-nav items

* Add parentId verification to highlight condition

* Add appNavClick - parentId param to docs
karelhala added a commit that referenced this pull request Jun 10, 2020
Fix highlight of duplicate sub-nav items (#836)
ryelo added a commit that referenced this pull request Jun 11, 2020
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants