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

[JN-1088] Admin form UX improvements + new task type #922

Merged
merged 14 commits into from
Jun 12, 2024

Conversation

MatthewBemis
Copy link
Member

@MatthewBemis MatthewBemis commented Jun 4, 2024

DESCRIPTION (include screenshots, and mobile screenshots for participant UX)

From talking with Erin and based on feedback from demos, it feels like the initial v0 UX for admin form editing was trying to do two separate things:

  1. Allow admins to edit or correct responses on behalf of users (not likely a super common use-case, but still a necessary feature)
  2. Allow study staff to do long or short-form data entry about a participant

As a result, this PR breaks the UX into two distinct flavors. To solve for the first use-case, participant-facing forms have the option to additionally be completed/edited by study-staff. For the second use-case, study staff have the option to create a "study staff" form which has the new survey type ADMIN. These are displayed separately from the research surveys so they don't live in the same bucket of forms as the participant-facing forms. ADMIN forms have ADMIN tasks associated with them, which do not show up on the participant dashboard.

This PR also adds an autosave indicator and adds an improved toggle for entering view/edit/print modes.

Screenshot 2024-06-04 at 8 57 03 AM

Screenshot 2024-06-04 at 2 13 13 PM

Screenshot 2024-06-04 at 9 00 43 AM

Screenshot 2024-06-04 at 9 00 33 AM

Screenshot 2024-06-04 at 9 12 06 AM

TO TEST: (simple manual steps for confirming core behavior -- used for pre-release checks)

  • Restart AdminApi and ParticipantApi
  • Add a new Study Staff form and assign it to existing participants https://localhost:3000/ourhealth/studies/ourheart/env/sandbox/forms
  • Log in to the participant site as "[email protected]" and verify that you do not see the admin form
  • Log back in as an admin, check that this task shows up for this enrollee and verify that you can complete it
  • Verify that you can still edit and print existing research surveys (assuming they are marked as editable by admins)

meta: {
columnType: 'string'
}
}, {
id: 'givenName',
header: 'Given name',
accessorKey: 'profile.givenName',
accessorFn: row => row.profile?.givenName,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

driveby fixes for browser console warning console.js:273 "lastLogin" in deeply nested key "participantUser.lastLogin" returned undefined.

@@ -90,7 +93,7 @@ export function LoadedEnrolleeView({ enrollee, studyEnvContext, onUpdate }:
<div style={navDivStyle}>
<ul className="list-unstyled">
<li style={navListItemStyle} className="ps-3">
<NavLink to="." className={getLinkCssClasses}>Overview</NavLink>
<NavLink end to="." className={getLinkCssClasses}>Overview</NavLink>
Copy link
Member Author

@MatthewBemis MatthewBemis Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

driveby fix for "Overview" navlink always having the "selected" CSS applied to it

@MatthewBemis MatthewBemis changed the title [JN-1088] Admin form UX improvements + new task type [wip] [JN-1088] Admin form UX improvements + new task type Jun 4, 2024
@MatthewBemis MatthewBemis marked this pull request as ready for review June 4, 2024 19:53
Copy link
Collaborator

@connorlbark connorlbark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into a couple strange bugs.

First, I wasn't able to save a response for a user when saving an admin form:

Screen.Recording.2024-06-05.at.9.28.26.AM.mov

I can only get it to save if it I hit the complete button, but it doesn't save in progress surveys.

Second, I could not replicate it, but I somehow saved a new version of an admin form and it ended up as a research form. I tried creating new admin surveys and creating new versions, but none of them exhibited the same behavior. Very strange...

image

Comment on lines +37 to +38
{/* @ts-ignore Link to type also supports numbers for back operations */}
<Link className="btn btn-secondary" to={-1}>Done</Link>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious: is there a behavior difference b/w '..' and -1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. navigates up one level in the route, -1 just goes to the previous page, wherever that may be. I had to change this because taskId is specified in the URL query params now, and .. causes those params to be stripped out, whereas -1 preserves them. I could have also kept using .. by grabbing the query params and passing them back in as a prop

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, very interesting. Thanks

Copy link
Collaborator

@devonbush devonbush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great -- really appreciate how you accomplished this with relatively little code. As discussed, I'll handle any needed migrations for HeartHive

Copy link

Copy link
Collaborator

@connorlbark connorlbark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works great! super snappy with the in-progress being updated in real time 😮

@MatthewBemis MatthewBemis added this pull request to the merge queue Jun 12, 2024
Merged via the queue into development with commit 59a2ff9 Jun 12, 2024
16 checks passed
@MatthewBemis MatthewBemis deleted the mb-admin-task-type branch June 12, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants