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 e051be1
Show file tree
Hide file tree
Showing 4 changed files with 16 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 { WardPatientWorkspaceProps } from '../../types';

Check failure on line 5 in packages/esm-ward-app/src/ward-workspace/patient-details/ward-patient-action-button.extension.tsx

View workflow job for this annotation

GitHub Actions / build

All imports in the declaration are only used as types. Use `import type`

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,16 +7,21 @@ 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(() => {
if(wardPatient){
const {patient}=wardPatient;
setTitle(patient.person.display, <PatientWorkspaceTitle key={patient.uuid} patient={patient} />);
}, [patient.uuid]);
}
}, [wardPatient]);

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

interface WardPatientWorkspaceViewProps {
Expand Down

0 comments on commit e051be1

Please sign in to comment.