Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the email address of the Export Instructions #4581

Merged
merged 9 commits into from Mar 9, 2023
38 changes: 29 additions & 9 deletions web/src/pages/apd/export/ExportReadOnly.js
@@ -1,13 +1,31 @@
import React from 'react';
import React, { useMemo } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Button } from '@cmsgov/design-system';
import { APD_TYPE } from '@cms-eapd/common';
import { Envelope, PDFFile } from '../../../components/Icons';
import { printApd, saveApdEvent } from '../../../redux/actions/app';
import { APD_EVENTS } from '../../../constants';
import { selectApdType } from '../../../redux/selectors/apd.selectors';

const ExportInstructions = ({ printApd: print, saveApdEvent: log }) => {
const sendMail = email => {
const ExportInstructions = ({
apdType,
printApd: print,
saveApdEvent: log
}) => {
const email = useMemo(() => {
switch (apdType) {
case APD_TYPE.HITECH:
return 'MedicaidHITECH@cms.hhs.gov';
case APD_TYPE.MMIS:
return 'MedicaidMMIS@cms.hhs.gov';
default:
return null;
}
}, [apdType]);

const sendMail = e => {
e.preventDefault();
window.location.href = `mailto:${email}`;
};

Expand Down Expand Up @@ -55,16 +73,13 @@ const ExportInstructions = ({ printApd: print, saveApdEvent: log }) => {
<p>
Once you’ve exported a PDF of a completed APD, submit it for state
officer review by emailing the PDF to{' '}
<a href="mailto:MedicaidHITECH@cms.hhs.gov">
MedicaidHITECH@cms.hhs.gov
</a>
.
<a href={`mailto:${email}`}>{email}</a>.
</p>
<Button
size="big"
variation="primary"
className="ds-u-margin-top--2"
onClick={() => sendMail('MedicaidHITECH@cms.hhs.gov')}
onClick={e => sendMail(e)}
>
Submit
<span className="ds-u-margin-left--2">
Expand All @@ -75,12 +90,17 @@ const ExportInstructions = ({ printApd: print, saveApdEvent: log }) => {
);
};
ExportInstructions.propTypes = {
apdType: PropTypes.string.isRequired,
printApd: PropTypes.func.isRequired,
saveApdEvent: PropTypes.func.isRequired
};

const mapStateToProps = state => ({
apdType: selectApdType(state)
});

const mapDispatchToProps = { printApd, saveApdEvent };

export default connect(null, mapDispatchToProps)(ExportInstructions);
export default connect(mapStateToProps, mapDispatchToProps)(ExportInstructions);

export { ExportInstructions as plain, mapDispatchToProps };
45 changes: 45 additions & 0 deletions web/src/pages/apd/export/ExportReadOnly.stories.js
@@ -0,0 +1,45 @@
import React from 'react';
import ExportReadOnly from './ExportReadOnly';
import { renderWithProvider } from 'apd-storybook-library';
import { APD_TYPE } from '@cms-eapd/common';

export default {
title: 'Pages/Apd/Print/Export Read Only (Redux)',
component: ExportReadOnly,
includeStories: /.*Story$/,
parameters: {
jest: ['ExportReadOnly.test.js']
}
};

const Template = args => <ExportReadOnly {...args} />;

export const HitechExportReadOnlyStory = Template.bind({});
HitechExportReadOnlyStory.decorators = [
story =>
renderWithProvider({
initialState: {
apd: {
data: {
apdType: APD_TYPE.HITECH
}
}
},
story
})
];

export const MmisExportReadOnlyStory = Template.bind({});
MmisExportReadOnlyStory.decorators = [
story =>
renderWithProvider({
initialState: {
apd: {
data: {
apdType: APD_TYPE.MMIS
}
}
},
story
})
];

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.