Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python
1.9 KB
Raw Blame
import { ArrowRight } from "lucide-react";
import { Button } from "@/components/ui/button";
import { trackButton } from "@/lib/analytics";

interface ProgressBarProps {
  currentStep: number;
  totalSteps: number;
  onSkip?: () => void;
}

export function ProgressBar({
  currentStep,
  totalSteps,
  onSkip,
}: ProgressBarProps) {
  const progressPercentage = ((currentStep + 1) / totalSteps) * 100;

  return (
    <div className="w-full flex flex-wrap items-center justify-center px-6 gap-4">
      <div className="hidden sm:block sm:flex-1" />
      <div className="flex items-center gap-3 min-w-0">
        <div className="w-32 sm:w-48 h-1 bg-background dark:bg-muted rounded-full overflow-hidden">
          <div
            className="h-full transition-all duration-300 ease-in-out"
            data-testid={`progress-bar-${currentStep}`}
            style={{
              width: `${progressPercentage}%`,
              background: "linear-gradient(to right, #773EFF, #22A7AF)",
            }}
          />
        </div>
        <span className="text-xs text-muted-foreground whitespace-nowrap">
          {currentStep + 1}/{totalSteps}
        </span>
      </div>
      <div className="w-full sm:w-auto sm:flex-1 flex justify-center sm:justify-end">
        {currentStep > 1 && onSkip && (
          <Button
            variant="link"
            data-testid="skip-overview-button"
            size="sm"
            onClick={() => {
              trackButton({
                CTA: "Skip Overview",
                elementId: "skip-overview-button",
                namespace: "onboarding",
              });
              onSkip?.();
            }}
            className="flex items-center gap-2 text-mmd text-placeholder-foreground! hover:text-foreground! hover:no-underline!"
          >
            Skip overview
            <ArrowRight className="w-4 h-4" />
          </Button>
        )}
      </div>
    </div>
  );
}