Skip to content

ERU: Update in eru form and eru page#2269

Open
shreeyash07 wants to merge 3 commits intodevelopfrom
feat/eru-update
Open

ERU: Update in eru form and eru page#2269
shreeyash07 wants to merge 3 commits intodevelopfrom
feat/eru-update

Conversation

@shreeyash07
Copy link
Collaborator

@shreeyash07 shreeyash07 commented Mar 11, 2026

Addresses

Depends On

Changes

  • 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
  • add new components "ReadinessIconList" and "EruReadinessList"

This PR Ensures:

  • No typos or grammatical errors
  • No conflict markers left in the code
  • No unwanted comments, temporary files, or auto-generated files
  • No inclusion of secret keys or sensitive data
  • No console.log statements meant for debugging
  • All CI checks have passed

@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2026

⚠️ No Changeset found

Latest commit: 3e3cb28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Member

@frozenhelium frozenhelium left a comment

Choose a reason for hiding this comment

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

P.S. I have not verified the UI, do we have the design for this?

Comment on lines +31 to +33
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'];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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/'>;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
type GetEruReadinessTypeResponse = GoApiResponse<'/api/v2/eru-readiness-type/'>;
type EruReadinessTypeResponse = GoApiResponse<'/api/v2/eru-readiness-type/'>;

Comment on lines +141 to +181
{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>
)}
Copy link
Member

Choose a reason for hiding this comment

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

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>

Comment on lines +187 to +222
<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>
)}
Copy link
Member

Choose a reason for hiding this comment

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

Let's restructure to make it semantically correct as well

Comment on lines +108 to +144
{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>
Copy link
Member

Choose a reason for hiding this comment

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

Let's restructure to make it semantically correct as well

Comment on lines +180 to +181
export const HOLDSERU = 1 satisfies TypeOfNsContributionEnum;
export const SUPPORTERU = 2 satisfies TypeOfNsContributionEnum;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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;

Copy link
Member

Choose a reason for hiding this comment

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

We will need to regenerate this

Comment on lines 165 to 169
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)),
Copy link
Member

Choose a reason for hiding this comment

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

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

Comment on lines +42 to +44
function contributionLabelSelector(option: ContributionOption) {
return option.value;
}
Copy link
Member

Choose a reason for hiding this comment

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

We should be able to re-use something like stringValueSelector here

Comment on lines +38 to +40
function contributionKeySelector(option: ContributionOption) {
return option.key;
}
Copy link
Member

Choose a reason for hiding this comment

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

If key is not enum, we should be able to re-use existing key selectors from utils/selectors

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

using existing key selectors gave error so not making any changes.

@shreeyash07
Copy link
Collaborator Author

P.S. I have not verified the UI, do we have the design for this?

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
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.

2 participants