import React from "react"; import { FileText, Plus, Search, X, Trash2, Wifi, WifiOff, RefreshCw } from "lucide-react"; import { Document } from "../../types"; interface DocumentSidebarProps { documents: Document[]; activeDocId: string; setActiveDocId: (id: string) => void; setShowDocModal: (show: boolean) => void; handleDeleteDocument: (id: string, e: React.MouseEvent) => void; documentSearchTerm: string; setDocumentSearchTerm: (term: string) => void; syncStatus: "synced" | "syncing" | "offline" | "error"; teamChangesEnabled: boolean; activeCollaborators: number; onClose?: () => void; } export default function DocumentSidebar({ documents, activeDocId, setActiveDocId, setShowDocModal, handleDeleteDocument, documentSearchTerm, setDocumentSearchTerm, syncStatus, teamChangesEnabled, activeCollaborators, onClose }: DocumentSidebarProps) { const filtered = documents.filter((doc) => doc.title.toLowerCase().includes(documentSearchTerm.toLowerCase()) ); return (

Folder Documents

{onClose && ( )}
{/* Highly intuitive search input layout */}
setDocumentSearchTerm(e.target.value)} className="w-full text-xs bg-[#0F1115] border border-slate-800 rounded-lg pl-8 pr-7 py-2 text-slate-205 placeholder:text-slate-650 focus:outline-none focus:border-slate-700 tracking-tight transition-colors" /> {documentSearchTerm && ( )}
{/* Documents List */}
{filtered.length === 0 ? (
No matching segments
) : ( filtered.map((doc) => { const isSelected = doc.id === activeDocId; return (
setActiveDocId(doc.id)} className={`w-full text-left px-3 py-2 rounded-lg transition cursor-pointer flex items-center justify-between gap-2 group ${ isSelected ? "bg-blue-600/10 border border-blue-500/20 text-white" : "text-slate-400 hover:text-slate-200 hover:bg-[#0F1115]/50 border border-transparent" }`} >
{doc.title}
); }) )}
{/* Secure Offline Persistent Sync Status Banner */}
Sync Pipeline {syncStatus === "synced" && ( Online Synced )} {syncStatus === "syncing" && ( Uploading Segment )} {syncStatus === "offline" && ( Offline Buffer )} {syncStatus === "error" && ( Sync Failed )}
Collaborators {teamChangesEnabled ? activeCollaborators : "1"} Editor Online
Sarah and Liam joined review panel
); }