From 1de0930a03bf2055d037e54ef8d8a14470b2627e Mon Sep 17 00:00:00 2001 From: samau3 Date: Tue, 29 Oct 2024 18:04:50 -0700 Subject: [PATCH] Utilize consistent syntax for fallback text rendering --- .../components/MedicalInfo.jsx | 46 +++++++++++-------- .../components/Preferences.jsx | 6 +-- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/client/src/pages/patients/patient-details/components/MedicalInfo.jsx b/client/src/pages/patients/patient-details/components/MedicalInfo.jsx index ba1b08e8..6916c2f8 100644 --- a/client/src/pages/patients/patient-details/components/MedicalInfo.jsx +++ b/client/src/pages/patients/patient-details/components/MedicalInfo.jsx @@ -22,29 +22,35 @@ export default function MedicalInfo({ allergies, medications, conditions }) {
Allergies - {allergies.length === 0 && None} - {allergies.map((entry) => ( - - {entry.allergy.name} - - ))} + {allergies.length === 0 ? ( + None + ) : ( + allergies.map((entry) => ( + + {entry.allergy.name} + + )) + )}
Medications - {medications.length === 0 && None} - {medications.map((entry) => ( - - {entry.medication.name} - - ))} + {medications.length === 0 ? ( + None + ) : ( + medications.map((entry) => ( + + {entry.medication.name} + + )) + )}
Conditions diff --git a/client/src/pages/patients/patient-details/components/Preferences.jsx b/client/src/pages/patients/patient-details/components/Preferences.jsx index c6f3bc01..26ed2a43 100644 --- a/client/src/pages/patients/patient-details/components/Preferences.jsx +++ b/client/src/pages/patients/patient-details/components/Preferences.jsx @@ -1,7 +1,7 @@ import PropTypes from 'prop-types'; import { Paper, Text } from '@mantine/core'; import classes from '../PatientDetails.module.css'; - +import { humanize } from 'inflection'; const preferencesProps = { codeStatus: PropTypes.string, hospital: PropTypes.object, @@ -20,9 +20,9 @@ export default function Preferences({ codeStatus, hospital }) {
Code status - {codeStatus || 'Not provided'} + {codeStatus ? humanize(codeStatus) : 'Not provided'} Hospital - {hospital?.name} + {hospital ? hospital.name : 'Not provided'}