Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit bcca11c
Merge: 76231df a945aca
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 9 15:18:13 2021 -0600

    Merge pull request #205 from adhocteam/js-283-frontend-updates

    Frontend updates

commit a945aca
Merge: 3050a42 76231df
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 9 13:21:40 2021 -0600

    Merge branch 'main' into js-283-frontend-updates

commit 3050a42
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 9 13:20:23 2021 -0600

    Feedback from PR

     * Deploy to sandbox
     * Attachments edit link goes to correct page
     * Resources data types change to array of text instead of array of
    strings

commit 76231df
Merge: d694b96 64bf3cd
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 19:16:27 2021 +0000

    Merge pull request #218 from adhocteam/cm-302-create-mainenance-page

    Cm 302 create mainenance page

commit d694b96
Merge: a35691d 74ee33f
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 16:47:39 2021 +0000

    Merge pull request #220 from adhocteam/fix-double-import

    clean up double import

commit 74ee33f
Merge: 275e472 a35691d
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 16:36:10 2021 +0000

    Merge branch 'main' into fix-double-import

commit 275e472
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 11:32:11 2021 -0500

    clean up double import

commit a35691d
Merge: 5956089 ff1c224
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 16:04:41 2021 +0000

    Merge pull request #219 from adhocteam/cm-add-new-relic-to-worker

    add new relic to worker.js

commit ff1c224
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 10:50:47 2021 -0500

    move require to start of file.

commit 77173a4
Merge: eadf312 5956089
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 9 09:35:09 2021 -0600

    Merge branch 'main' into js-283-frontend-updates

commit 4931466
Author: Chuck McAndrew <6248903+dcmcand@users.noreply.github.com>
Date:   Tue Mar 9 09:49:04 2021 -0500

    add new relic to worker.js

commit eadf312
Merge: 64db2a9 e7db658
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Mon Mar 8 13:22:32 2021 -0600

    Merge branch 'main' into js-283-frontend-updates

    Conflicts:
    	frontend/src/pages/ActivityReport/Pages/components/Goal.js
    	src/seeders/20201124160449-users.js

commit 64db2a9
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Fri Mar 5 12:12:07 2021 -0600

    PR feedback

     * Set required font-family/size via uswds class
     * Use uswds margin classes instead of `smart-hub--*` classes
     * Wrap group of `await` calls in `Promise.all` inside resource
    migration
     * Remove File `attachmentType` field
     * Change trashcan icon's color to black to match other trashcan icons

commit 9438d3f
Merge: 0cf6743 92a929b
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Thu Mar 4 11:17:37 2021 -0600

    Merge branch 'main' into js-283-frontend-updates

    Conflicts:
    	.circleci/config.yml
    	frontend/src/pages/ActivityReport/Pages/topicsResources.js

commit 0cf6743
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Wed Mar 3 13:33:22 2021 -0600

    Dev/stagging now only forward migrate

commit e8b33b9
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Wed Mar 3 12:19:24 2021 -0600

    Remove josh as a user in the seeders

commit 642917c
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Wed Mar 3 11:20:24 2021 -0600

    Update HSES id for josh

commit 68be3b0
Merge: 354ab9f 36f3803
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Wed Mar 3 09:57:32 2021 -0600

    Merge branch 'main' into js-283-frontend-updates

commit 354ab9f
Merge: eeef66a 079fc8b
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 2 16:57:42 2021 -0600

    Merge branch 'js-283-frontend-updates' of github.com:adhocteam/Head-Start-TTADP into js-283-frontend-updates

commit eeef66a
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 2 16:57:13 2021 -0600

    Lint fix

commit 079fc8b
Merge: 01a6806 d0f5a95
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 2 16:55:12 2021 -0600

    Merge branch 'main' into js-283-frontend-updates

commit 01a6806
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 2 16:34:57 2021 -0600

    Update sandbox branch

commit 0603eb0
Author: Josh Salisbury <josh@adhocteam.us>
Date:   Tue Mar 2 16:33:14 2021 -0600

    Various frontend changes to better match design

     * Add resource selector
     * Virtual delivery method field added
     * Fix styling (margins colors etc)
     * Copy updates
  • Loading branch information
dcmcand committed Mar 9, 2021
1 parent d501eff commit 4ee6f76
Show file tree
Hide file tree
Showing 32 changed files with 392 additions and 180 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ parameters:
default: "main"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "cm-302-create-mainenance-page"
default: "js-283-frontend-updates"
type: string
jobs:
build_and_lint:
Expand Down Expand Up @@ -314,10 +314,10 @@ jobs:
hses_data_username: HSES_DATA_USERNAME
hses_data_password: HSES_DATA_PASSWORD
- run:
name: Return database to neutral, then migrate and seed
name: Migrate database
command: |
cf run-task tta-smarthub-sandbox \
--command "yarn db:migrate:undo:prod && yarn db:migrate:prod && yarn db:seed:prod" \
--command "yarn db:migrate:prod" \
--name "Reset DB"
- when: # dev
condition:
Expand All @@ -339,10 +339,10 @@ jobs:
hses_data_username: HSES_DATA_USERNAME
hses_data_password: HSES_DATA_PASSWORD
- run:
name: Undo database seeding, then migrate and seed
name: Migrate database
command: |
cf run-task tta-smarthub-dev \
--command "yarn db:migrate:prod && yarn db:seed:undo:prod && yarn db:seed:prod" \
--command "yarn db:migrate:prod" \
--name "Reset DB"
- when: # staging
condition:
Expand Down
3 changes: 0 additions & 3 deletions docs/openapi/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ components:
fileUpload:
type: object
properties:
attachmentType:
type: string
description: "Type of attachment. Acceptable values are ATTACHMENT or RESOURCE"
reportId:
type: number
description: "id of the Activity report the file is associated with"
Expand Down
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@babel/runtime": "^7.12.1",
"@fortawesome/fontawesome-free": "^5.15.1",
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-regular-svg-icons": "^5.15.2",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@fortawesome/react-fontawesome": "^0.1.11",
"@hookform/error-message": "^0.0.5",
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ body {
background-color: #f8f8f8;
}

.text-ink {
color: #21272D
}

.smart-hub-bg-blue-primary {
background-color: #0166ab;
}
Expand Down
15 changes: 4 additions & 11 deletions frontend/src/components/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import { uploadFile, deleteFile } from '../fetchers/File';

import './FileUploader.css';

