Skip to content

Commit

Permalink
Merge branch 'main' into js-332-accessibility-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jasalisbury committed Mar 10, 2021
2 parents e1b9f45 + bd830f9 commit 9c6108f
Show file tree
Hide file tree
Showing 54 changed files with 1,620 additions and 281 deletions.
12 changes: 6 additions & 6 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: "js-332-accessibility-updates"
default: "js-152-browser-controls"
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 Expand Up @@ -381,7 +381,7 @@ jobs:
cloudgov_password: CLOUDGOV_PROD_PASSWORD
cloudgov_space: CLOUDGOV_PROD_SPACE
deploy_config_file: deployment_config/prod_vars.yml
new_relic_license: PROD_NEW_RELIC_LICENSE_KEY
new_relic_license: NEW_RELIC_LICENSE_KEY
session_secret: PROD_SESSION_SECRET
hses_data_file_url: PROD_HSES_DATA_FILE_URL
hses_data_username: PROD_HSES_DATA_USERNAME
Expand Down
1 change: 1 addition & 0 deletions Staticfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
root: maintenance_page
2 changes: 1 addition & 1 deletion deployment_config/prod_vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ web_memory: 512M
worker_instances: 1
worker_memory: 512M
LOG_LEVEL: info
AUTH_BASE: TKTK
AUTH_BASE: https://hses.ohs.acf.hhs.gov
# This env variable should go away soon in favor of TTA_SMART_HUB_URI
REDIRECT_URI_HOST: https://ttahub.ohs.acf.hhs.gov
TTA_SMART_HUB_URI: https://ttahub.ohs.acf.hhs.gov
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
2 changes: 2 additions & 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 All @@ -24,6 +25,7 @@
"react-hook-form": "^6.15.0",
"react-idle-timer": "^4.4.2",
"react-input-autosize": "^3.0.0",
"react-js-pagination": "^3.0.3",
"react-responsive": "^8.1.1",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
Expand Down
2 changes: 2 additions & 0 deletions frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/logo64.png" />
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Merriweather&display=swap" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,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
4 changes: 2 additions & 2 deletions frontend/src/fetchers/activityReports.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export const getReport = async (reportId) => {
return report.json();
};

export const getReports = async () => {
const reports = await get(activityReportUrl);
export const getReports = async (sortBy = 'updatedAt', sortDir = 'desc', offset = 0, limit = 10) => {
const reports = await get(`${activityReportUrl}?sortBy=${sortBy}&sortDir=${sortDir}&offset=${offset}&limit=${limit}`);
return reports.json();
};

Expand Down
Binary file added frontend/src/images/blue-circle.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ -253,7 +254,7 @@ const ActivitySummary = ({
</Grid>
<Grid col={5}>
<FormItem
label="Duration in hours"
label="Duration in hours (round to the nearest half hour)"
name="duration"
>
<TextInput
Expand All @@ -275,9 +276,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 @@ -287,7 +288,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 @@ -310,11 +311,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

0 comments on commit 9c6108f

Please sign in to comment.