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: create address input #362

Merged
merged 48 commits into from
Jan 17, 2025
Merged

feat: create address input #362

merged 48 commits into from
Jan 17, 2025

Conversation

jamil314
Copy link
Collaborator

No description provided.

Copy link

Oops! Looks like you forgot to update the changelog. When updating CHANGELOG.md, please consider the following:

  • Changelog is read by country implementors who might not always be familiar with all technical details of OpenCRVS. Keep language high-level, user friendly and avoid technical references to internals.
  • Answer "What's new?", "Why was the change made?" and "Why should I care?" for each change.
  • If it's a breaking change, include a migration guide answering "What do I need to do to upgrade?".

@jamil314 jamil314 changed the base branch from feat-birth-v2 to develop January 16, 2025 13:29
@@ -195,6 +218,55 @@ const getIdFields = (person: string): FieldConfig[] => [
}
]

const getAddressOrSameAsMotherFields = (person: string): FieldConfig[] => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

could we have a tighter type for person?

Copy link
Collaborator

@makelicious makelicious left a comment

Choose a reason for hiding this comment

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

Looks good! Some suggestions

@@ -291,7 +363,7 @@ export const getInformantFields = (person: string): FieldConfig[] => [
},
options: { fontVariant: 'h2' }
},
...getAddressFields(person)
...getAddressOrSameAsMotherFields(person)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might want to separate this function to two different ones. Often it is perfectly fine to have condition nested inside a function.

When we need to name the function with "or" it might sometimes be better to bring that condition up a level, especially if the condition is "rare".

On high-level, it might be something like this:

const isFather = person === 'father';

// You know better how to name the function and the domain rules.
// Is father only one using the function? Is it always mother? Or can they be other way around? Would be cool if that is either reflected on function name or parameters.
const addressFields =  isFather ? getAddressWithSharedResidenceFields(father)  : getAddressFields(person)


@@ -14,6 +14,8 @@ import { field } from '@opencrvs/toolkit/conditionals'
import { getAddressFields } from './address'
import { appendConditionalsToFields, createSelectOptions } from '../utils'

export type PersonTypes = 'father' | 'mother' | 'informant' | 'applicant'
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use same pattern like this:

export const PersonType = {
  father: 'father',
  mother: 'mother'
} as const

export type PersonType = keyof typeof PersonType

and use the PersonType.father later in the file, so satisfy wouldn't be needed because they derive from the same source

@@ -12,6 +12,12 @@
import { FieldConfig, TranslationConfig } from '@opencrvs/toolkit/events'
import { field } from '@opencrvs/toolkit/conditionals'
import { appendConditionalsToFields, createSelectOptions } from '../utils'
import { PersonTypes } from '.'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not matter most of the time if build works, but filename could be added

@jamil314 jamil314 merged commit 3a608c7 into develop Jan 17, 2025
1 of 2 checks passed
tareq89 pushed a commit that referenced this pull request Jan 21, 2025
* chore: update yarn.lock

* feat: wip: birth event v2

* feat: use select option in gender, attendantAtBirth and birthType

* fix: use number for weight at birth

* feat: person input wip

* feat: show dob or age based on dobUnknown checkbox

* chore: rename directory

* amend: import from renamed directory

* feat: add informant relation to birth form

* feat: render informant fields based on relation to child

* feat: separate the logic for concatenating field id

* feat: complete informant details apart form person inputs

* feat: implement id and address

* refactor: create utils

* fix: handle undefined values in conditionals

* feat: implement father and mother details

* feat: implement upload supporting document

* fix: use simpler concat

* feat: use country field

* feat: add place of birth

* fix: typo

* fix: align label and required properties with legecy birth

* fix: font of bulletList

* feat: add helper texts

* chore: bump up @opencrvs/toolkit

* chore: update yarn.lock

* feat: use Location type in address

* feat: implement urbanOrRural

* feat: implement health_failities

* feat: add addressInput in tennis-club-membership

* fix: update ids of other country input fields

* rename: BirthEvent to birthEvent

* chore: remove the messages that are not in use

* chore: remove unused

* refactor: use informantType instead of hardcoding

* refactor: birth event

* chore: bump up toolkit

* feat: add relation to child for someone else

* feat: usual place of residence  same as mother

* refactor: make suggested changes

* fix: update types
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.

2 participants