Overview
Notification centers are crucial for engaging users by keeping them informed about important updates, messages, and activities within an application. For Gupshup, a platform focused on communication, a robust and intuitive notification system is paramount to user experience. In this problem, you will build a core component of such a system, focusing on displaying notifications and managing their read/unread states.
What you need to do / Task
Your goal is to implement a client-side Notification Center component that displays a list of notifications and allows users to manage their read/unread status.
- Display Notifications: Render a list of notifications, each showing its
message and timestamp.
- Mark as Read: Implement functionality to mark an individual notification as read. This should update its status and visual representation.
- Mark All as Read: Provide a button or action to mark all currently displayed notifications as read.
- Filter Notifications: Allow users to filter the list to show "All" notifications or only "Unread" notifications.
- Unread Count: Display the current count of unread notifications prominently.
UI/UX expectations
- The Notification Center should have a clear title (e.g., "Notifications").
- Each notification item should clearly display its message and timestamp.
- Unread notifications should be visually distinct from read ones (e.g., different background color, bold text).
- Each notification should have an interactive element (e.g., a button or click area) to mark it as read. This action should only be available for unread notifications.
- A "Mark All as Read" button should be present, ideally at the top of the list.
- Filter controls (e.g., toggle buttons) for "All" and "Unread" notifications should be available.
- The unread count should be visible and update dynamically.
Acceptance criteria
- Notifications are rendered correctly based on the provided mock data.
- Clicking an individual notification's "Mark as Read" action changes its state to read and updates its visual style.
- The "Mark All as Read" button correctly sets all notifications to read state.
- The filter mechanism correctly displays only unread notifications when "Unread" is selected, and all notifications when "All" is selected.
- The unread count accurately reflects the number of unread notifications and updates dynamically with state changes.
- The UI is responsive to user interactions without noticeable lag.