-
Notifications
You must be signed in to change notification settings - Fork 1
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
Saving activity report - frontend #118
Conversation
* Reports are saved anytime a user navigates to a new page * Reports are automattically saved every 2 minutes (separate timer from the save on navigation) * New reports are created, previously created reports are updated on save * Multiselects can handle objects in addition to strings * Names of fields updated to match database field names * Last save time displayed under the sticked report navigator * Previously saved reports can be viewed by entering their id in the path of the url (`/activity-reports/{id}...`)
…team/Head-Start-TTADP into js-saving-activity-report-frontend
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.
Tested and everything works as described.
Are you planning on future changes to update the url after it saves (change form /activity-report/new to /activity-report/$REPORTID)?
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.
Fantastic work! 🎉
Couple of questions and comments:
Is the plan to use the group feature from react-select
for the Grants/Grantee display to match the design? Or did we clear with Aricka that we won't be showing the grouping with bold grantee names for the MVP?
I noticed that the ids
of ActivityParticipants
db table change on every save. Is that intended?
This multiselect component uses react-select. React select expects options and selected | ||
values to be in a specific format, arrays of `{ label: x, value: y }` items. Sometimes | ||
we want to just push in and pull out simple arrays of strings instead of these objects. | ||
Dealing with arrays of strings is easier then arrays of objects. The `simple` prop being |
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.
I think "then" was meant to be "than" (same comment for line11)
const onSave = async (data) => { | ||
const { participantType, activityParticipants } = data; | ||
if (reportId.current === 'new') { | ||
if (participantType && activityParticipants.length > 0) { |
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.
Should we check if activityParticipants
are not null
?
(I got an error when grantees/non-grantees were not filled in time for the timer to autosave)
Yeah that is because when an activity report is saved all |
Yeah I tried for a little while to update the URL but coudn't get it to update properly without a page reload. I'll probably revisit at some point in the future. In the meantime the |
I just pushed up a change that should group grants by grantee. |
The API now returns generic objects instead of objects setup for `react-select`. The frontend is responsible for formatting the objects into the proper format
Conflicts: docs/openapi/paths/activity-reports/activity-recipients.yaml src/services/activityReports.js
One other comment I forgot to mention was that the browser navigation seemed to have changed when trying to get to "Home" from "ActivityReports" using the browser's back button. The other way it worked perfectly fine. You could always got from "Home" to "ActivityReports". I am fine with merging this PR, but keeping in mind that might be something to re-visit. |
The grouping of the grantees looks great, btw! |
Description of change
Can save an activity report on the frontend
/activity-reports/{id}...
)How to test
https://tta-smarthub-sandbox.app.cloud.gov/activity-reports/{id}/activity-summary
(fill in the id from previous step)The only fields that do not save are the file upload fields and
collaborating users
.Issue(s)
Checklist