-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Create skeleton of each section for patient page * Style patient info section to match Figma more closely * Style section titles * Style contact information section * Display medical information for a patient * Include an empty array state for each medical section * Style Contact info to be two columns with aligned rows * Add missing key prop * Consolidate some CSS rules * Remove console logs * Format file * Remove unused variable * Refactor PatientDetails into smaller components * Add JSDoc comment and prop types * Clean up imports * Allow Pill text highlighting * Display dashes if any information is blank * Utilize consistent syntax for fallback text rendering * Redirect register patient form after successful submission to patient details page * Display QR code to link to patient details page * Increase size of QR code to become scanable * Display a bigger QR code --------- Co-authored-by: Francis Li <[email protected]>
- Loading branch information
Showing
7 changed files
with
301 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
client/src/pages/patients/patient-details/PatientDetails.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
.boldText { | ||
font-weight: 600; | ||
margin-top: var(--mantine-spacing-sm); | ||
margin-bottom: var(--mantine-spacing-sm); | ||
} | ||
|
||
.patientInfoContainer { | ||
display: grid; | ||
grid-template-columns: repeat(3, 1fr); | ||
grid-template-rows: auto auto; | ||
text-align: center; | ||
gap: var(--mantine-spacing-sm); | ||
} | ||
|
||
.patientInfoContainer p:nth-child(-n + 3) { | ||
font-weight: 600; | ||
margin-bottom: 0; | ||
} | ||
|
||
.patientInfoContainer p:nth-child(n + 4) { | ||
margin-top: 0; | ||
} | ||
|
||
.sectionTitle { | ||
font-size: var(--mantine-font-size-xl); | ||
font-weight: 600; | ||
margin-top: var(--mantine-spacing-md); | ||
margin-bottom: var(--mantine-spacing-md); | ||
} | ||
|
||
.titleRow { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
gap: var(--mantine-spacing-xl); | ||
margin-bottom: var(--mantine-spacing-md); | ||
} | ||
|
||
.twoColumnGrid { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
gap: var(--mantine-spacing-xl); | ||
} | ||
|
||
.contactRow { | ||
gap: var(--mantine-spacing-md); | ||
margin-bottom: var(--mantine-spacing-xs); | ||
} | ||
|
||
.contactInfoColumnTitle { | ||
font-weight: 600; | ||
font-size: var(--mantine-font-size-lg); | ||
} | ||
|
||
.medicalInfoPills { | ||
margin-right: var(--mantine-spacing-sm); | ||
margin-bottom: var(--mantine-spacing-sm); | ||
user-select: text; | ||
} | ||
|
||
@media (min-width: 768px) { | ||
.patientInfoContainer { | ||
text-align: left; | ||
width: 70%; | ||
} | ||
|
||
.details { | ||
max-height: 100vh; | ||
max-height: 100dvh; | ||
overflow-y: auto; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
client/src/pages/patients/patient-details/components/ContactInfo.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Paper, Text } from '@mantine/core'; | ||
import { humanize } from 'inflection'; | ||
import classes from '../PatientDetails.module.css'; | ||
|
||
const contactInfoProps = { | ||
emergencyContact: PropTypes.object, | ||
physician: PropTypes.object, | ||
}; | ||
|
||
ContactInfo.propTypes = contactInfoProps; | ||
|
||
/** | ||
* | ||
* @param {PropTypes.InferProps<typeof contactInfoProps>} props | ||
*/ | ||
export default function ContactInfo({ emergencyContact, physician }) { | ||
return ( | ||
<section> | ||
<Text className={classes.sectionTitle}> Contact Information</Text> | ||
<Paper shadow="xs" p="md" radius="md" withBorder> | ||
<div className={classes.titleRow}> | ||
<Text className={classes.contactInfoColumnTitle}> | ||
Emergency Contact | ||
</Text> | ||
<Text className={classes.contactInfoColumnTitle}> | ||
Primary care physician (PCP) contact | ||
</Text> | ||
</div> | ||
<div className={classes.twoColumnGrid}> | ||
<section> | ||
<div className={classes.contactRow}> | ||
<Text className={classes.boldText}>Name</Text> | ||
<Text> | ||
{emergencyContact | ||
? `${emergencyContact?.firstName} ${emergencyContact?.lastName}` | ||
: '-'} | ||
</Text> | ||
</div> | ||
<div className={classes.contactRow}> | ||
<Text className={classes.boldText}>Phone</Text> | ||
<Text> | ||
{emergencyContact?.phone ? emergencyContact?.phone : '-'} | ||
</Text> | ||
</div> | ||
<div className={classes.contactRow}> | ||
<Text className={classes.boldText}>Relationship</Text> | ||
<Text> | ||
{emergencyContact?.relationship | ||
? humanize(emergencyContact?.relationship) | ||
: '-'} | ||
</Text> | ||
</div> | ||
</section> | ||
<section> | ||
<div className={classes.contactRow}> | ||
<Text className={classes.boldText}>Name</Text> | ||
<Text> | ||
{physician | ||
? `${physician?.firstName} ${physician?.lastName}` | ||
: '-'} | ||
</Text> | ||
</div> | ||
<div className={classes.contactRow}> | ||
<Text className={classes.boldText}>Phone</Text> | ||
<Text>{physician?.phone ? physician?.phone : '-'}</Text> | ||
</div> | ||
<div className={classes.contactRow}> | ||
<Text className={classes.boldText}>Hospital</Text> | ||
<Text> | ||
{physician?.hospitals[0]?.name | ||
? physician?.hospitals[0]?.name | ||
: '-'} | ||
</Text> | ||
</div> | ||
</section> | ||
</div> | ||
</Paper> | ||
</section> | ||
); | ||
} |
70 changes: 70 additions & 0 deletions
70
client/src/pages/patients/patient-details/components/MedicalInfo.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Paper, Text, Pill } from '@mantine/core'; | ||
import classes from '../PatientDetails.module.css'; | ||
|
||
const medicalInfoProps = { | ||
allergies: PropTypes.array, | ||
medications: PropTypes.array, | ||
conditions: PropTypes.array, | ||
}; | ||
|
||
MedicalInfo.propTypes = medicalInfoProps; | ||
|
||
/** | ||
* | ||
* @param {PropTypes.InferProps<typeof medicalInfoProps>} props | ||
*/ | ||
export default function MedicalInfo({ allergies, medications, conditions }) { | ||
return ( | ||
<section> | ||
<Text className={classes.sectionTitle}>Medical Information</Text> | ||
<Paper shadow="xs" p="md" radius="md" withBorder> | ||
<section> | ||
<Text className={classes.boldText}>Allergies</Text> | ||
{allergies.length === 0 ? ( | ||
<Text>None</Text> | ||
) : ( | ||
allergies.map((entry) => ( | ||
<Pill | ||
size="md" | ||
key={entry.allergy.id} | ||
className={classes.medicalInfoPills} | ||
> | ||
{entry.allergy.name} | ||
</Pill> | ||
)) | ||
)} | ||
</section> | ||
<section> | ||
<Text className={classes.boldText}>Medications</Text> | ||
{medications.length === 0 ? ( | ||
<Text>None</Text> | ||
) : ( | ||
medications.map((entry) => ( | ||
<Pill | ||
size="md" | ||
key={entry.medication.id} | ||
className={classes.medicalInfoPills} | ||
> | ||
{entry.medication.name} | ||
</Pill> | ||
)) | ||
)} | ||
</section> | ||
<section> | ||
<Text className={classes.boldText}>Conditions</Text> | ||
{conditions?.length === 0 ? ( | ||
<Text>None</Text> | ||
) : ( | ||
<ul> | ||
{conditions.map((entry) => ( | ||
<li key={entry.condition.id}>{entry.condition.name}</li> | ||
))} | ||
</ul> | ||
)} | ||
</section> | ||
</Paper> | ||
</section> | ||
); | ||
} |
30 changes: 30 additions & 0 deletions
30
client/src/pages/patients/patient-details/components/Preferences.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
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, | ||
}; | ||
|
||
Preferences.propTypes = preferencesProps; | ||
|
||
/** | ||
* Preferences section of patient details | ||
* @param {PropTypes.InferProps<typeof preferencesProps>} props | ||
*/ | ||
export default function Preferences({ codeStatus, hospital }) { | ||
return ( | ||
<section> | ||
<Text className={classes.sectionTitle}>Preferences</Text> | ||
<Paper shadow="xs" p="md" radius="md" withBorder> | ||
<section> | ||
<Text className={classes.boldText}>Code status</Text> | ||
<Text>{codeStatus ? humanize(codeStatus) : 'Not provided'}</Text> | ||
<Text className={classes.boldText}>Hospital</Text> | ||
<Text>{hospital ? hospital.name : 'Not provided'}</Text> | ||
</section> | ||
</Paper> | ||
</section> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters