Overview
At Nykaa, launching new products is a core business driver. Managing the complex lifecycle from ideation to market launch, involving multiple teams (R&D, marketing, logistics, etc.), requires precise tracking. A visual timeline, like a Gantt chart, is invaluable for product managers to oversee progress, identify bottlenecks, and ensure timely delivery. This problem challenges you to build a simplified, interactive Gantt chart to visualize product launch phases.
What you need to do / Task
Your goal is to implement a React component that renders a Gantt chart for product launch tasks. The chart should display tasks as horizontal bars against a timeline, with key interactive and visual features.
- Render Task Bars: Display each task as a horizontal bar. The bar's position and width should accurately represent its
startDate and endDate on the timeline.
- Timeline Axis: Implement a clear date axis (e.g., showing months or weeks) at the top of the chart.
- Dynamic 'Today' Line: Render a vertical line indicating the current date, which should update dynamically (e.g., every minute or on load).
- Task Status Visualization: Visually differentiate tasks based on their status:
- Completed Tasks: Should have a distinct visual style (e.g., a lighter color, strikethrough, or opacity change).
- Overdue Tasks: Any pending task whose
endDate is in the past relative to the current date should be highlighted (e.g., with a red border or background).
- Complete Task Interaction: Implement a mechanism (e.g., a button or checkbox next to each task name) to mark a pending task as
completed. This action should update the task's status in the state and reflect immediately in the UI.
UI/UX expectations
- The chart should have a clear, easy-to-read layout with task names listed vertically on the left and the timeline horizontally on the right.
- Task bars should be distinct and visually represent their duration within their respective rows.
- The 'Today' line should be clearly visible, span the height of the chart area, and update to reflect the actual current date.
- Interaction to complete a task should be intuitive and immediately update the task's visual status.
- Consider basic accessibility for interactive elements (e.g., buttons).
Acceptance criteria
- The Gantt chart correctly renders all provided tasks as horizontal bars, with accurate start and end date positioning relative to the chart's time window.
- A visible timeline axis (e.g., monthly labels) is present at the top, aligning with the task bars below.
- A vertical 'Today' line is displayed, correctly positioned according to the current date and updating periodically or on initial load.
- Completed tasks are visually distinct from pending tasks (e.g., different color, opacity).
- Pending tasks with an
endDate before the current date are visually highlighted as overdue.
- Clicking the 'Complete' action for a task updates its status in the React state and correctly reflects the change in the UI.
- The component uses React state and props effectively to manage task data and UI updates.