"use client";
import { CheckCircle2, CircleAlert, RefreshCw } from "lucide-react";
import { Spinner } from "@/components/ui/spinner";
import { cn } from "@/lib/utils";
import type { NavItem } from "../../types/layout.types";
import { SidebarButton } from "./SidebarButton";
interface NavSectionProps {
items: NavItem[];
onItemClick?: (item: NavItem) => void;
isCollapsed?: boolean;
}
function getStatusInfo(status: NavItem["statusIndicator"]) {
switch (status) {
case "processing":
return {
tooltip: "New or updated documents are still being prepared for search.",
};
case "background_sync":
return {
pillLabel: "Background sync",
tooltip:
"Periodic sync is checking for updates in the background. Existing documents stay searchable while this runs.",
};
case "success":
return {
tooltip: "All document updates are fully synced.",
};
case "error":
return {
pillLabel: "Needs attention",
tooltip: "Some documents failed to sync. Open Documents or Inbox for details.",
};
default:
return {};
}
}
function StatusPill({ status }: { status: NavItem["statusIndicator"] }) {
const { pillLabel } = getStatusInfo(status);
if (!pillLabel) {
return null;
}
return (
{pillLabel}
);
}
function StatusBadge({ status }: { status: NavItem["statusIndicator"] }) {
if (status === "processing") {
return (