Skip to content

Commit

Permalink
undo changes in o3-4004
Browse files Browse the repository at this point in the history
  • Loading branch information
kb019 committed Oct 15, 2024
1 parent b88471f commit d15ae78
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import WardPatientBedNumber from './row-elements/ward-patient-bed-number';
import WardPatientName from './row-elements/ward-patient-name';
import { WardPatientCardElement } from './ward-patient-card-element.component';
import styles from './ward-patient-card.scss';
import { launchPatientWorkspace, setWardPatient } from './ward-patient-resource';

const WardPatientCard: WardPatientCard = (wardPatient) => {
const { patient, bed } = wardPatient;
Expand Down Expand Up @@ -58,8 +57,9 @@ const WardPatientCard: WardPatientCard = (wardPatient) => {
<button
className={styles.wardPatientCardButton}
onClick={() => {
setWardPatient(wardPatient);
launchPatientWorkspace();
launchWorkspace<WardPatientWorkspaceProps>('ward-patient-workspace', {
wardPatient,
});
}}>
{/* Name will not be displayed; just there for a11y */}
{getPatientName(patient.person)}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { UserAvatarIcon } from '@openmrs/esm-framework';
import { ActionMenuButton, launchWorkspace } from '@openmrs/esm-framework';
import { launchPatientWorkspace } from '../../ward-patient-card/ward-patient-resource';
import type { WardPatientWorkspaceProps } from '../../types';

export default function WardPatientActionButton() {
const { t } = useTranslation();
Expand All @@ -12,7 +12,7 @@ export default function WardPatientActionButton() {
getIcon={(props) => <UserAvatarIcon {...props} />}
label={t('Patient', 'patient')}
iconDescription={t('Patient', 'patient')}
handler={() => launchPatientWorkspace()}
handler={() => launchWorkspace<WardPatientWorkspaceProps>('ward-patient-workspace')}
type={'ward'}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,22 @@ import { getGender } from '../../ward-patient-card/row-elements/ward-patient-gen

attach('ward-patient-workspace-header-slot', 'patient-vitals-info');

export default function WardPatientWorkspace({ setTitle, wardPatient: { patient } }: WardPatientWorkspaceProps) {
export default function WardPatientWorkspace({ setTitle, wardPatient }: WardPatientWorkspaceProps) {
useEffect(() => {
setTitle(patient.person.display, <PatientWorkspaceTitle key={patient.uuid} patient={patient} />);
}, [patient.uuid]);
if (wardPatient) {
const { patient } = wardPatient;
setTitle(patient.person.display, <PatientWorkspaceTitle key={patient.uuid} patient={patient} />);
}
}, [wardPatient]);

return (
<div className={styles.workspaceContainer}>
<WardPatientWorkspaceView patient={patient} />
</div>
<>
{wardPatient && (
<div className={styles.workspaceContainer}>
<WardPatientWorkspaceView patient={wardPatient.patient} />
</div>
)}
</>
);
}

Expand Down

0 comments on commit d15ae78

Please sign in to comment.