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

Trigger Button with notifications #2552

Merged
merged 13 commits into from
Jul 10, 2023
Merged

Trigger Button with notifications #2552

merged 13 commits into from
Jul 10, 2023

Conversation

Iru89
Copy link
Contributor

@Iru89 Iru89 commented Jul 4, 2023

Description

Be able to show in the trigger button the number of received and unread messages. I consider a message unread when I receive it and the webchat is closed.

Context

In local is not working well as the message sets the ack to 1 directly.
Display a notification with the number of unread messages.
CustomTriggerButton
Captura de Pantalla 2023-07-04 a las 13 59 39
DefaultTriggerButton
DefaultTriggerButton

Approach taken / Explain the design

Each time the action of webchatReducer addMessageComponent is called if the webchat is closed and the message ack is 0, I increment the state of unreadMessages by 1. When I reset unreadMessages

The div displaying unread messages has className='trigger-notifications' to be able to adjust the css

To document / Usage example

Testing

The pull request...

  • has unit tests
  • has integration tests
  • doesn't need tests because... [provide a description]

packages/botonic-react/src/webchat/hooks.js Outdated Show resolved Hide resolved
packages/botonic-react/src/webchat/webchat.jsx Outdated Show resolved Hide resolved
packages/botonic-react/src/webchat/hooks.js Outdated Show resolved Hide resolved
@Iru89 Iru89 requested a review from asastre July 7, 2023 08:47
@Iru89 Iru89 marked this pull request as ready for review July 7, 2023 08:47
@Iru89 Iru89 requested a review from ericmarcos July 7, 2023 09:05
Copy link
Contributor

@asastre asastre left a comment

Choose a reason for hiding this comment

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

👏 Very nice and clean refactor!! 🚀

@AinaVendrell
Copy link
Contributor

check the test that are failing

@Iru89 Iru89 merged commit 867eb54 into master-lts Jul 10, 2023
3 of 4 checks passed
@Iru89 Iru89 deleted the trigger-notifications branch July 10, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants