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

feat: MI Assign activity screens (M2-7406) #534

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

farmerpaul
Copy link
Contributor

@farmerpaul farmerpaul commented Sep 4, 2024

  • Tests for the changes have been added
  • Related documentation has been added / updated
  • OSS packages added to MindLogger open source credit page

📝 Description

🔗 Jira Ticket M2-7406

Adds informative banners and labels to Activity screens when performing a multi-informant assignment.

  • Displays a new banner on the activity welcome screen informing the respondent who the assessment is about
  • Displays a label within each item's description (About {{name}}) below any media, and above the first line containing text content

📸 Screenshots

Before After
CleanShot 2024-09-04 at 17 57 47@2x CleanShot 2024-09-04 at 17 57 31@2x
CleanShot 2024-09-04 at 17 57 58@2x CleanShot 2024-09-04 at 17 56 53@2x
CleanShot 2024-09-04 at 17 58 09@2x CleanShot 2024-09-04 at 17 57 06@2x

🪤 Peer Testing

Note

This feature depends on the enableActivityAssign feature flag. This should already be enabled in dev/local environments. It would also be worth testing this with that feature flag disabled to confirm that existing behaviour is preserved with the MI Assign feature disabled, by adding features.enableActivityAssign = false prior to the return statement here in useFeatureFlags.

Please refer to ticket's AC for the main peer testing steps.

In addition, after completing a multi-informant assigned activity, confirm that the POST to the answers endpoint includes the appropriate targetSubjectId. Also confirm that for self-reports, that property is not included.

@farmerpaul farmerpaul marked this pull request as ready for review September 4, 2024 21:01
@farmerpaul farmerpaul changed the base branch from dev to feature/M2-7405-mi-assign-home-screen September 4, 2024 21:02
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-534.d15zn9do8xbzga.amplifyapp.com

@farmerpaul farmerpaul changed the title feat: MI Assign (M2-7406) feat: MI Assign activity screens (M2-7406) Sep 4, 2024
@farmerpaul farmerpaul requested a review from ChaconC September 4, 2024 22:06
Base automatically changed from feature/M2-7405-mi-assign-home-screen to dev September 5, 2024 13:16
This change is required for banners that lack a close button to render
correctly and accept custom icons.
This change required a markdown parser to be able to inject the label
below any paragraphs that contain only media (images, videos, audio)
and above the first paragraph that contains textual content.

Also noticed that the `Banners` component was incorrectly placed in a
scrollable container, making banner alerts (such as validation errors)
not appear to users who have scrolled down on an item that has a long
description.
@farmerpaul farmerpaul force-pushed the feature/M2-7406-mi-assign-activity-screen branch from d7b2d47 to e56fd76 Compare September 5, 2024 13:25
Copy link
Contributor

@sultanofcardio sultanofcardio left a comment

Choose a reason for hiding this comment

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

Approved with some minor feedback


This is slightly unrelated to this PR, but I noticed that if I start a take now, both sets of UI show up

image image

So we need to add the condition && activityListItem.targetSubject === null to this if statement

useOnceLayoutEffect(() => {
if (
context.startActivityOrFlow &&
((!isFlow && context.startActivityOrFlow === activityListItem.activityId) ||
(isFlow && context.startActivityOrFlow === activityListItem.flowId))
) {
// Pass `true` to ensure activity doesn't resume from a previous progress state.
onStartActivity(true);
}
});

src/shared/utils/helpers/insertAfterMedia.ts Outdated Show resolved Hide resolved
@farmerpaul
Copy link
Contributor Author

farmerpaul commented Sep 9, 2024

I incorporated your suggestions, @sultanofcardio. Good catch on the interaction of Take Now with MI Assign. It's not just the UI issue you identified that was introduced with MI Assign – Take Now will actually no longer start unless you are assigned (manually or auto) to the activity as a self-report. Since Take Now should take precedence over MI Assign, however, this needs to be fixed. I've created M2-7796 to address this.

Copy link
Contributor

@sultanofcardio sultanofcardio left a comment

Choose a reason for hiding this comment

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

Looks good

Copy link
Contributor

@mbanting mbanting left a comment

Choose a reason for hiding this comment

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

Nice work @farmerpaul. Just one small comment but pre-approving.

Peer tested successfully aside from the badge and banner also showing on Take Now, as @sultanofcardio pointed out. The suggested solution in ActivityCard/index.tsx seems to work, although I'm not entirely sure I understand how? If going with it, I suggest adding a comment so others coming across it understand why && activityListItem.targetSubject === null is needed.

src/shared/utils/helpers/insertAfterMedia.test.ts Outdated Show resolved Hide resolved
@farmerpaul
Copy link
Contributor Author

@mbanting incorporated your feedback! Thanks for the 👀

@farmerpaul farmerpaul merged commit bdef48c into dev Sep 9, 2024
3 checks passed
@farmerpaul farmerpaul deleted the feature/M2-7406-mi-assign-activity-screen branch September 9, 2024 19:44
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