import { Breadcrumbs } from "@/components/breadcrumbs";
import { GlobalSearch } from "@/components/global-search";
import { NavUser } from "@/components/nav-user";
import { SidebarTrigger } from "@/components/ui/sidebar";
import type { BreadcrumbItem as BreadcrumbItemType } from "@/types";

/**
 * The top bar: where you are on the left, and the two things a person reaches
 * for on the right — the one search that covers the whole system, and their own
 * account menu. Both are always in the same corner, on every screen.
 */
export function AppSidebarHeader({
    breadcrumbs = [],
}: {
    breadcrumbs?: BreadcrumbItemType[];
}) {
    return (
        <header className="sticky top-0 z-20 flex h-14 shrink-0 items-center gap-2 border-b bg-background/80 backdrop-blur transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-12 supports-[backdrop-filter]:bg-background/60">
            <div className="mx-auto flex w-full max-w-[1700px] items-center gap-2 px-4 sm:px-6 lg:px-8">
                <SidebarTrigger className="-ml-1" />
                <Breadcrumbs breadcrumbs={breadcrumbs} />

                <div className="ml-auto flex items-center gap-1.5">
                    <GlobalSearch />
                    <NavUser />
                </div>
            </div>
        </header>
    );
}
