Skip to content

Commit

Permalink
(fix) Omit use key from Address details in Patient Banner
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Aug 16, 2024
1 parent 45bdc9b commit e7bd407
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
8 changes: 4 additions & 4 deletions packages/framework/esm-framework/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6154,7 +6154,7 @@ ___

#### Defined in

[packages/framework/esm-styleguide/src/patient-banner/contact-details/patient-banner-contact-details.component.tsx:179](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/contact-details/patient-banner-contact-details.component.tsx#L179)
[packages/framework/esm-styleguide/src/patient-banner/contact-details/patient-banner-contact-details.component.tsx:183](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-styleguide/src/patient-banner/contact-details/patient-banner-contact-details.component.tsx#L183)

___

Expand Down Expand Up @@ -6644,7 +6644,7 @@ ___

Most REST endpoints that return a list of objects, such as getAll or search, are server-side paginated.
The server limits the max number of results being returned, and multiple requests are needed to get the full data set
if its size exceed this limit.
if its size exceeds this limit.
The max number of results per request is configurable server-side
with the key "webservices.rest.maxResultsDefault". See: https://openmrs.atlassian.net/wiki/spaces/docs/pages/25469882/REST+Module

Expand Down Expand Up @@ -6682,7 +6682,7 @@ a UseServerInfiniteReturnObject object

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:77](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L77)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:78](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L78)

___

Expand All @@ -6692,7 +6692,7 @@ ___

Most REST endpoints that return a list of objects, such as getAll or search, are server-side paginated.
The server limits the max number of results being returned, and multiple requests are needed to get the full data set
if its size exceed this limit.
if its size exceeds this limit.
The max number of results per request is configurable server-side
with the key "webservices.rest.maxResultsDefault". See: https://openmrs.atlassian.net/wiki/spaces/docs/pages/25469882/REST+Module

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ this array does not contain the complete data set.

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:13](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L13)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:14](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L14)

___

Expand All @@ -48,7 +48,7 @@ from useSWRInfinite

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:33](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L33)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:34](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L34)

___

Expand All @@ -60,7 +60,7 @@ Whether there are more results in the data set that have not been fetched yet.

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:23](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L23)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:24](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L24)

___

Expand All @@ -72,7 +72,7 @@ from useSWRInfinite

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:48](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L48)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:49](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L49)

___

Expand All @@ -84,7 +84,7 @@ from useSWRInfinite

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:43](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L43)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:44](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L44)

___

Expand All @@ -96,7 +96,7 @@ from useSWRInfinite

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:38](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L38)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:39](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L39)

___

Expand All @@ -108,7 +108,7 @@ The total number of rows in the data set.

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:18](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L18)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:19](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L19)

## UI Methods

Expand All @@ -124,4 +124,4 @@ callback function to make another fetch of next page's data set.

#### Defined in

[packages/framework/esm-react-utils/src/useServerInfinite.ts:28](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L28)
[packages/framework/esm-react-utils/src/useServerInfinite.ts:29](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useServerInfinite.ts#L29)
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { InlineLoading } from '@carbon/react';
import { type CoreTranslationKey, getCoreTranslation } from '@openmrs/esm-translations';
import { ConfigurableLink, usePatient } from '@openmrs/esm-react-utils';
import { parseDate } from '@openmrs/esm-utils';
import { useRelationships } from './useRelationships';
import { usePatientContactAttributes } from './usePatientAttributes';
import { usePatientListsForPatient } from './usePatientListsForPatient';
import { useRelationships } from './useRelationships';
import styles from './patient-banner-contact-details.module.scss';

interface ContactDetailsProps {
Expand Down Expand Up @@ -43,15 +43,15 @@ const PatientLists: React.FC<{ patientUuid: string }> = ({ patientUuid }) => {
}
return <li>--</li>;
})()}
<li style={{ marginTop: '1rem' }}>
<ConfigurableLink to={`${window.spaBase}/home/patient-lists`}>
{cohorts.length > 3
? getCoreTranslation('seeMoreLists', 'See {{count}} more lists', {
count: cohorts?.length - 3,
})
: ''}
</ConfigurableLink>
</li>
{cohorts.length > 3 && (
<li className={styles.link}>
<ConfigurableLink to={`${window.spaBase}/home/patient-lists`}>
{getCoreTranslation('seeMoreLists', 'See {{count}} more lists', {
count: cohorts?.length - 3,
})}
</ConfigurableLink>
</li>
)}
</ul>
)}
</>
Expand All @@ -61,7 +61,7 @@ const PatientLists: React.FC<{ patientUuid: string }> = ({ patientUuid }) => {
const Address: React.FC<{ patientId: string }> = ({ patientId }) => {
const { patient, isLoading } = usePatient(patientId);
const address = patient?.address?.find((a) => a.use === 'home');
const getAddressKey = (url) => url.split('#')[1];
const getAddressKey = (url: string) => url.split('#')[1];

if (isLoading) {
return <InlineLoading description={`${getCoreTranslation('loading', 'Loading')} ...`} role="progressbar" />;
Expand All @@ -73,12 +73,16 @@ const Address: React.FC<{ patientId: string }> = ({ patientId }) => {
<ul>
{address ? (
Object.entries(address)
.filter(([key]) => key !== 'id')
.filter(([key]) => key !== 'id' && key !== 'use')
.map(([key, value]) =>
key === 'extension' ? (
address.extension?.[0]?.extension?.map((add, i) => (
<li key={`address-${key}-${i}`}>
{getCoreTranslation(getAddressKey(add.url), getAddressKey(add.url))}: {add.valueString}
{getCoreTranslation(
getAddressKey(add.url) as CoreTranslationKey,
getAddressKey(add.url) as CoreTranslationKey,
)}
: {add.valueString}
</li>
))
) : (
Expand Down

0 comments on commit e7bd407

Please sign in to comment.