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 Mark All as Read button as a prop #6

Closed
bsakethreddy opened this issue Dec 17, 2020 · 4 comments · Fixed by #8
Closed

Add Mark All as Read button as a prop #6

bsakethreddy opened this issue Dec 17, 2020 · 4 comments · Fixed by #8
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@bsakethreddy
Copy link

Able to access the button Mark All as Read from prop gives a chance to control data.
The Problem : Updating data using useState in React causing the entire component to re-render. If we can get the controll over Mark All as Read Button, we can delete data accordingly using localStorage.

@atapas atapas added enhancement New feature or request help wanted Extra attention is needed labels Dec 17, 2020
@atapas atapas added this to the dec-20 milestone Dec 17, 2020
@NagarjunShroff NagarjunShroff self-assigned this Dec 18, 2020
@atapas atapas linked a pull request Dec 18, 2020 that will close this issue
@atapas
Copy link
Owner

atapas commented Dec 18, 2020

We will be adding an ability to provide a function as a prop for the "Mark as Read" button handler. The default behavior of the button will be as it is today. However, the behavior can be completely overridden based on the use-cases by passing a function as a prop.

@bsakethreddy, You can observe the Linked pull request with this issue. Just FYI..

@bsakethreddy
Copy link
Author

bsakethreddy commented Dec 18, 2020 via email

@atapas
Copy link
Owner

atapas commented Dec 18, 2020

@bsakethreddy, Thanks! Great to know your interest in contributing as well. Will be looking forward to it.

I felt there is a need for documentation on how to handle the data which we
are giving to Notify.

Sure, I'll take it up. Please feel free to create an issue. We can take care of it early next year(after vacation time).

what I planned is to store the data in localstorage and when the user clicks on MarkAsRead Button I will reset the local storage. With this, the notification container contains messages which are unread only. I think internally you are doing the same but can we get access to the same?

So with the approach of allowing you to pass your own implementation for the Mark as Read button, would it be helpful for you to tackle the current situation? Now a new prop will be available to pass the implementation as a function. There is a PR created for it already.

@atapas atapas closed this as completed in #8 Dec 21, 2020
@atapas
Copy link
Owner

atapas commented Dec 21, 2020

@bsakethreddy, This fix is now available with the 0.0.9 version.

https://www.npmjs.com/package/react-notification-timeline/v/0.0.9

An additional(optional) prop can be passed now for overriding the mark as read default functionality,

<NotifyMe
  data={data}
  storageKey='notific_key'
  notific_key='timestamp'
  notific_value='update'
  heading='Notification Alerts'
  sortedByKey={false}
  showDate={true}
  size={64}
  color="yellow"
  markAsReadFn={() => yourOwnFunctionHandler()}
/>

Hence closed this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants