-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) O3-4400 - render queue entry status in patient banner (#1497)
Co-authored-by: Dennis Kigen <kigen.work@gmail.com>
- Loading branch information
1 parent
cb9abf6
commit 06f8743
Showing
15 changed files
with
112 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 0 additions & 98 deletions
98
packages/esm-service-queues-app/src/patient-info/appointment-details.component.tsx
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
packages/esm-service-queues-app/src/patient-info/appointment-details.scss
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
packages/esm-service-queues-app/src/patient-info/appointment-details.test.tsx
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
packages/esm-service-queues-app/src/patient-info/appointments.resource.ts
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
packages/esm-service-queues-app/src/patient-info/hooks/usePatientAttributes.tsx
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
...s/esm-service-queues-app/src/patient-info/patient-banner-queue-entry-status.extension.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { Tag , Button } from '@carbon/react'; | ||
import React from 'react'; | ||
import { useQueueEntries } from '../hooks/useQueueEntries'; | ||
import styles from './patient-banner-queue-entry-status.scss'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { isDesktop, showModal, useLayoutType } from '@openmrs/esm-framework'; | ||
|
||
// See: patient-banner-patient-info.component.tsx | ||
interface PatientBannerQueueEntryStatusProps { | ||
patientUuid: string; | ||
renderedFrom: string; | ||
} | ||
|
||
/** | ||
* This extension appears in the patient banner to indicate the patient's | ||
* queue entry status, with a quick link to transition them to q new queue / status | ||
*/ | ||
const PatientBannerQueueEntryStatus: React.FC<PatientBannerQueueEntryStatusProps> = ({ patientUuid, renderedFrom }) => { | ||
const { queueEntries } = useQueueEntries({ patient: patientUuid, isEnded: false }); | ||
const layout = useLayoutType(); | ||
const queueEntry = queueEntries?.[0]; | ||
const { t } = useTranslation(); | ||
const isPatientChart = renderedFrom === 'patient-chart'; | ||
if (!isPatientChart || !queueEntry) { | ||
return <></>; | ||
} | ||
|
||
const mappedPriority = queueEntry.priority.display === 'Urgent' ? 'Priority' : queueEntry.priority.display; | ||
|
||
return ( | ||
<div className={styles.queueEntryStatusContainer}> | ||
<span className={styles.separator}>·</span> | ||
<span>{queueEntry.queue.name}</span> | ||
<Tag | ||
className={mappedPriority === 'Priority' ? styles.priorityTag : styles.tag} | ||
type={getTagType(mappedPriority?.toLocaleLowerCase('en'))}> | ||
{mappedPriority} | ||
</Tag> | ||
<Button | ||
kind="ghost" | ||
size={isDesktop(layout) ? 'sm' : 'lg'} | ||
onClick={() => { | ||
const dispose = showModal('transition-queue-entry-modal', { | ||
closeModal: () => dispose(), | ||
queueEntry, | ||
}); | ||
}}> | ||
{t('change', 'Change')} | ||
</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
// The color of the priority tag should not be hard coded, see: | ||
// https://openmrs.atlassian.net/browse/O3-4469 | ||
const getTagType = (priority: string) => { | ||
switch (priority) { | ||
case 'emergency': | ||
return 'red'; | ||
case 'not urgent': | ||
return 'green'; | ||
default: | ||
return 'gray'; | ||
} | ||
}; | ||
|
||
export default PatientBannerQueueEntryStatus; |
29 changes: 29 additions & 0 deletions
29
packages/esm-service-queues-app/src/patient-info/patient-banner-queue-entry-status.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@use '@carbon/colors'; | ||
@use '@carbon/layout'; | ||
@use '@carbon/type'; | ||
@use '@openmrs/esm-styleguide/src/vars' as *; | ||
|
||
.queueEntryStatusContainer { | ||
display: flex; | ||
align-items: baseline; | ||
gap: layout.$spacing-02; | ||
} | ||
|
||
.navDivider { | ||
background-color: var(--brand-03); | ||
width: 0.05rem; | ||
height: 1.5rem; | ||
} | ||
|
||
.tag { | ||
margin: layout.$spacing-02 0; | ||
min-width: layout.$spacing-10; | ||
} | ||
|
||
.priorityTag { | ||
@extend .tag; | ||
@include type.type-style('label-01'); | ||
color: #943d00; | ||
background-color: #ffc9a3; | ||
min-width: layout.$spacing-10; | ||
} |
Oops, something went wrong.