This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(patients): add no patients exist (#2235)
- Loading branch information
Showing
12 changed files
with
147 additions
and
20 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
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,33 @@ | ||
import { Icon, Typography, Button } from '@hospitalrun/components' | ||
import { mount } from 'enzyme' | ||
import React from 'react' | ||
|
||
import NoPatientsExist from '../../../patients/view/NoPatientsExist' | ||
|
||
describe('NoPatientsExist', () => { | ||
const setup = () => mount(<NoPatientsExist />) | ||
|
||
it('should render an icon and a button with typography', () => { | ||
const wrapper = setup() | ||
|
||
const addNewPatient = wrapper.find(NoPatientsExist) | ||
expect(addNewPatient).toHaveLength(1) | ||
|
||
const icon = wrapper.find(Icon).first() | ||
const typography = wrapper.find(Typography) | ||
const button = wrapper.find(Button) | ||
const iconType = icon.prop('icon') | ||
const iconSize = icon.prop('size') | ||
const typographyText = typography.prop('children') | ||
const typographyVariant = typography.prop('variant') | ||
const buttonIcon = button.prop('icon') | ||
const buttonText = button.prop('children') | ||
|
||
expect(iconType).toEqual('patients') | ||
expect(iconSize).toEqual('6x') | ||
expect(typographyText).toEqual('patients.noPatients') | ||
expect(typographyVariant).toEqual('h5') | ||
expect(buttonIcon).toEqual('patient-add') | ||
expect(buttonText).toEqual('patients.newPatient') | ||
}) | ||
}) |
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
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,38 @@ | ||
import { Button, Icon, Typography } from '@hospitalrun/components' | ||
import React from 'react' | ||
import { useHistory } from 'react-router-dom' | ||
|
||
import useTranslator from '../../shared/hooks/useTranslator' | ||
|
||
const NoPatientsExist = () => { | ||
const history = useHistory() | ||
const { t } = useTranslator() | ||
|
||
return ( | ||
<div style={{ display: 'flex', justifyContent: 'center' }}> | ||
<div style={{ display: 'flex', flexDirection: 'column' }}> | ||
<div style={{ display: 'flex', justifyContent: 'center' }}> | ||
<Icon icon="patients" outline={false} size="6x" /> | ||
</div> | ||
<div style={{ display: 'flex', justifyContent: 'center' }}> | ||
<div style={{ textAlign: 'center', width: '60%', margin: 16 }}> | ||
<Typography variant="h5">{t('patients.noPatients')}</Typography> | ||
</div> | ||
</div> | ||
<div style={{ display: 'flex', justifyContent: 'center' }}> | ||
<Button | ||
key="newPatientButton" | ||
outlined | ||
color="primary" | ||
icon="patient-add" | ||
onClick={() => history.push('/patients/new')} | ||
> | ||
{t('patients.newPatient')} | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default NoPatientsExist |
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
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
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
886163a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: