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

Polio-1556 sub activities front end #1340

Conversation

quang-le
Copy link
Member

@quang-le quang-le commented May 30, 2024

Add new tab to polio

Related JIRA tickets : POLIO-1556

Self proofreading checklist

  • Did I use eslint and black formatters
  • Is my code clear enough and well documented
  • Are my typescript files well typed
  • New translations have been added or updated if new strings have been introduced in the frontend
  • My migrations file are included
  • Are there enough tests
  • Documentation has been included (for new feature)

Doc

comments in the code

Changes

  • Add useTableState hook
  • fix query key in useSaveCampaigns
  • Pass campaign as prop i.o getting it via formik context in ScopeInput
  • Add useFilteredDistricts hook to allow filtering on different scopes
  • Pass availableVaccines to scopes map to enable more flexible vaccine selection
  • Add new components
  • update polio dialog tabs
  • Modal validation:
    • name, start and end date are mandatory, other fields are optional
    • start and end date are checked against each other and against round dates
  • Scope: districts available for selection are computed from round scopes
  • Vaccines: for ppolio campaigns, the vaccines available are computed from the round vaccines
  • Deactivated snack bar on save because it would trigger a full re-render of the page which would reset the modal state and lose the active tab. Instead, the (sub)modal will stay open while saving (with a spinner), then close so the user returns to the tab with updated data

How to test

With a polio then a non-polio campaign:

  • go to sub-activities tab:
    • create, edit and delete sub-activities

Print screen / video

Screen.Recording.2024-05-30.at.15.40.32.mov

Notes

@mathvdh the sorting doens't seem to work. The params are sent to the API, but no sorting happens

quang-le added 8 commits May 28, 2024 09:24
…tivities-for-all-campaigns-polio-and-non-polio' into POLIO-1556_sub_activities_front_end
- make baseUrl optional in useTabs
- Add useTableState hook
- export polio viruses
- fix query key in useSaveCampaigns
- Pass campaign as prop i.o getting it via formik context
- Add useFilteredDistricts hook to allow filtering on different scopes
- Pass availableVaccines to scopes map to enable more flexible vaccine selection
- Add new components
- update polio dialog tabs
@quang-le quang-le changed the base branch from POLIO-1540-create-new-tab-sub-activities-for-all-campaigns-polio-and-non-polio to main May 30, 2024 13:47
@quang-le quang-le changed the base branch from main to POLIO-1540-create-new-tab-sub-activities-for-all-campaigns-polio-and-non-polio May 30, 2024 13:47
@quang-le quang-le requested a review from beygorghor May 30, 2024 13:52
quang-le added 2 commits May 31, 2024 10:28
- prevent modal from closing when clicking Confirm
- Show spinner while mutation is performed
- close modal onSuccess. This allows the mutation hook to invalidate the query key and make sure the data is refetched
Copy link
Collaborator

@beygorghor beygorghor left a comment

Choose a reason for hiding this comment

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

Nice ! Very clean a few remarks:

@madewulf madewulf added the release Should be released in production at next deploy label Jun 3, 2024
- fix spacing between input fields
@quang-le quang-le merged commit 3b7c90e into POLIO-1540-create-new-tab-sub-activities-for-all-campaigns-polio-and-non-polio Jun 3, 2024
3 checks passed
@quang-le quang-le deleted the POLIO-1556_sub_activities_front_end branch June 3, 2024 10:52
@kemar kemar added Released and removed release Should be released in production at next deploy labels Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants