From 7c58783c9240d36e7651d43430f848b5ec1c6a45 Mon Sep 17 00:00:00 2001
From: Josh Salisbury
Date: Tue, 16 Mar 2021 12:54:07 -0500
Subject: [PATCH 1/8] Small MVP fixes
* Report table context menu for approved reports changed from "edit" to
"view"
* Error message state lifted up to the activity report
* Not editable alert for submitted reports duplicated below "reset to
draft" button
* Accordion items auto expanded for non-draft/needs action reports
* Resources used is now a textarea
* Title and other verbiage tweaked for next steps
* Report status tag capitalized and green if report is approved
---
.../components/Navigator/__tests__/index.js | 1 +
.../components/Navigator/components/SideNav.js | 2 +-
.../Navigator/components/__tests__/SideNav.js | 2 +-
frontend/src/components/Navigator/index.js | 6 +++++-
.../Pages/Review/Submitter/Submitted.js | 11 +++++++++++
.../pages/ActivityReport/Pages/Review/index.js | 11 +++++++++--
.../Pages/__tests__/nextSteps.js | 8 ++++----
.../Pages/components/Objective.css | 4 ----
.../Pages/components/ResourceSelector.js | 10 +++-------
.../components/__tests__/ResourceSelector.js | 18 ++++--------------
.../pages/ActivityReport/Pages/nextSteps.js | 17 +++++++++--------
frontend/src/pages/ActivityReport/index.css | 9 +++++++++
frontend/src/pages/ActivityReport/index.js | 8 ++++++--
frontend/src/pages/Landing/__tests__/index.js | 2 +-
frontend/src/pages/Landing/index.js | 4 ++--
15 files changed, 66 insertions(+), 47 deletions(-)
diff --git a/frontend/src/components/Navigator/__tests__/index.js b/frontend/src/components/Navigator/__tests__/index.js
index bc0d4b3f42..48604e8ca7 100644
--- a/frontend/src/components/Navigator/__tests__/index.js
+++ b/frontend/src/components/Navigator/__tests__/index.js
@@ -83,6 +83,7 @@ describe('Navigator', () => {
onFormSubmit={onSubmit}
updatePage={updatePage}
onSave={onSave}
+ updateErrorMessage={() => {}}
/>,
);
};
diff --git a/frontend/src/components/Navigator/components/SideNav.js b/frontend/src/components/Navigator/components/SideNav.js
index 5fa6f267dd..333c2cd7fd 100644
--- a/frontend/src/components/Navigator/components/SideNav.js
+++ b/frontend/src/components/Navigator/components/SideNav.js
@@ -29,7 +29,7 @@ const tagClass = (state) => {
case REPORT_STATUSES.SUBMITTED:
return 'smart-hub--tag-submitted';
case REPORT_STATUSES.APPROVED:
- return 'smart-hub--tag-submitted';
+ return 'smart-hub--tag-approved';
case REPORT_STATUSES.NEEDS_ACTION:
return 'smart-hub--tag-needs-action';
default:
diff --git a/frontend/src/components/Navigator/components/__tests__/SideNav.js b/frontend/src/components/Navigator/components/__tests__/SideNav.js
index 76d995042f..ebd3ce9eb4 100644
--- a/frontend/src/components/Navigator/components/__tests__/SideNav.js
+++ b/frontend/src/components/Navigator/components/__tests__/SideNav.js
@@ -64,7 +64,7 @@ describe('SideNav', () => {
it('approved', () => {
renderNav(REPORT_STATUSES.APPROVED);
const complete = screen.getByText('Approved');
- expect(complete).toHaveClass('smart-hub--tag-submitted');
+ expect(complete).toHaveClass('smart-hub--tag-approved');
expect(complete).toBeVisible();
});
diff --git a/frontend/src/components/Navigator/index.js b/frontend/src/components/Navigator/index.js
index f07cba6583..39d03129d1 100644
--- a/frontend/src/components/Navigator/index.js
+++ b/frontend/src/components/Navigator/index.js
@@ -46,8 +46,9 @@ function Navigator({
updateLastSaveTime,
showValidationErrors,
updateShowValidationErrors,
+ errorMessage,
+ updateErrorMessage,
}) {
- const [errorMessage, updateErrorMessage] = useState();
const [showSavedDraft, updateShowSavedDraft] = useState(false);
const page = pages.find((p) => p.path === currentPage);
@@ -235,6 +236,8 @@ Navigator.propTypes = {
pageState: PropTypes.shape({}),
}).isRequired,
updateFormData: PropTypes.func.isRequired,
+ errorMessage: PropTypes.string,
+ updateErrorMessage: PropTypes.func.isRequired,
lastSaveTime: PropTypes.instanceOf(moment),
updateLastSaveTime: PropTypes.func.isRequired,
showValidationErrors: PropTypes.bool.isRequired,
@@ -267,6 +270,7 @@ Navigator.defaultProps = {
additionalData: {},
autoSaveInterval: 1000 * 60 * 2,
lastSaveTime: null,
+ errorMessage: '',
reportCreator: {
name: null,
role: null,
diff --git a/frontend/src/pages/ActivityReport/Pages/Review/Submitter/Submitted.js b/frontend/src/pages/ActivityReport/Pages/Review/Submitter/Submitted.js
index 0f39821bc7..e954ea1b7f 100644
--- a/frontend/src/pages/ActivityReport/Pages/Review/Submitter/Submitted.js
+++ b/frontend/src/pages/ActivityReport/Pages/Review/Submitter/Submitted.js
@@ -5,6 +5,16 @@ import {
Alert, Button,
} from '@trussworks/react-uswds';
+const NotEditableAlert = () => (
+
+ Report is not editable
+
+ This report is no longer editable while it is waiting for manager approval.
+ If you wish to update this report click "Reset to Draft" to
+ move the report back to draft mode.
+
+);
+
const Submitted = ({
additionalNotes,
approvingManager,
@@ -31,6 +41,7 @@ const Submitted = ({
{' '}
+
>
);
diff --git a/frontend/src/pages/ActivityReport/Pages/Review/index.js b/frontend/src/pages/ActivityReport/Pages/Review/index.js
index 02a475e274..3b06d073ed 100644
--- a/frontend/src/pages/ActivityReport/Pages/Review/index.js
+++ b/frontend/src/pages/ActivityReport/Pages/Review/index.js
@@ -8,6 +8,7 @@ import { Helmet } from 'react-helmet';
import Submitter from './Submitter';
import Approver from './Approver';
import PrintSummary from '../PrintSummary';
+import { REPORT_STATUSES } from '../../../../Constants';
import './index.css';
const ReviewSubmit = ({
@@ -61,6 +62,12 @@ const ReviewSubmit = ({
}
};
+ const editing = status === REPORT_STATUSES.DRAFT || status === REPORT_STATUSES.NEEDS_ACTION;
+ const items = editing ? reviewItems : reviewItems.map((ri) => ({
+ ...ri,
+ expanded: true,
+ }));
+
return (
<>
@@ -79,7 +86,7 @@ const ReviewSubmit = ({
error={error}
onSaveForm={onSaveForm}
>
-
+
)}
{approvingManager
@@ -92,7 +99,7 @@ const ReviewSubmit = ({
error={error}
formData={formData}
>
-
+
)}
>
diff --git a/frontend/src/pages/ActivityReport/Pages/__tests__/nextSteps.js b/frontend/src/pages/ActivityReport/Pages/__tests__/nextSteps.js
index 2a9e72a75c..670e558615 100644
--- a/frontend/src/pages/ActivityReport/Pages/__tests__/nextSteps.js
+++ b/frontend/src/pages/ActivityReport/Pages/__tests__/nextSteps.js
@@ -7,12 +7,12 @@ import { FormProvider, useForm } from 'react-hook-form/dist/index.ie11';
import nextSteps from '../nextSteps';
-const SPECIALIST_NEXT_STEPS = 'Specialist Next Steps';
+const SPECIALIST_NEXT_STEPS = 'Specialist next steps';
const SPECIALIST_INPUT = 'specialistNextSteps-input';
const SPECIALIST_BUTTON = 'specialistNextSteps-button';
const SPECIALIST_CANCEL_BUTTON = 'specialistNextSteps-cancel-button';
-const GRANTEE_NEXT_STEPS = 'Grantees Next Steps';
+const GRANTEE_NEXT_STEPS = 'What has the grantee agreed to do next';
const GRANTEE_INPUT = 'granteeNextSteps-input';
const GRANTEE_BUTTON = 'granteeNextSteps-button';
const GRANTEE_CANCEL_BUTTON = 'granteeNextSteps-cancel-button';
@@ -125,7 +125,7 @@ describe('next steps', () => {
renderNextSteps(
[{ note: 'pikachu', id: 1 }, { note: 'bulbasaur', id: 30 }],
);
- const newEntry = await screen.findByText('Add New Follow Up');
+ const newEntry = await screen.findByText('Add New Next Step');
userEvent.click(newEntry);
// When the user presses cancel to change their mind
@@ -143,7 +143,7 @@ describe('next steps', () => {
[],
[{ note: 'pikachu', id: 1 }, { note: 'bulbasaur', id: 30 }],
);
- const newEntry = await screen.findByText('Add New Follow Up');
+ const newEntry = await screen.findByText('Add New Next Step');
userEvent.click(newEntry);
// When the user presses cancel to change their mind
diff --git a/frontend/src/pages/ActivityReport/Pages/components/Objective.css b/frontend/src/pages/ActivityReport/Pages/components/Objective.css
index c043028181..8dc3347c4e 100644
--- a/frontend/src/pages/ActivityReport/Pages/components/Objective.css
+++ b/frontend/src/pages/ActivityReport/Pages/components/Objective.css
@@ -13,7 +13,3 @@
.usa-form .smart-hub--button__no-margin {
margin-top: 0;
}
-
-.smart-hub--text-area__resize-vertical {
- resize: vertical;
-}
\ No newline at end of file
diff --git a/frontend/src/pages/ActivityReport/Pages/components/ResourceSelector.js b/frontend/src/pages/ActivityReport/Pages/components/ResourceSelector.js
index 73e1c26a2d..0d25366ba1 100644
--- a/frontend/src/pages/ActivityReport/Pages/components/ResourceSelector.js
+++ b/frontend/src/pages/ActivityReport/Pages/components/ResourceSelector.js
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import { useFormContext, useFieldArray } from 'react-hook-form/dist/index.ie11';
-import { Button, TextInput } from '@trussworks/react-uswds';
+import { Button, Textarea } from '@trussworks/react-uswds';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
import { faCircle } from '@fortawesome/free-regular-svg-icons';
@@ -31,16 +31,12 @@ const ResourceSelector = ({ name, ariaName }) => {
<>
{fields.map((item, index) => (
-
{
- if (e.key === 'Enter') {
- onAddNewResource();
- }
- }}
/>
{canDelete && (