/** * SFTP File row component for file list */ import { Folder } from 'lucide-react'; import React,{ memo } from 'react'; import { cn } from '../../lib/utils'; import { SftpFileEntry } from '../../types'; import { ColumnWidths,formatBytes,formatDate,getFileIcon } from './utils'; interface SftpFileRowProps { entry: SftpFileEntry; isSelected: boolean; isDragOver: boolean; columnWidths: ColumnWidths; onSelect: (e: React.MouseEvent) => void; onOpen: () => void; onDragStart: (e: React.DragEvent) => void; onDragEnd: () => void; onDragOver: (e: React.DragEvent) => void; onDragLeave: () => void; onDrop: (e: React.DragEvent) => void; } const SftpFileRowInner: React.FC = ({ entry, isSelected, isDragOver, columnWidths, onSelect, onOpen, onDragStart, onDragEnd, onDragOver, onDragLeave, onDrop, }) => { const isParentDir = entry.name === '..'; return (
{entry.type === 'directory' ? : getFileIcon(entry)}
{entry.name}
{formatDate(entry.lastModified)} {entry.type === 'directory' ? '--' : formatBytes(entry.size)} {entry.type === 'directory' ? 'folder' : entry.name.split('.').pop()?.toLowerCase() || 'file'}
); }; export const SftpFileRow = memo(SftpFileRowInner); SftpFileRow.displayName = 'SftpFileRow';