Overview
Clevertap's platform empowers marketers to orchestrate complex campaigns across various channels. A critical aspect of campaign management is visualizing scheduled activities over time. This problem focuses on building a simplified, interactive timeline component, often referred to as a Gantt Chart, to help users understand campaign schedules, identify overlaps, and manage their marketing initiatives efficiently. This visualization is key for planning and operational oversight.
What you need to do / Task
Your task is to build a React component that displays a list of marketing campaigns on a timeline. The component should visually represent each campaign as a bar, positioned and sized according to its start and end dates. The timeline should span a predefined period, and include an indicator for the current date.
- Render the Timeline Structure: Create a container for the timeline, with a clear horizontal axis displaying days for a fixed period (e.g., 14 days).
- Display Campaign Bars: For each provided campaign, render a visual bar element within the timeline.
- Position and Size Campaign Bars: Each bar's horizontal position and width must accurately reflect its
startDate and endDate relative to the overall timeline view.
- Handle Overlapping Campaigns: Implement a strategy to visually separate overlapping campaigns. A common approach is to assign them to distinct horizontal 'tracks' or rows to prevent direct visual collision and maintain readability.
- Current Date Indicator: Display a vertical line or marker on the timeline indicating the current date.
- Interactive Tooltip: When a user hovers over a campaign bar, display a small tooltip showing the campaign's
name, startDate, and endDate.
UI/UX expectations
- Layout: The timeline should have a clear header for dates (e.g., 'Day 1', 'Day 2' or actual dates) and a main area for campaign bars.
- Campaign Bars: Each bar should be visually distinct (e.g., using its assigned color). Text labels (campaign name) should be visible on the bars if space permits.
- Responsiveness: The component should be reasonably responsive, adapting to different container widths (within the constraints of a fixed date range).
- Interactions: The hover tooltip should appear and disappear smoothly.
- Clarity: The overall visualization should be easy to read and interpret, allowing users to quickly grasp campaign durations and overlaps.
Acceptance criteria
- The timeline component renders correctly with a visible date axis.
- All provided mock campaigns are displayed as distinct bars on the timeline.
- Campaign bars are accurately positioned and sized according to their
startDate and endDate relative to the timeline's visible range.
- Overlapping campaigns are visually separated (e.g., placed on different vertical tracks/rows).
- A clear 'current date' indicator is present and correctly positioned on the timeline.
- Hovering over any campaign bar displays a tooltip with its
name, startDate, and endDate.
- The application is free of console errors and warnings.