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

FP-990 & FP-1255: Update <IntroMessage> to Use Dismissible <SectionMessage> #616

Merged

Conversation

wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Mar 24, 2022

To Do

Done
  • Reduce harshness of section message text and border (or create new ticket). — source
  • Get Design approval on proposed new colors. — request

Overview:

Use SectionMessage, not Alert, for page welcome messages.

Related Jira tickets:

Summary of Changes:

  • Support dismissible <SectionMessage>
  • Use <SectionMessage> not <Alert>.
  • Update documentation and tests.
  • Tweak CSS.

Testing Steps:

FP-990

  1. Follow task/FP-327 - Onboarding welcome messages #191 "Testing Steps".
  2. Confirm message design matches <SectionMessage> (see UI Patterns) not <Alert>.

FP-1225

  1. Open UI Patterns.
  2. Scroll to Messages & Notifications.
  3. Dismiss the Section messages in the content—confirm they disappear.
  4. Reload the section—confirm the dismissed Section messages have returned.

UI Photos:

Before Initial UI New Approved UI
Main PR Proposal
Dismissal.mov
Before Click After Click
Before After

Questions:

What is the easy way to get messages to re-appear after dismissing them? They are no longer in browser storage, so I can't just delete their statuses like I could before.

@codecov
Copy link

codecov bot commented Mar 24, 2022

Codecov Report

Merging #616 (f569ac6) into main (5adcb06) will increase coverage by 2.70%.
The diff coverage is 88.23%.

❗ Current head f569ac6 differs from pull request most recent head 44a3489. Consider uploading reports for the commit 44a3489 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #616      +/-   ##
==========================================
+ Coverage   67.51%   70.21%   +2.70%     
==========================================
  Files         408      200     -208     
  Lines       12761     5529    -7232     
  Branches     2339     1567     -772     
==========================================
- Hits         8615     3882    -4733     
+ Misses       3861     1571    -2290     
+ Partials      285       76     -209     
Flag Coverage Δ
javascript 70.21% <88.23%> (+0.05%) ⬆️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...components/_common/InlineMessage/InlineMessage.jsx 100.00% <ø> (ø)
client/src/components/_common/Message/Message.jsx 97.22% <ø> (ø)
...c/components/_common/IntroMessage/IntroMessage.jsx 80.00% <66.66%> (+8.57%) ⬆️
...mponents/_common/SectionMessage/SectionMessage.jsx 94.11% <92.30%> (-5.89%) ⬇️
...src/components/_common/Section/SectionMessages.jsx 100.00% <100.00%> (ø)
server/portal/routing.py
server/portal/__init__.py
server/portal/apps/system_creation/dryrun.py
server/portal/apps/accounts/urls.py
server/portal/apps/datafiles/utils.py
... and 203 more

@wesleyboar wesleyboar marked this pull request as draft April 7, 2022 16:49
@wesleyboar wesleyboar changed the title FP-990: Update Intro Messages to Use <SectionMessage>s FP-990 & FP-1255: Update <IntroMessage> to Use Dismissible <SectionMessage> Apr 19, 2022
@wesleyboar wesleyboar marked this pull request as ready for review April 19, 2022 18:17
Copy link
Member Author

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

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

Section Message looks too harsh against the Portal UI (source).

Update: I proposed new colors to Design. [Color changes were approved.]

I know I break no other styles because only Message...css used these.
Copy link
Member Author

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

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

Notes for reviewers.

expect(
getByRole('alert', { class: /introMessageGeneral/i })
).toBeInTheDocument();
expect(getByRole('status', { name: 'message' })).toBeInTheDocument();
Copy link
Member Author

Choose a reason for hiding this comment

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

Explanation. Update test for <IntroMessage>, which has different aria role than did <Alert>. The aria role for any <(...)Message> is status.

import { useDispatch, useSelector } from 'react-redux';

import { SectionMessage } from '_common';
Copy link
Member Author

