import { Loader2 } from "lucide-react"; export type DashboardLoaderStage = "projects" | "project" | "tasks" | "ready"; interface DashboardLoaderProps { stage: DashboardLoaderStage; } interface LoaderStep { id: Exclude; label: string; } const LOADER_STEPS: LoaderStep[] = [ { id: "projects", label: "Loading projects" }, { id: "project", label: "Selecting project" }, { id: "tasks", label: "Fetching tasks" }, ]; function getStepState(stepId: LoaderStep["id"], stage: DashboardLoaderStage): "done" | "active" | "pending" { if (stage === "ready") { return "done"; } const currentStageIndex = LOADER_STEPS.findIndex((step) => step.id === stage); const stepIndex = LOADER_STEPS.findIndex((step) => step.id === stepId); if (stepIndex < currentStageIndex) { return "done"; } if (stepIndex === currentStageIndex) { return "active"; } return "pending"; } export function DashboardLoader({ stage }: DashboardLoaderProps) { return (

Fusion

Initializing dashboard...

    {LOADER_STEPS.map((step) => { const stepState = getStepState(step.id, stage); return (
  1. {step.label}
  2. ); })}
); }