Frontend School

Nykaa Product Launch Timeline (Gantt Chart)

Machine Coding
hard

Nykaa Product Launch Timeline (Gantt Chart)

Hard
React
UI
Gantt Chart
Date Manipulation
State Management

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.

  1. 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.
  2. Timeline Axis: Implement a clear date axis (e.g., showing months or weeks) at the top of the chart.
  3. Dynamic 'Today' Line: Render a vertical line indicating the current date, which should update dynamically (e.g., every minute or on load).
  4. 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).
  5. 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.

Constraints

Constraints & assumptions

  • You must use React for this implementation. No other UI frameworks are allowed.
  • You are provided with a fixed set of mock task data. Assume this data is static; no API calls are needed.
  • The chart should display a fixed time window (e.g., 3-4 months). You can use the CHART_START_DATE and CHART_END_DATE provided in the starter code as the boundaries for this window.
  • Do not use any external Gantt chart libraries (e.g., DHTMLX Gantt, react-gantt-chart). Implement the core rendering logic yourself.
  • The styling should be basic but functional; focus on correct layout and visual distinctions. Responsiveness is not a primary concern but a clean CSS approach is expected.
  • The current date (new Date()) should be used to determine the 'Today' line position and identify overdue tasks.
  • Target resolution: Desktop view.

Out of scope

  • Dragging/resizing task bars.
  • Filtering or sorting tasks.
  • Complex date range selection or navigation.
  • Persisting task data to a backend or local storage.

What interviewers evaluate

  • Architectural Design: How well the component is structured, separation of concerns, and effective use of React patterns.
  • Date Manipulation & Logic: Accuracy in calculating task bar positions and widths based on dates, and correctly identifying overdue tasks.
  • State Management: Correct use of useState and useEffect for managing task status and dynamic UI elements.
  • UI Implementation: Proper rendering of UI elements, visual differentiation of task states, and basic CSS for layout.
  • Code Quality: Readability, maintainability, and error handling (if applicable).

Loading editor...