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

feat: [DHIS2-18250] Breadcrumb for event & enrollment pages #3849

Merged
merged 14 commits into from
Nov 13, 2024

Conversation

eirikhaugstulen
Copy link
Contributor

@eirikhaugstulen eirikhaugstulen commented Oct 17, 2024

Tech-summary:
Added two new components that helps the user navigate our app

  • EnrollmentBreadcrumb (Used on all enrollment pages
    • {programStageWorkingListName} / {workingListName} / {TET} list / {Search}
    • Enrollment dashboard
    • View event (if applicable)
    • Edit event (if applicable)
  • EventBreadcrumb (Old view and edit event pages)
    • Event list
    • View event
    • Edit event (if applicable)

@@ -73,6 +76,11 @@ export const EnrollmentEditEventPageComponent = ({
pageLayout={pageLayout}
currentPage={mode === EnrollmentPageKeys.EDIT_EVENT ? EnrollmentPageKeys.EDIT_EVENT : EnrollmentPageKeys.VIEW_EVENT}
availableWidgets={WidgetsForEnrollmentEventEdit}
userInteractionInProgress={mode === EnrollmentPageKeys.EDIT_EVENT}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably refactor this at some point, but just following the logic in src/core_modules/capture-core/components/Pages/EnrollmentEditEvent/TopBar.container.js

eirikhaugstulen and others added 4 commits October 17, 2024 19:30
* fix: use title instead of alt on missing icons

* chore: fix failing tests
## [101.12.1](v101.12.0...v101.12.1) (2024-10-16)

### Bug Fixes

* [DHIS2-17978] use title instead of alt on missing icons ([#3847](#3847)) ([b5940f2](b5940f2))
@eirikhaugstulen eirikhaugstulen force-pushed the eh/feat/DHIS2-18250-breadcrumb-navigation-bar branch from b90f061 to fe1a7b1 Compare October 17, 2024 17:32
…-breadcrumb-navigation-bar

# Conflicts:
#	i18n/en.pot
…t/DHIS2-18250-breadcrumb-navigation-bar

# Conflicts:
#	i18n/en.pot
#	src/core_modules/capture-core/components/Pages/MainPage/MainPage.component.js
@eirikhaugstulen eirikhaugstulen marked this pull request as ready for review October 29, 2024 22:52
@eirikhaugstulen eirikhaugstulen requested a review from a team as a code owner October 29, 2024 22:52
selected: page === EnrollmentPageKeys.NEW_EVENT,
condition: page === EnrollmentPageKeys.NEW_EVENT,
},
].filter(item => item.condition !== false)), [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think condition is a boolean, and then we can simplify this

Suggested change
].filter(item => item.condition !== false)), [
].filter(item => item.condition)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Good catch!

@eirikhaugstulen
Copy link
Contributor Author

Thanks for the review @simonadomnisoru & @henrikmv! Should be sorted now 🚀

Copy link
Contributor

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review @simonadomnisoru & @henrikmv! Should be sorted now 🚀

Looks great now 👏 !

@@ -9,29 +9,25 @@ import { useDispatch, useSelector } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { useTimeZoneConversion } from '@dhis2/app-runtime';
import {
useCommonEnrollmentDomainData,
useRuleEffects,
commitEnrollmentAndEvents,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: not your change, but can we remove the // $FlowFixMe on line 7 in this file?

Comment on lines +23 to +24
const workingListTemplates = useSelector(({ workingListsTemplates }) => workingListsTemplates?.teiList);
const workingListProgramId = useSelector(({ workingListsContext }) => workingListsContext?.teiList?.programIdView);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it looks like the two useSelector calls are rendered 10 times each whenever navigating to the dashboard for a TEI. Should this behavior be optimized?"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like workingListProgramId triggers one render and workingListTemplates triggers two. (One of each is batched, so they should only really trigger one rerender. Did you have any other experience, @henrikmv? Remember, if you want to see it the value triggers a rerender, you will have to wrap the console.log inside a useEffect.

@eirikhaugstulen
Copy link
Contributor Author

Thanks @henrikmv! Moving the issue to testing for now, but we can still continue discussing the rest of the comments 😊

Copy link

github-actions bot commented Nov 6, 2024

…t/DHIS2-18250-breadcrumb-navigation-bar

# Conflicts:
#	i18n/en.pot
Copy link

@geethaalwan geethaalwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully on 2.42,2.41.3,2.40.6,2.39.8 versions

@eirikhaugstulen eirikhaugstulen merged commit d65882e into master Nov 13, 2024
35 of 40 checks passed
@eirikhaugstulen eirikhaugstulen deleted the eh/feat/DHIS2-18250-breadcrumb-navigation-bar branch November 13, 2024 11:18
dhis2-bot added a commit that referenced this pull request Nov 13, 2024
# [101.16.0](v101.15.0...v101.16.0) (2024-11-13)

### Features

* [DHIS2-18250] Breadcrumb for event & enrollment pages ([#3849](#3849)) ([d65882e](d65882e))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 101.16.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants