diff --git a/packages/esm-patient-chart-app/src/actions-buttons/action-button.scss b/packages/esm-patient-chart-app/src/actions-buttons/action-button.scss new file mode 100644 index 0000000000..2a7fdf7d6c --- /dev/null +++ b/packages/esm-patient-chart-app/src/actions-buttons/action-button.scss @@ -0,0 +1,3 @@ +.menuitem { + max-width: none; +} diff --git a/packages/esm-patient-chart-app/src/actions-buttons/add-past-visit.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/add-past-visit.component.tsx index 36f84bae3c..1a2a4a6352 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/add-past-visit.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/add-past-visit.component.tsx @@ -1,6 +1,8 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; +import { OverflowMenuItem } from '@carbon/react'; import { showModal } from '@openmrs/esm-framework'; +import styles from './action-button.scss'; interface AddPastVisitOverflowMenuItemProps { patientUuid?: string; @@ -13,29 +15,20 @@ const AddPastVisitOverflowMenuItem: React.FC }) => { const { t } = useTranslation(); - const openModal = useCallback(() => { + const handleLaunchModal = useCallback(() => { const dispose = showModal('start-visit-dialog', { - patientUuid, - launchPatientChart, closeModal: () => dispose(), + launchPatientChart, + patientUuid, }); }, [patientUuid, launchPatientChart]); return ( -
  • - -
  • + ); }; diff --git a/packages/esm-patient-chart-app/src/actions-buttons/cancel-visit.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/cancel-visit.component.tsx index 33dfce1d21..8a4a609354 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/cancel-visit.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/cancel-visit.component.tsx @@ -1,6 +1,8 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; +import { OverflowMenuItem } from '@carbon/react'; import { useVisit, showModal } from '@openmrs/esm-framework'; +import styles from './action-button.scss'; interface CancelVisitOverflowMenuItemProps { patientUuid: string; @@ -8,9 +10,9 @@ interface CancelVisitOverflowMenuItemProps { const CancelVisitOverflowMenuItem: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { currentVisit } = useVisit(patientUuid); - const openModal = useCallback(() => { + + const handleLaunchModal = useCallback(() => { const dispose = showModal('cancel-visit-dialog', { closeModal: () => dispose(), patientUuid, @@ -19,20 +21,11 @@ const CancelVisitOverflowMenuItem: React.FC = return ( currentVisit && ( -
  • - -
  • + ) ); }; diff --git a/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-alive.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-alive.component.tsx index 8af40d8af3..57cbfea83e 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-alive.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-alive.component.tsx @@ -1,8 +1,9 @@ import React, { useCallback } from 'react'; -import { OverflowMenuItem } from '@carbon/react'; import { useTranslation } from 'react-i18next'; +import { OverflowMenuItem } from '@carbon/react'; import { showModal } from '@openmrs/esm-framework'; import { usePatientDeceased } from '../deceased/deceased.resource'; +import styles from './action-button.scss'; interface MarkPatientAliveOverflowMenuItemProps { patientUuid?: string; @@ -10,13 +11,12 @@ interface MarkPatientAliveOverflowMenuItemProps { const MarkPatientAliveOverflowMenuItem: React.FC = ({ patientUuid }) => { const { t } = useTranslation(); - const { isDead, isLoading: isPatientLoading } = usePatientDeceased(patientUuid); - const openModal = useCallback(() => { + const handleLaunchModal = useCallback(() => { const dispose = showModal('confirm-alive-modal', { patientUuid, - closeDialog: () => dispose(), + closeModal: () => dispose(), }); }, [patientUuid]); @@ -24,11 +24,9 @@ const MarkPatientAliveOverflowMenuItem: React.FC ) ); diff --git a/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-deceased.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-deceased.component.tsx index 174916770c..8455f54363 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-deceased.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/mark-patient-deceased.component.tsx @@ -1,23 +1,23 @@ import React, { useCallback } from 'react'; -import { OverflowMenuItem } from '@carbon/react'; import { useTranslation } from 'react-i18next'; +import { OverflowMenuItem } from '@carbon/react'; import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; import { usePatientDeceased } from '../deceased/deceased.resource'; +import styles from './action-button.scss'; const MarkPatientDeceasedOverflowMenuItem = ({ patientUuid }) => { const { t } = useTranslation(); - const handleClick = useCallback(() => launchPatientWorkspace('mark-patient-deceased-workspace-form'), []); const { isDead, isLoading: isPatientLoading } = usePatientDeceased(patientUuid); + const handleLaunchModal = useCallback(() => launchPatientWorkspace('mark-patient-deceased-workspace-form'), []); + return ( !isPatientLoading && !isDead && ( ) ); diff --git a/packages/esm-patient-chart-app/src/actions-buttons/print-identifier-sticker.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/print-identifier-sticker.component.tsx index 33d8aa9e59..f56b8001fd 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/print-identifier-sticker.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/print-identifier-sticker.component.tsx @@ -1,7 +1,8 @@ import React, { useCallback } from 'react'; -import { OverflowMenuItem } from '@carbon/react'; import { useTranslation } from 'react-i18next'; +import { OverflowMenuItem } from '@carbon/react'; import { showModal, useConfig, usePatient } from '@openmrs/esm-framework'; +import styles from './action-button.scss'; interface PrintIdentifierStickerOverflowMenuItemProps { patientUuid: string; @@ -16,7 +17,7 @@ const PrintIdentifierStickerOverflowMenuItem: React.FC { + const handleLaunchModal = useCallback(() => { const dispose = showModal('print-identifier-sticker-modal', { closeModal: () => dispose(), patient, @@ -27,11 +28,9 @@ const PrintIdentifierStickerOverflowMenuItem: React.FC ) ); diff --git a/packages/esm-patient-chart-app/src/actions-buttons/start-visit.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/start-visit.component.tsx index 3f54137f70..92a83a6ab0 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/start-visit.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/start-visit.component.tsx @@ -1,7 +1,9 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; +import { OverflowMenuItem } from '@carbon/react'; import { usePatient, useVisit } from '@openmrs/esm-framework'; import { launchPatientWorkspace } from '@openmrs/esm-patient-common-lib'; +import styles from './action-button.scss'; interface StartVisitOverflowMenuItemProps { patientUuid: string; @@ -11,26 +13,18 @@ const StartVisitOverflowMenuItem: React.FC = ({ const { t } = useTranslation(); const { currentVisit } = useVisit(patientUuid); const { patient } = usePatient(patientUuid); - const handleClick = useCallback(() => launchPatientWorkspace('start-visit-workspace-form'), []); - const isDeceased = Boolean(patient?.deceasedDateTime); + const handleLaunchModal = useCallback(() => launchPatientWorkspace('start-visit-workspace-form'), []); + return ( !currentVisit && !isDeceased && ( -
  • - -
  • + ) ); }; diff --git a/packages/esm-patient-chart-app/src/actions-buttons/stop-visit.component.tsx b/packages/esm-patient-chart-app/src/actions-buttons/stop-visit.component.tsx index e9b4c5808e..3f00db6ff6 100644 --- a/packages/esm-patient-chart-app/src/actions-buttons/stop-visit.component.tsx +++ b/packages/esm-patient-chart-app/src/actions-buttons/stop-visit.component.tsx @@ -1,6 +1,8 @@ import React, { useCallback } from 'react'; import { useTranslation } from 'react-i18next'; import { showModal, useVisit } from '@openmrs/esm-framework'; +import { OverflowMenuItem } from '@carbon/react'; +import styles from './action-button.scss'; interface StopVisitOverflowMenuItemProps { patientUuid: string; @@ -10,7 +12,7 @@ const StopVisitOverflowMenuItem: React.FC = ({ p const { t } = useTranslation(); const { currentVisit } = useVisit(patientUuid); - const openModal = useCallback(() => { + const handleLaunchModal = useCallback(() => { const dispose = showModal('end-visit-dialog', { closeModal: () => dispose(), patientUuid, @@ -19,20 +21,11 @@ const StopVisitOverflowMenuItem: React.FC = ({ p return ( currentVisit && ( -
  • - -
  • + ) ); }; diff --git a/packages/esm-patient-chart-app/src/deceased/confirmation-dialog.component.tsx b/packages/esm-patient-chart-app/src/deceased/confirmation-dialog.component.tsx index e8e405229c..7d073936ce 100644 --- a/packages/esm-patient-chart-app/src/deceased/confirmation-dialog.component.tsx +++ b/packages/esm-patient-chart-app/src/deceased/confirmation-dialog.component.tsx @@ -4,25 +4,25 @@ import { Button, ModalBody, ModalFooter, ModalHeader } from '@carbon/react'; import { useTranslation } from 'react-i18next'; interface ConfirmationDialogProps { - closeDialog: () => void; + closeModal: () => void; handleSubmit: (e: any) => void; } -const ConfirmMarkAsDeceasedDialog: React.FC = ({ closeDialog, handleSubmit }) => { +const ConfirmMarkAsDeceasedDialog: React.FC = ({ closeModal, handleSubmit }) => { const { t } = useTranslation(); return (
    - + {t('markAsDeceased', 'Are you sure you want to mark patient as deceased?')} -