Frontend School

Dynamic Multi-Stage Manufacturing Progress Tracker

Machine Coding
hard

Dynamic Multi-Stage Manufacturing Progress Tracker

Hard
React
TypeScript
UI
Progress Bar
State Management
Accessibility
Animation

Overview

Lenskart's custom lens manufacturing process involves several precise and sequential stages, from initial design to final dispatch. To provide real-time visibility and ensure efficient operations for our internal teams, we need a robust UI component that accurately tracks the progress of a specific lens order through its entire manufacturing pipeline. This problem challenges you to build a dynamic, multi-stage progress bar component that clearly reflects the current status of an order, handles updates efficiently, and provides intuitive visual feedback.

What you need to do / Task

  1. Develop a ManufacturingProgressTracker React component: This component will be the core of your solution.
  2. Accept Stage Data: The component must accept an array of stages as a prop. Each stage object will contain an id, name (e.g., "Lens Cutting"), and status (e.g., inProgress, completed, failed, pending).
  3. Visual Representation: Visually represent each stage as a distinct segment within the overall progress tracker.
  4. Dynamic Updates: The component should update its display dynamically whenever the stages prop changes (e.g., when a stage's status changes from pending to inProgress).
  5. Overall Progress Display: Calculate and display the overall completion percentage of the entire manufacturing process.
  6. Simulated Interaction: The App.tsx provides buttons to simulate advanceProgress, failCurrentStage, and resetProgress. Your component should correctly respond to these state changes.

UI/UX expectations

  • Stage Labels: Each stage segment should clearly display its name.
  • Status Distinction: Different statuses (pending, inProgress, completed, failed) must be visually distinguishable (e.g., using different background colors, border styles, or icons).
  • Active Indicator: The inProgress stage should feature a subtle, active visual indicator or animation (e.g., a pulsating effect, a continuous stripe animation).
  • Overall Progress Bar: A primary progress bar should visually represent the overall completion percentage, filling up as more stages are completed.
  • Accessibility: Ensure basic accessibility by using appropriate ARIA attributes for progress indicators and interactive elements where relevant.
  • Layout: The stages should be laid out horizontally, reflecting the sequential nature of the manufacturing process.

Acceptance criteria

  • The ManufacturingProgressTracker component renders correctly with initial stage data.
  • Each stage is visually represented with its label and its current status is clearly distinguishable.
  • The inProgress stage displays an active visual indicator or animation.
  • The overall progress percentage is accurately calculated based on completed stages and displayed prominently.
  • Updates to the stages prop (e.g., status changes via the provided buttons) are reflected dynamically and smoothly in the UI.
  • Appropriate ARIA attributes (e.g., aria-valuenow, aria-valuemin, aria-valuemax, aria-label) are applied to the main progress bar and individual stage elements for accessibility.

Constraints

Constraints & assumptions

  • The component will receive an array of stage objects, each with a name (string) and status (enum: pending, inProgress, completed, failed).
  • There will always be at least one stage.
  • Only one stage can be inProgress at any given time.
  • Stages are processed sequentially; a completed stage cannot revert to pending or inProgress. A failed stage will remain failed unless reset.
  • Focus on functional correctness, clean component architecture, and UI/UX adherence over pixel-perfect styling.

Out of scope

  • Backend integration or actual API calls for state management.
  • Complex error recovery mechanisms beyond displaying a failed state.
  • Full internationalization (i18n).
  • Deep customization props beyond the core stage data.

What interviewers evaluate

  • Component Design & State Management: How well the ManufacturingProgressTracker component is structured, its reusability, and efficient handling of dynamic prop updates.
  • UI/UX Implementation: Adherence to visual requirements (status distinction, active indicator), responsiveness, and clear user feedback.
  • Accessibility: Proper use of ARIA attributes to ensure usability for all users.
  • Code Quality: Readability, maintainability, use of appropriate React patterns, and basic performance considerations.

Loading editor...