import React from "react"; import { Button } from "@/components/ui/button.tsx"; import { Card } from "@/components/ui/card.tsx"; import { Folder, File, Trash2, Pin, Download } from "lucide-react"; import { useTranslation } from "react-i18next"; interface SSHConnection { id: string; name: string; ip: string; port: number; username: string; isPinned?: boolean; } interface FileItem { name: string; type: "file" | "directory" | "link"; path: string; isStarred?: boolean; } interface FileManagerLeftSidebarVileViewerProps { sshConnections: SSHConnection[]; onAddSSH: () => void; onConnectSSH: (conn: SSHConnection) => void; onEditSSH: (conn: SSHConnection) => void; onDeleteSSH: (conn: SSHConnection) => void; onPinSSH: (conn: SSHConnection) => void; currentPath: string; files: FileItem[]; onOpenFile: (file: FileItem) => void; onOpenFolder: (folder: FileItem) => void; onStarFile: (file: FileItem) => void; onDownloadFile?: (file: FileItem) => void; onDeleteFile: (file: FileItem) => void; isLoading?: boolean; error?: string; isSSHMode: boolean; onSwitchToLocal: () => void; onSwitchToSSH: (conn: SSHConnection) => void; currentSSH?: SSHConnection; } export function FileManagerLeftSidebarFileViewer({ currentPath, files, onOpenFile, onOpenFolder, onStarFile, onDownloadFile, onDeleteFile, isLoading, error, isSSHMode, }: FileManagerLeftSidebarVileViewerProps) { const { t } = useTranslation(); return (
{isSSHMode ? t("common.sshPath") : t("common.localPath")} {currentPath}
{isLoading ? (
{t("common.loading")}
) : error ? (
{error}
) : (
{files.map((item) => (
item.type === "directory" ? onOpenFolder(item) : onOpenFile(item) } > {item.type === "directory" ? ( ) : ( )} {item.name}
{item.type === "file" && onDownloadFile && ( )}
))} {files.length === 0 && (
No files or folders found.
)}
)}
); }