Choose a reason for hiding this comment

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

Changes on this page are for FP-990.

expect(getByRole('alert')).not.toEqual(null);
expect(getByRole('status')).not.toEqual(null);
Copy link
Member Author

@wesleyboar wesleyboar Apr 20, 2022

Choose a reason for hiding this comment

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

Explanation. Same as for <ManageAccount> test update.

*/
const Message = ({
ariaLabel,
Copy link
Member Author

Choose a reason for hiding this comment

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

Explanation. Changes about ARIA label (see ff2a61e) are related to fixing <ManageAccount> test case.

Comment on lines -64 to +65
.is-info .icon {
.is-info .icon:not(.close-icon) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Explanation. Fix same problem as in #615 (comment), but using my proposed solution.

@@ -54,7 +54,7 @@ function SectionMessages({
const introMessageContent = introMessageText || MESSAGES[introMessageName];
const introMessage = introMessageContent && (
/* FAQ: Alternate message name allows tracking custom message dismissal */
<IntroMessage messageName={introMessageName || introMessageText}>
<IntroMessage messageName={introMessageName || introMessageText} canDismiss>
Copy link
Member Author

Choose a reason for hiding this comment

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

Directly for FP-1255.

* <Sample jsx>
* // basic usage
* <SectionMessage type="warning">Uh oh.</SectionMessage>
* @see _common/Message
*/
const SectionMessage = (props) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Changes below on this page are for FP-1255.

Comment on lines +14 to +15
const autoManageVisible = props.canDismiss && props.isVisible === undefined;
const autoManageDismiss = props.canDismiss && props.onDismiss === undefined;
Copy link
Member Author

@wesleyboar wesleyboar Apr 20, 2022

Choose a reason for hiding this comment

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

Explanation. If users want a dismissible message—i.e. they passed canDismissbut choose to not manage that logic themselves—via isVisible and onDismissthen this component will manage that logic automatically.

P.S. Alternative ideas are welcome.

Comment on lines -39 to +41
--global-color-info--normal: var(--global-color-primary--x-dark);
--global-color-info--weak: var(--global-color-primary--x-light);
--global-color-info--dark: var(--global-color-primary--x-dark);
--global-color-info--normal: var(--global-color-primary--normal);
--global-color-info--light: var(--global-color-primary--x-light);
Copy link
Member Author

Choose a reason for hiding this comment

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

Note. I slowly replace --weak colors with "standardly-named" --(x-)light and --(x-)dark.

Copy link
Member

@rstijerina rstijerina left a comment

Choose a reason for hiding this comment

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

LGTM, nice work!

@@ -170,6 +191,7 @@ Message.propTypes = {
type: PropTypes.oneOf(TYPES).isRequired,
};
Message.defaultProps = {
ariaLabel: 'message',
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@duckonomy duckonomy left a comment

Choose a reason for hiding this comment

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

Works well! I'll try to merge this into my FP-1375 PR (has similar parts for SectionMessages).

Left a few comments for style.

Comment on lines +36 to +38
if (autoManageDismiss) {
messageProps.onDismiss = onDismiss;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't line 30 set onDismiss regardless?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, nice catch. Line 30 is cruft. This conditional setting of the variable is desired. I dropped line 30 (ce6795f) and re-tested successfully.

@wesleyboar wesleyboar requested a review from duckonomy May 3, 2022 21:51
Copy link
Contributor

@duckonomy duckonomy left a comment

Choose a reason for hiding this comment

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

LGTM!

@wesleyboar wesleyboar merged commit b8bf18b into main May 4, 2022
@wesleyboar wesleyboar deleted the test/FP-990-section-message-not-alert-for-intro-message branch May 4, 2022 15:23
@rstijerina rstijerina changed the title FP-990 & FP-1255: Update <IntroMessage> to Use Dismissible <SectionMessage> FP-990 & FP-1255: Update <IntroMessage> to Use Dismissible <SectionMessage> May 17, 2022
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