Overview
At OYO, understanding the lifecycle of a booking is critical for customer support, operations, and analytics. A comprehensive timeline view helps our teams quickly grasp the history of a booking, from confirmation to check-out, including any issues or modifications. This problem challenges you to build a robust and interactive timeline component to visualize these events.
What you need to do / Task
Your goal is to create a BookingTimeline React component that displays a series of chronological events related to a specific booking.
- Event Display: Render a list of events, each showing its type (e.g., "Booking Confirmed"), a concise title, and its timestamp.
- Date Grouping: Group events visually by their date. Events occurring today should be under a "Today" heading, yesterday under "Yesterday", and older events under an "Earlier" heading.
- Interactive Details: Each event should be clickable. Upon clicking, it should expand to reveal additional details (e.g., a longer description, specific data points), and collapse when clicked again.
- Event Filtering: Implement a filtering mechanism (e.g., a set of buttons or a dropdown) that allows users to filter events by their category (e.g.,
BOOKING, PAYMENT, GUEST, SUPPORT, SYSTEM). The filter should be persistent until changed.
- "Jump to Latest" Functionality: Include a floating button, visible when the user scrolls down, that allows them to quickly jump back to the most recent events at the top of the timeline.
UI/UX expectations
- Layout: The timeline should be vertically oriented. Each event should be clearly distinguishable. Date groupings should have clear headings.
- Interactions: Filtering should be intuitive. Expanding/collapsing events should be smooth. The "Jump to Latest" button should be easily discoverable and responsive to scroll position.
- Accessibility: Ensure filter controls are keyboard navigable. Expanded content should be accessible.
Acceptance criteria
- The component correctly renders all provided events in chronological order (most recent first).
- Events are accurately grouped under "Today", "Yesterday", and "Earlier" headings based on their timestamp.
- Clicking an event toggles the visibility of its detailed information.
- The filtering mechanism correctly filters events based on the selected category.
- A "Jump to Latest" button appears when the user scrolls down and, when clicked, scrolls the view to the top of the timeline.
- The component is responsive enough to be usable on typical desktop and mobile screen sizes.