import React from 'react'; import { type WardPatient } from '../../types'; import useWardLocation from '../../hooks/useWardLocation'; import { InlineNotification } from '@carbon/react'; import { useTranslation } from 'react-i18next'; interface IncorrectAdmissionWarningRowProps { wardPatient: WardPatient; } /** * This row appears in the patient card when the patient either has no active visit, * or has no inpatient admission, or their inpatient admission is not for the current ward. * This is unlikely an inconsistent data state, and this component shows a warning to indicate that. */ const IncorrectAdmissionWarningRow: React.FC = ({ wardPatient }) => { const { location } = useWardLocation(); const { t } = useTranslation(); const { visit, inpatientAdmission } = wardPatient; if (!visit) { return ( ); } if (!inpatientAdmission) { return ( ); } if (inpatientAdmission.currentInpatientLocation.uuid !== location?.uuid) { return ( ); } return null; }; export default IncorrectAdmissionWarningRow;