Conversation
|
ec4889c to
c31fd50
Compare
frozenhelium
left a comment
There was a problem hiding this comment.
P.S. I have not verified the UI, do we have the design for this?
| export type ReadinessList = Array<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]> & { | ||
| eruOwner: NonNullable<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]>['eru_readiness']>[0]['eru_owner_details']; | ||
| updatedAt: NonNullable<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]>['eru_readiness']>[0]['updated_at']; |
There was a problem hiding this comment.
| export type ReadinessList = Array<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]> & { | |
| eruOwner: NonNullable<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]>['eru_readiness']>[0]['eru_owner_details']; | |
| updatedAt: NonNullable<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]>['eru_readiness']>[0]['updated_at']; | |
| export type ReadinessList = Array<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[number]> & { | |
| eruOwner: NonNullable<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]>['eru_readiness']>[number]['eru_owner_details']; | |
| updatedAt: NonNullable<NonNullable<NonNullable<GetEruReadinessTypeResponse['results']>[0]>['eru_readiness']>[number]['updated_at']; |
| import i18n from './i18n.json'; | ||
|
|
||
| type GetEruReadinessResponse = GoApiResponse<'/api/v2/eru-readiness-type/'>; | ||
| type GetEruReadinessTypeResponse = GoApiResponse<'/api/v2/eru-readiness-type/'>; |
There was a problem hiding this comment.
| type GetEruReadinessTypeResponse = GoApiResponse<'/api/v2/eru-readiness-type/'>; | |
| type EruReadinessTypeResponse = GoApiResponse<'/api/v2/eru-readiness-type/'>; |
| {isDefined(groupedByNsContribution?.[HOLDSERU]) && ( | ||
| <ListView | ||
| layout="block" | ||
| spacing="2xs" | ||
| > | ||
| <Heading level={6}> | ||
| {strings.eruHoldingERUTitle} | ||
| </Heading> | ||
| {groupedByNsContribution?.[HOLDSERU]?.map((readiness) => ( | ||
| <Container | ||
| key={readiness.id} | ||
| heading={ | ||
| readiness.eruOwner | ||
| .national_society_country_details.society_name | ||
| } | ||
| headingLevel={5} | ||
| withDarkBackground | ||
| withPadding | ||
| > | ||
| <ListView | ||
| layout="grid" | ||
| numPreferredGridColumns={3} | ||
| minGridColumnSize="6rem" | ||
| > | ||
| <ReadinessIcon | ||
| readinessType={readiness.equipment_readiness} | ||
| label={strings.eruEquipmentReadiness} | ||
| /> | ||
| <ReadinessIcon | ||
| readinessType={readiness.people_readiness} | ||
| label={strings.eruPeopleReadiness} | ||
| /> | ||
| <ReadinessIcon | ||
| readinessType={readiness.funding_readiness} | ||
| label={strings.eruFundingReadiness} | ||
| /> | ||
| </ListView> | ||
| </Container> | ||
| ))} | ||
| </ListView> | ||
| )} |
There was a problem hiding this comment.
Heading 5 after Heading 6 looks semantically incorrect, lets try to restructure this in the patter which also makes sense semantically
eg:
<Container headingLevel={5}>
<ListView>
<Container headingLevel={6}>
{...}
</Container>
</ListView>
</Container>
| <Heading level={6}> | ||
| {strings.eruSupportERUTitle} | ||
| </Heading> | ||
| {groupedByNsContribution?.[SUPPORTERU]?.map((readiness) => ( | ||
| <Container | ||
| key={readiness.id} | ||
| heading={ | ||
| readiness.eruOwner | ||
| .national_society_country_details.society_name | ||
| } | ||
| headingLevel={5} | ||
| withDarkBackground | ||
| withPadding | ||
| > | ||
| <ListView | ||
| layout="grid" | ||
| numPreferredGridColumns={3} | ||
| minGridColumnSize="6rem" | ||
| > | ||
| <ReadinessIcon | ||
| readinessType={readiness.equipment_readiness} | ||
| label={strings.eruEquipmentReadiness} | ||
| /> | ||
| <ReadinessIcon | ||
| readinessType={readiness.people_readiness} | ||
| label={strings.eruPeopleReadiness} | ||
| /> | ||
| <ReadinessIcon | ||
| readinessType={readiness.funding_readiness} | ||
| label={strings.eruFundingReadiness} | ||
| /> | ||
| </ListView> | ||
| </Container> | ||
| ))} | ||
| </ListView> | ||
| )} |
There was a problem hiding this comment.
Let's restructure to make it semantically correct as well
| {isDefined(groupedByNsContribution?.[HOLDSERU]) && ( | ||
| <ListView | ||
| layout="block" | ||
| spacing="2xs" | ||
| > | ||
| <Heading level={6}> | ||
| {strings.emergencyHoldingERUTitle} | ||
| </Heading> | ||
| {groupedByNsContribution?.[HOLDSERU]?.map((eruType) => ( | ||
| <Container | ||
| key={eruType.id} | ||
| heading={eruType.type_display} | ||
| headingLevel={5} | ||
| withDarkBackground | ||
| withPadding | ||
| > | ||
| <ListView | ||
| layout="grid" | ||
| minGridColumnSize="6rem" | ||
| numPreferredGridColumns={3} | ||
| > | ||
| <ReadinessIcon | ||
| readinessType={eruType.equipment_readiness} | ||
| label={strings.eruNSEquipmentReadiness} | ||
| /> | ||
| <ReadinessIcon | ||
| readinessType={eruType.people_readiness} | ||
| label={strings.eruNSPeopleReadiness} | ||
| /> | ||
| <ReadinessIcon | ||
| readinessType={eruType.funding_readiness} | ||
| label={strings.eruNSFundingReadiness} | ||
| /> | ||
| </ListView> | ||
| </Container> | ||
| ))} | ||
| </ListView> |
There was a problem hiding this comment.
Let's restructure to make it semantically correct as well
app/src/utils/constants.ts
Outdated
| export const HOLDSERU = 1 satisfies TypeOfNsContributionEnum; | ||
| export const SUPPORTERU = 2 satisfies TypeOfNsContributionEnum; |
There was a problem hiding this comment.
| export const HOLDSERU = 1 satisfies TypeOfNsContributionEnum; | |
| export const SUPPORTERU = 2 satisfies TypeOfNsContributionEnum; | |
| export const NS_CONTRIBUTION_HOLDS_ERU = 1 satisfies TypeOfNsContributionEnum; | |
| export const NS_CONTRIBUTION_SUPPORTS_ERU = 2 satisfies TypeOfNsContributionEnum; |
There was a problem hiding this comment.
We will need to regenerate this
| nationalSocieties: joinStrings(unique(item.readinessList.map((v) => ( | ||
| v.eruOwner.national_society_country_details.society_name | ||
| v.ns_contribution === HOLDSERU | ||
| ? v.eruOwner.national_society_country_details.society_name | ||
| : undefined | ||
| ))).filter(isDefined)), |
There was a problem hiding this comment.
This expression will be clearer if we apply filter first, to extract societies with the required condition and then apply mapping by the society name
| function contributionLabelSelector(option: ContributionOption) { | ||
| return option.value; | ||
| } |
There was a problem hiding this comment.
We should be able to re-use something like stringValueSelector here
| function contributionKeySelector(option: ContributionOption) { | ||
| return option.key; | ||
| } |
There was a problem hiding this comment.
If key is not enum, we should be able to re-use existing key selectors from utils/selectors
There was a problem hiding this comment.
using existing key selectors gave error so not making any changes.
a56f597 to
ccd18ff
Compare
You can see the updated ERU section in Figma, and for more context there's a ticket linked in the PR description. |
- add options to select contribution type in update ERU form
- group list from ns contribution in readiness info modal
- filter national societies in ERU Type card to only which holds the ERU
Addresses
Depends On
Changes
This PR Ensures:
console.logstatements meant for debugging