import { ChevronRight, FileText, FolderOpen, StarIcon } from "lucide-react"; import type { BrowseTreeNode } from "../../browse-tree"; import type { BrowseDocument } from "../lib/browse"; import { getExtBadgeVariant } from "../lib/browse"; import { Badge } from "./ui/badge"; import { Button } from "./ui/button"; import { Card, CardContent } from "./ui/card"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "./ui/table"; export function BrowseDetailPane({ childFolders, docs, docsLoading, favoriteDocHrefs, onLoadMore, onOpenDoc, onSelectCollection, onSelectFolder, onToggleFavoriteDocument, selectedNode, selectedPath, total, }: { childFolders: BrowseTreeNode[]; docs: BrowseDocument[]; docsLoading: boolean; favoriteDocHrefs: string[]; onLoadMore: () => void; onOpenDoc: (uri: string) => void; onSelectCollection: (collection: string) => void; onSelectFolder: (collection: string, path?: string) => void; onToggleFavoriteDocument: (doc: BrowseDocument) => void; selectedNode: BrowseTreeNode | null; selectedPath: string; total: number; }) { const formatModified = (value?: string) => { if (!value) return "—"; try { return new Date(value).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", }); } catch { return value; } }; if (docsLoading && docs.length === 0) { return (
Loading folder contents...
); } if (docs.length === 0 && childFolders.length === 0) { return (

No documents found

{selectedPath ? "This folder is empty" : "This collection root has no documents yet"}

); } return (
{childFolders.map((folder) => (
{folder.name}
{folder.documentCount} docs
))}
{selectedNode?.directDocumentCount ?? docs.length} direct docs
{selectedNode?.documentCount ?? total} total docs in scope
{docs.length > 0 && ( Document Modified Collection Type {docs.map((doc) => ( onOpenDoc(doc.uri)} >
{doc.title || doc.relPath}
{doc.relPath}
{formatModified(doc.updatedAt)} { event.stopPropagation(); onSelectCollection(doc.collection); }} variant="outline" > {doc.collection} {doc.sourceExt}
))}
)} {docs.length < total && (
)}
); }