File size: 1,795 Bytes
f305a41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { cn } from "@/lib/utils";

const PIPELINE = [
  { id: "cc_review", label: "CC Review" },
  { id: "cc_recommended", label: "CC Recommended" },
  { id: "jd_approval", label: "JD Approval" },
  { id: "jd_recommended", label: "JD Recommended" },
  { id: "director_approval", label: "Director Approval" },
  { id: "certification", label: "Certified" },
];

interface ApprovalFlowProps {
  currentStage: string;
}

export function ApprovalFlow({ currentStage }: ApprovalFlowProps) {
  const currentIndex = PIPELINE.findIndex((step) => step.id === currentStage);

  return (
    <div className="flex flex-wrap items-center gap-1 text-[10px] sm:text-xs text-muted-foreground">

      {PIPELINE.map((step, index) => {

        const isDone = currentIndex !== -1 && index < currentIndex;

        const isCurrent = currentIndex === index;



        return (

          <div key={step.id} className="flex items-center gap-1">

            <div

              className={cn(

                "h-1.5 w-1.5 rounded-full",

                isDone

                  ? "bg-emerald-500"

                  : isCurrent

                  ? "bg-primary"

                  : "bg-muted-foreground/40",

              )}

            />

            <span

              className={cn(

                "uppercase tracking-wide",

                isCurrent

                  ? "font-semibold text-primary"

                  : isDone

                  ? "text-emerald-600"

                  : undefined,

              )}

            >

              {step.label}

            </span>

            {index < PIPELINE.length - 1 && (

              <span className="mx-0.5 text-muted-foreground"></span>

            )}

          </div>

        );

      })}

    </div>
  );
}