Frontend School

Bigbasket Order Fulfillment Progress Tracker

Machine Coding
medium

Bigbasket Order Fulfillment Progress Tracker

Medium
React
TypeScript
UI
Progress Bar
State Management
Frontend

Overview

At Bigbasket, ensuring a transparent and engaging user experience is crucial. When customers place an order, they expect to know its current status and what's next. A well-designed progress bar helps manage expectations and reduces anxiety, improving overall satisfaction. This problem challenges you to build a robust and user-friendly progress bar component that can track the different stages of an order fulfillment process.

What you need to do / Task

Your primary task is to create a reusable React component called ProgressBar that visually represents the sequential stages of a process. For this problem, consider the process of a Bigbasket order fulfillment.

  1. Develop a ProgressBar component: This component should accept an array of step names (e.g., ['Order Placed', 'Processing', 'Out for Delivery', 'Delivered']) and the currentStepIndex as props.
  2. Display Progress: Visually represent the completed steps, the current step, and upcoming steps.
  3. Dynamic Updates: The component should respond to changes in currentStepIndex.
  4. Interaction: Implement a "Next Step" button in the parent App component that, when clicked, advances the currentStepIndex to the next stage.
  5. Completion State: Once all steps are completed (i.e., currentStepIndex reaches the last step), the "Next Step" button should be disabled, and the UI should clearly indicate completion.

UI/UX expectations

  • Layout: The progress bar should be horizontally oriented. Each step should be clearly distinguishable.
  • Visual Cues:
    • Completed steps should have a distinct visual indicator (e.g., a different background color, a checkmark icon, or a bolder label).
    • The current step should also be visually highlighted (e.g., a distinct color, larger size).
    • Upcoming steps should appear distinct but less prominent than completed/current steps.
    • There should be a visual line connecting the steps, with the completed portion of the line filled differently (e.g., a different color).
  • Textual Information: Display the name of each step. Optionally, display the overall progress (e.g., "Step 2 of 4").
  • Button: The "Next Step" button should be clearly labeled and styled appropriately. It should be disabled when the process is complete.
  • Accessibility: Consider basic accessibility, such as semantic HTML elements for the progress bar if time permits, but prioritize core functionality.

Acceptance criteria

  • The ProgressBar component correctly renders all provided steps.
  • Completed steps are visually distinct from the current and upcoming steps.
  • The current step is visually highlighted.
  • The connecting line between steps visually indicates progress.
  • Clicking the "Next Step" button increments the currentStepIndex in the App component's state.
  • The ProgressBar component updates its display correctly when currentStepIndex changes.
  • The "Next Step" button is disabled once the final step is reached.
  • The overall UI clearly indicates when the process is complete.

Constraints

Constraints & assumptions

  • You must use React with TypeScript.
  • Do not use any external UI component libraries (e.g., Material UI, Ant Design). Basic styling should be done using plain CSS.
  • Assume the steps are always sequential and cannot be skipped or revisited (i.e., currentStepIndex only increases).
  • The maximum number of steps will be relatively small (e.g., 2-7 steps).
  • Focus on functional components and hooks.

Out of scope

  • Complex animations or transitions beyond basic CSS effects.
  • Integration with a backend API for fetching real order data.
  • Deep accessibility considerations beyond basic semantic HTML.
  • Error handling for invalid steps data or currentStepIndex values.

What interviewers evaluate

  • Component Design: Reusability, clear props, and separation of concerns within the ProgressBar component.
  • State Management: Effective use of React hooks (useState) to manage component state and interactions.
  • UI/UX Implementation: Fidelity to the visual and interactive requirements, including dynamic updates and completion states.
  • Code Quality: Readability, maintainability, and adherence to TypeScript best practices.

Loading editor...