Overview
The Notification Center is a critical component of any engaging application, keeping users informed about important updates, messages, and activities. For Snap, a dynamic and responsive notification feed is essential for user retention and real-time interaction. This problem focuses on building the core UI and state management for such a feed, allowing users to manage their notifications efficiently.
What you need to do / Task
Your task is to build a React component that displays a list of notifications and allows users to interact with them.
- Display Notifications: Render a list of notifications, each showing its
message and timestamp. Visually distinguish between read and unread notifications (e.g., different background color, bold text).
- Mark as Read (Individual): Implement a button or clickable area on each notification to mark it as read. Once marked, its visual status should update.
- Mark All as Read: Provide a global button to mark all currently displayed notifications as read.
- Unread Count: Display the total number of unread notifications prominently (e.g., "Unread: 5"). This count should update dynamically as notifications are marked read/unread.
- Filter Notifications: Implement a toggle or set of buttons (e.g., "All", "Unread") to filter the displayed notifications.
- "All": Shows all notifications.
- "Unread": Shows only unread notifications.
UI/UX expectations
- The application should have a main container for the Notification Center.
- A header should display the "Unread" count.
- Control buttons (e.g., "Mark All as Read", filter buttons) should be clearly visible at the top.
- Notifications should be displayed in a vertical list.
- Each notification item should clearly show its content and provide an action to mark it as read.
- Visual cues (e.g., bolding, background color) should differentiate read from unread notifications.
- Basic responsiveness is expected, ensuring the layout is usable on a standard desktop browser.
Acceptance criteria
- Initial render displays all mock notifications, with correct read/unread status.
- Clicking an individual "Mark as Read" button changes that notification's status and updates its visual representation.
- Clicking "Mark All as Read" updates the status of all currently displayed notifications to read.
- The unread count accurately reflects the number of unread notifications at all times.
- Switching the filter (e.g., from "All" to "Unread") correctly shows only the relevant notifications.
- Notifications persist their read/unread status when switching filters.