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

Add notification and toast #2883

Merged
merged 70 commits into from
Feb 14, 2020
Merged

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Feb 6, 2020

Fixes #2755.

Changelog Entry

Added

Samples

  • Resolves #2755, added "how to use notification and customize the toast UI" sample, by @compulim, in PR #2883

Description

This is feature work for adding a notification bar to Web Chat.

To add/set/replace a notification entry, use the following code.

store.dispatch({
  type: 'WEB_CHAT/SET_NOTIFICATION',
  payload: {
    id: 'success',
    level: 'success',
    message: 'You have successfully completed something'
  }
});

Design

Markdown support

All notifications message can be enriched by using Markdown. Hyperlinks will have rel="noopener noreferrer" and target="_blank" added for privacy reasons. Internally, it will use a version of Markdown-It renderer bundled with Web Chat. It will not use the version passed by the dev via renderMarkdown prop.

Sorting notifications

Notifications will be sorted with the most recent one on the top. If a notification is updated, they will be moved to the top of the list.

Updating notifications

All notifications are ID-ed using id. Notifications can be updated by dispatching `WEB_CHAT/SET_NOTIFICATION with the same ID.

After the notification is updated, their timestamp will be updated and they will be moved to the top of the list.

Multiple notifications

When more than one notification is visible, they will be collapsed as an accordion. The accordion can be expanded/collapsed through user gesture.

The color and icon of the accordion will be based on the highest level of all visible notifications. error > warn > info > success.

Connectivity status

Connectivity status will become part of notification and stored in Redux store.

The connectivity status visual will be hidden from the notification bar (i.e. <BasicNotificationBar>). A new component <BasicConnectivityStatus> will render the connectivity status exclusively.

Screenshots

Support Markdown

image

Multiple notifications

image

Single "success" notifications

image

Works under IE11

image

Specific Changes


  • Testing Added

@corinagum
Copy link
Contributor

@compulim if this PR is including changes to typing indicator and suggested actions, please include the issues linked in the following comment: #2871 (comment)

@compulim compulim changed the title [DRAFT] Add notification bar Add notification and toast Feb 10, 2020
@compulim compulim marked this pull request as ready for review February 10, 2020 01:03
@@ -212,6 +219,20 @@ const Composer = ({
};
}, [dispatch, directLine, userID, username]);

const internalMarkdownIt = useMemo(() => new MarkdownIt(), []);

const internalRenderMarkdownInline = useMemo(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to sanitize the resulting HTML? Also do we want the internalMarkdownIt to respect the carriage return style option?

https://github.com/microsoft/BotFramework-WebChat/blob/master/packages/bundle/src/renderMarkdown.js

@compulim compulim merged commit cc5f275 into microsoft:master Feb 14, 2020
@compulim compulim deleted the feat-notification branch February 14, 2020 11:32
@compulim compulim mentioned this pull request Mar 5, 2020
40 tasks
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.

Hiding The SendBox Hides Typing Animation [IC3] Notification toast
3 participants