"use client"; import { CircleCheckBig, FolderGit2, KeyRound, Rocket } from "lucide-react"; import { ReactElement } from "react"; import { ProwlerShort } from "@/components/icons/prowler/ProwlerIcons"; import { cn } from "@/lib/utils"; import { IconComponent, IconSvgProps } from "@/types/components"; interface StepConfig { label: string; description: string; icon: IconComponent; } interface WizardStepperProps { currentStep: number; stepOffset?: number; steps?: StepConfig[]; } const STEPS: StepConfig[] = [ { label: "Link a Provider", description: "Enter the provider details you would like to add in Prowler.", icon: FolderGit2, }, { label: "Authenticate Credentials", description: "Authorize a secure connection between Prowler and your provider.", icon: KeyRound, }, { label: "Validate Connection", description: "Review provider resources and test the connection to Prowler.", icon: Rocket, }, { label: "Launch Scan", description: "Scan newly connected resources.", icon: ProwlerShort, }, ]; export const PROVIDER_WIZARD_STEPS = STEPS; // AWS registers the account, stores its credentials and tests the connection in // one step, so the wizard goes straight from CONNECT to LAUNCH. export const AWS_PROVIDER_WIZARD_STEPS: StepConfig[] = [ { label: "Link a Provider", description: "Enter the account details and the credentials Prowler will use, then test the connection.", icon: FolderGit2, }, STEPS[3], ]; export function WizardStepper({ currentStep, stepOffset = 0, steps = STEPS, }: WizardStepperProps) { const activeVisualStep = Math.max( 0, Math.min(currentStep + stepOffset, steps.length - 1), ); return ( ); } interface StepCircleProps { isComplete: boolean; isActive: boolean; icon: IconComponent; } function StepCircle({ isComplete, isActive, icon: Icon }: StepCircleProps) { if (isComplete) { return (
); } if (isActive) { return (
); } return (
); } function StepConnector({ isComplete }: { isComplete: boolean }) { if (isComplete) { return
; } return (
); } function StepIcon({ icon: Icon, className, }: { icon: IconComponent; className: string; }) { if (isCustomSvgIcon(Icon)) { return ; } return ; } function isCustomSvgIcon( icon: IconComponent, ): icon is (props: IconSvgProps) => ReactElement { return !("displayName" in icon && typeof icon.displayName === "string"); }