"use client";
import { FolderOpen, PenSquare } from "lucide-react";
import { useTranslations } from "next-intl";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import type { ChatItem, NavItem, PageUsage, SearchSpace, User } from "../../types/layout.types";
import { useSidebarResize } from "../../hooks/useSidebarResize";
import { ChatListItem } from "./ChatListItem";
import { NavSection } from "./NavSection";
import { PageUsageDisplay } from "./PageUsageDisplay";
import { SidebarCollapseButton } from "./SidebarCollapseButton";
import { SidebarHeader } from "./SidebarHeader";
import { SidebarSection } from "./SidebarSection";
import { SidebarUserProfile } from "./SidebarUserProfile";
function ChatListItemSkeleton() {
return (
{/* Resize handle on right border */}
{!isCollapsed && (
)}
{/* Header - search space name or collapse button when collapsed */}
{isCollapsed ? (
{})}
disableTooltip={disableTooltips}
/>
) : (
{})}
disableTooltip={disableTooltips}
/>
)}
{/* New chat button */}
{isCollapsed ? (
{t("new_chat")}
) : (
)}
{/* Chat sections - fills available space */}
{isCollapsed ? (
) : (
{/* Shared Chats Section - takes only space needed, max 50% */}
) : (
{t("view_all_shared_chats") || "View all shared chats"}
)
) : undefined
}
>
{isLoadingChats ? (
) : sharedChats.length > 0 ? (
4 ? "pb-8" : ""}`}
>
{sharedChats.slice(0, 20).map((chat) => (
onChatSelect(chat)}
onRename={() => onChatRename?.(chat)}
onArchive={() => onChatArchive?.(chat)}
onDelete={() => onChatDelete?.(chat)}
/>
))}
{/* Gradient fade indicator when more than 4 items */}
{sharedChats.length > 4 && (
)}
) : (
{t("no_shared_chats")}
)}
{/* Private Chats Section - fills remaining space */}
) : (
{t("view_all_private_chats") || "View all private chats"}
)
) : undefined
}
>
{isLoadingChats ? (
) : chats.length > 0 ? (
4 ? "pb-8" : ""}`}
>
{chats.slice(0, 20).map((chat) => (
onChatSelect(chat)}
onRename={() => onChatRename?.(chat)}
onArchive={() => onChatArchive?.(chat)}
onDelete={() => onChatDelete?.(chat)}
/>
))}
{/* Gradient fade indicator when more than 4 items */}
{chats.length > 4 && (
)}
) : (
{t("no_chats")}
)}
)}
{/* Footer */}
{/* Platform navigation */}
{navItems.length > 0 && (
)}
{pageUsage && !isCollapsed && (
)}
);
}