export const upload = async (file, reportId, attachmentType, setErrorMessage) => {
export const upload = async (file, reportId, setErrorMessage) => {
let res;
try {
const data = new FormData();
data.append('reportId', reportId);
data.append('attachmentType', attachmentType);
data.append('file', file);
res = await uploadFile(data);
} catch (error) {
Expand All @@ -42,13 +41,7 @@ export const handleDrop = async (e, reportId, id, onChange, setErrorMessage) =>
setErrorMessage('Cannot save attachments without a Grantee or Non-Grantee selected');
return;
}
let attachmentType;
if (id === 'attachments') {
attachmentType = 'ATTACHMENT';
} else if (id === 'otherResources') {
attachmentType = 'RESOURCE';
}
const newFiles = e.map((file) => upload(file, reportId, attachmentType, setErrorMessage));
const newFiles = e.map((file) => upload(file, reportId, setErrorMessage));
Promise.all(newFiles).then((values) => {
onChange(values);
});
Expand All @@ -66,8 +59,8 @@ function Dropzone(props) {
{...getRootProps()}
>
<input {...getInputProps()} />
<button type="button" className="usa-button">
Browse files
<button type="button" className="usa-button usa-button--outline">
Upload Resources
</button>
{errorMessage
&& (
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/FormItem.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.smart-hub--form-required {
font-family: SourceSansPro;
font-size: 16px;
color: #d42240;
}
2 changes: 1 addition & 1 deletion frontend/src/components/FormItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function FormItem({
const labelWithRequiredTag = (
<>
{label}
{required && (<span className="smart-hub--form-required"> (Required)</span>)}
{required && (<span className="smart-hub--form-required font-family-sans font-ui-xs"> (Required)</span>)}
</>
);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/__tests__/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('upload tests', () => {
const mockSetErrorMessage = jest.fn();
it('can upload a file and return the correct information', async () => {
const mockFileUpload = jest.spyOn(fileFetcher, 'uploadFile').mockImplementation(async () => ({ id: 1, url: 'url' }));
const got = await upload(mockFile, 1, 'fakeAttachment', mockSetErrorMessage);
const got = await upload(mockFile, 1, mockSetErrorMessage);
expect(got).toStrictEqual({
id: 1, originalFileName: mockFile.name, fileSize: mockFile.size, status: 'UPLOADED', url: 'url',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Review = ({
</p>
</div>
<Form className="smart-hub--form-large" onSubmit={handleSubmit(onFormReview)}>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Review and submit report">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Review and submit report">
<Label htmlFor="managerNotes">Manager notes</Label>
<Textarea inputRef={register} id="managerNotes" name="managerNotes" className={textAreaClass} />
</Fieldset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Draft = ({
<>
<h2>Submit Report</h2>
<Form className="smart-hub--form-large" onSubmit={handleSubmit(onSubmit)}>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Additional Notes">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Additional Notes">
<FormItem
label="Creator notes"
name="additionalNotes"
Expand All @@ -46,7 +46,7 @@ const Draft = ({
<Textarea inputRef={register} id="additionalNotes" name="additionalNotes" className={textAreaClass} />
</FormItem>
</Fieldset>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Review and submit report">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Review and submit report">
<p className="margin-top-4">
Submitting this form for approval means that you will no longer be in draft
mode. Please review all information in each section before submitting to your
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ const RenderTopicsResourcesReview = ({ data }) => {

describe('Topics & resources', () => {
const data = {
otherResources: [{ originalFileName: 'other', url: { url: 'http://localhost/other' }, status: 'APPROVED' }],
attachments: [{ originalFileName: 'attachment', url: { url: 'http://localhost/attachment' }, status: 'APPROVED' }],
resourcesUsed: 'resources',
ECLKCResourcesUsed: [{ value: 'eclkc' }],
nonECLKCResourcesUsed: [{ value: 'nonEclkc' }],
topics: 'topics',
};

describe('review page', () => {
it('displays attachments and other resources', async () => {
render(<RenderTopicsResourcesReview data={data} />);
expect(await screen.findByText('other')).toBeVisible();
expect(await screen.findByText('eclkc')).toBeVisible();
expect(await screen.findByText('attachment')).toBeVisible();
expect(await screen.findByText('resources')).toBeVisible();
expect(await screen.findByText('nonEclkc')).toBeVisible();
expect(await screen.findByText('topics')).toBeVisible();
});
});
Expand Down
61 changes: 45 additions & 16 deletions frontend/src/pages/ActivityReport/Pages/activitySummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const ActivitySummary = ({
const activityRecipientType = watch('activityRecipientType');
const startDate = watch('startDate');
const endDate = watch('endDate');
const isVirtual = watch('deliveryMethod') === 'virtual';
const { nonGrantees: rawNonGrantees, grants: rawGrants } = recipients;

const grants = rawGrants.map((grantee) => ({
Expand Down Expand Up @@ -87,9 +88,9 @@ const ActivitySummary = ({
<Helmet>
<title>Activity summary</title>
</Helmet>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Who was the activity for?">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Who was the activity for?">
<div id="activity-for" />
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="Was this activity for a grantee or non-grantee?"
name="activityRecipientType"
Expand All @@ -113,7 +114,7 @@ const ActivitySummary = ({
/>
</FormItem>
</div>
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label={recipientLabel}
name="activityRecipients"
Expand All @@ -130,7 +131,7 @@ const ActivitySummary = ({
/>
</FormItem>
</div>
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="Collaborating Specialists"
name="collaborators"
Expand All @@ -149,7 +150,7 @@ const ActivitySummary = ({
</div>
{granteeSelected
&& (
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="Program type(s)"
name="programTypes"
Expand All @@ -164,7 +165,7 @@ const ActivitySummary = ({
</FormItem>
</div>
)}
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="Target Populations addressed. You may choose more than one."
name="targetPopulations"
Expand All @@ -179,9 +180,9 @@ const ActivitySummary = ({
</FormItem>
</div>
</Fieldset>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Reason for Activity">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Reason for Activity">
<div id="reasons" />
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="Who requested this activity? Use &quot;Regional Office&quot; for TTA not requested by grantee."
name="requester"
Expand All @@ -205,7 +206,7 @@ const ActivitySummary = ({
/>
</FormItem>
</div>
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="Reason(s). You may choose more than one."
name="reason"
Expand All @@ -218,7 +219,7 @@ const ActivitySummary = ({
</FormItem>
</div>
</Fieldset>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Activity date">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Activity date">
<div id="date" />
<div>
<Grid row gap>
Expand Down Expand Up @@ -251,7 +252,7 @@ const ActivitySummary = ({
</Grid>
<Grid col={5}>
<FormItem
label="Duration"
label="Duration (round to the nearest half hour)"
name="duration"
>
<TextInput
Expand All @@ -273,9 +274,9 @@ const ActivitySummary = ({
</Grid>
</div>
</Fieldset>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Training or Technical Assistance">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Training or Technical Assistance">
<div id="tta" />
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="What TTA was provided"
name="ttaType"
Expand All @@ -285,7 +286,7 @@ const ActivitySummary = ({
{renderCheckbox('ttaType', 'technical-assistance', 'Technical Assistance', 'Please specify the type of TTA provided')}
</FormItem>
</div>
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label="How was the activity conducted?"
name="deliveryMethod"
Expand All @@ -308,11 +309,39 @@ const ActivitySummary = ({
inputRef={register({ required: 'Please specify how the activity was conducted' })}
/>
</FormItem>
<div aria-live="polite">
{isVirtual && (
<div className="margin-top-2 smart-hub--virtual-delivery-group">
<FormItem
label="Please specify how the virtual event was conducted."
name="virtualDeliveryType"
fieldSetWrapper
>
<Radio
id="virtual-deliver-method-video"
name="virtualDeliveryType"
label="Video"
value="video"
className="smart-hub--report-checkbox"
inputRef={register({ required: 'Please specify how the virtual event was conducted' })}
/>
<Radio
id="virtual-deliver-method-telephone"
name="virtualDeliveryType"
label="Telephone"
value="telephone"
className="smart-hub--report-checkbox"
inputRef={register({ required: 'Please specify how the virtual event was conducted' })}
/>
</FormItem>
</div>
)}
</div>
</div>
</Fieldset>
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Participants">
<Fieldset className="smart-hub--report-legend margin-top-4" legend="Participants">
<div id="other-participants" />
<div className="smart-hub--form-section">
<div className="margin-top-2">
<FormItem
label={participantsLabel}
name="participants"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/ActivityReport/Pages/components/Goal.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Goals = ({

<div className="margin-left-auto">
<Button type="button" onClick={onRemoveGoal} unstyled className="smart-hub--button" aria-label={`remove goal ${goalIndex + 1}`}>
<FontAwesomeIcon color="gray" icon={faTrash} />
<FontAwesomeIcon color="black" icon={faTrash} />
</Button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const GoalPicker = ({
const uniqueAvailableGoals = uniqBy(allAvailableGoals, 'id');

return (
<div className="smart-hub--form-section">
<div className="margin-top-4">
<FormItem
label="You must select an established goal(s) OR create a new goal for this activity."
name="goals"
Expand Down

0 comments on commit 4ee6f76

Please sign in to comment.