ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add file manager UI components and features
Juan Denis611e332b4dd7
diff --git a/.gitignore b/.gitignoreindex 51782179..5f27581a 100644--- a/.gitignore+++ b/.gitignore@@ -108,3 +108,4 @@ APP_IMPROVEMENTS.md!agent/internal/setupui/serverkit.ico!agent/internal/setupui/serverkit_header.pngdocs/PLAN_AGENT_FLEET.md+/docs/plansdiff --git a/frontend/src/components/file-manager/ContextMenu.jsx b/frontend/src/components/file-manager/ContextMenu.jsxnew file mode 100644index 00000000..5a111ce4--- /dev/null+++ b/frontend/src/components/file-manager/ContextMenu.jsx@@ -0,0 +1,59 @@+import {+ Folder, Eye, Download, Edit3, Lock, Copy, Star, StarOff, Trash2,+} from 'lucide-react';++export default function ContextMenu({+ menu, // { x, y, entry }+ selectionCount, // total items selected+ isPinned,+ onClose,+ onOpen,+ onDownload,+ onRename,+ onPermissions,+ onCopyPath,+ onTogglePin,+ onDelete,+}) {+ if (!menu) return null;+ const { x, y, entry } = menu;+ const multi = selectionCount > 1;++ return (+ <div+ className="context-menu"+ style={{ top: y, left: x }}+ onClick={(e) => e.stopPropagation()}+ >+ <button onClick={() => { onOpen(entry); onClose(); }}>+ {entry.is_dir ? <Folder size={14} /> : <Eye size={14} />}+ {entry.is_dir ? 'Open' : 'Preview'}+ </button>+ {!entry.is_dir && (+ <button onClick={() => { onDownload(entry); onClose(); }}>+ <Download size={14} /> Download+ </button>+ )}+ <button onClick={() => { onRename(entry); onClose(); }}>+ <Edit3 size={14} /> Rename+ </button>+ <button onClick={() => { onPermissions(entry); onClose(); }}>+ <Lock size={14} /> Permissions+ </button>+ <button onClick={() => { onCopyPath(entry.path); onClose(); }}>+ <Copy size={14} /> Copy path+ </button>+ {entry.is_dir && (+ <button onClick={() => { onTogglePin(entry); onClose(); }}>+ {isPinned(entry.path)+ ? <><StarOff size={14} /> Unpin</>+ : <><Star size={14} /> Pin to Quick Access</>}+ </button>+ )}+ <div className="context-menu-divider" />+ <button className="danger" onClick={() => { onDelete(entry); onClose(); }}>+ <Trash2 size={14} /> Delete{multi ? ` ${selectionCount} items` : ''}+ </button>+ </div>+ );+}diff --git a/frontend/src/components/file-manager/FileCard.jsx b/frontend/src/components/file-manager/FileCard.jsxnew file mode 100644index 00000000..c74ca0fa--- /dev/null+++ b/frontend/src/components/file-manager/FileCard.jsx@@ -0,0 +1,67 @@+import { memo } from 'react';+import { Check } from 'lucide-react';+import FileIcon from './FileIcon';+import ImageThumb from './ImageThumb';+import { getFileType, getFileExt } from './fileTypes';++function FileCard({+ entry,+ selected,+ selectMode,+ onOpen,+ onToggleSelect,+ onContext,+}) {+ const ext = getFileExt(entry);+ const type = getFileType(entry);+ const showThumb = type === 'image' && entry.size && entry.size < 8 * 1024 * 1024;++ return (+ <div+ className={`file-card type-${type} ${selected ? 'selected' : ''} ${selectMode ? 'select-mode' : ''}`}+ onClick={(e) => {+ if (e.ctrlKey || e.metaKey || e.shiftKey || selectMode) {+ onToggleSelect(entry, e);+ } else {+ onOpen(entry);+ }+ }}+ onDoubleClick={(e) => {+ e.stopPropagation();+ onOpen(entry);+ }}+ onContextMenu={(e) => onContext(e, entry)}+ >+ <button+ className="file-card-check"+ onClick={(e) => {+ e.stopPropagation();+ onToggleSelect(entry, { ...e, ctrlKey: true });+ }}+ aria-label={selected ? 'Deselect' : 'Select'}+ >+ <span className={`checkbox ${selected ? 'checked' : ''}`}>+ {selected && <Check size={12} />}+ </span>+ </button>++ <div className="file-card-thumb">+ {showThumb ? (+ <ImageThumb path={entry.path} fallback={<FileIcon entry={entry} size={36} />} />+ ) : (+ <FileIcon entry={entry} size={36} />+ )}+ {ext && <span className="ext-badge">{ext}</span>}+ {entry.is_link && <span className="link-badge">↗</span>}+ </div>+ <div className="file-card-body">+ <div className="file-card-name" title={entry.name}>{entry.name}</div>+ <div className="file-card-meta">+ {entry.is_dir ? 'Folder' : entry.size_human}+ </div>+ </div>+ </div>+ );+}++export default memo(FileCard);diff --git a/frontend/src/components/file-manager/FileIcon.jsx b/frontend/src/components/file-manager/FileIcon.jsxnew file mode 100644index 00000000..c02bd8ec--- /dev/null+++ b/frontend/src/components/file-manager/FileIcon.jsx@@ -0,0 +1,22 @@+import {+ Folder, File, FileCode, FileText, FileImage, FileVideo, FileAudio,+ FileArchive, Database, Terminal,+} from 'lucide-react';+import { getFileType } from './fileTypes';++export default function FileIcon({ entry, size = 20 }) {+ const type = getFileType(entry);+ const cls = `file-icon-svg ${type}`;+ switch (type) {+ case 'folder': return <Folder size={size} className={cls} fill="currentColor" fillOpacity={0.15} />;+ case 'code': return <FileCode size={size} className={cls} />;+ case 'image': return <FileImage size={size} className={cls} />;+ case 'video': return <FileVideo size={size} className={cls} />;+ case 'audio': return <FileAudio size={size} className={cls} />;+ case 'archive': return <FileArchive size={size} className={cls} />;+ case 'data': return <Database size={size} className={cls} />;+ case 'text': return <FileText size={size} className={cls} />;+ case 'terminal': return <Terminal size={size} className={cls} />;+ default: return <File size={size} className={cls} />;+ }+}diff --git a/frontend/src/components/file-manager/FileRow.jsx b/frontend/src/components/file-manager/FileRow.jsxnew file mode 100644index 00000000..49f43c20--- /dev/null+++ b/frontend/src/components/file-manager/FileRow.jsx@@ -0,0 +1,74 @@+import { memo } from 'react';+import { Check, Download, Edit3, Lock, Trash2 } from 'lucide-react';+import FileIcon from './FileIcon';++function FileRow({+ entry,+ selected,+ selectMode,+ onOpen,+ onToggleSelect,+ onContext,+ onDownload,+ onRename,+ onPermissions,+ onDelete,+}) {+ return (+ <div+ className={`file-item ${selected ? 'selected' : ''} ${selectMode ? 'select-mode' : ''}`}+ onClick={(e) => {+ if (e.ctrlKey || e.metaKey || e.shiftKey || selectMode) {+ onToggleSelect(entry, e);+ } else {+ onOpen(entry);+ }+ }}+ onDoubleClick={(e) => {+ e.stopPropagation();+ onOpen(entry);+ }}+ onContextMenu={(e) => onContext(e, entry)}+ >+ <span className="col-check" onClick={(e) => e.stopPropagation()}>+ <button+ className="checkbox-btn"+ onClick={(e) => onToggleSelect(entry, { ...e, ctrlKey: true })}+ aria-label={selected ? 'Deselect' : 'Select'}+ >+ <span className={`checkbox ${selected ? 'checked' : ''}`}>+ {selected && <Check size={12} />}+ </span>+ </button>+ </span>+ <span className="col-name">+ <FileIcon entry={entry} size={16} />+ <span className="file-item-name">{entry.name}</span>+ {entry.is_link && <span className="link-indicator">↗</span>}+ </span>+ <span className="col-size">{entry.is_dir ? '—' : entry.size_human}</span>+ <span className="col-modified">+ {new Date(entry.modified).toLocaleDateString()}+ </span>+ <span className="col-permissions">{entry.permissions}</span>+ <span className="col-actions" onClick={(e) => e.stopPropagation()}>+ {!entry.is_dir && (+ <button className="row-action" onClick={() => onDownload(entry)} title="Download">+ <Download size={14} />+ </button>+ )}+ <button className="row-action" onClick={() => onRename(entry)} title="Rename">+ <Edit3 size={14} />+ </button>+ <button className="row-action" onClick={() => onPermissions(entry)} title="Permissions">+ <Lock size={14} />+ </button>+ <button className="row-action danger" onClick={() => onDelete(entry)} title="Delete">+ <Trash2 size={14} />+ </button>+ </span>+ </div>+ );+}++export default memo(FileRow);diff --git a/frontend/src/components/file-manager/FolderTree.jsx b/frontend/src/components/file-manager/FolderTree.jsxnew file mode 100644index 00000000..ae02b267--- /dev/null+++ b/frontend/src/components/file-manager/FolderTree.jsx@@ -0,0 +1,89 @@+import { ChevronRight, ChevronDown, Folder, FolderOpen } from 'lucide-react';+import Spinner from '../Spinner';++function TreeNode({ node, level, expanded, treeCache, treeLoading, currentPath, onNavigate, onToggle }) {+ const isExpanded = expanded.has(node.path);+ const isActive = currentPath === node.path;+ const isLoading = treeLoading.has(node.path);+ const children = treeCache.get(node.path);++ return (+ <div className="tree-node">+ <div+ className={`tree-row ${isActive ? 'active' : ''}`}+ style={{ paddingLeft: 6 + level * 14 }}+ onClick={() => onNavigate(node.path)}+ >+ <button+ className="tree-chevron"+ onClick={(e) => { e.stopPropagation(); onToggle(node.path); }}+ aria-label={isExpanded ? 'Collapse' : 'Expand'}+ >+ {isLoading ? (+ <span className="tree-chevron-spinner"><Spinner size="sm" /></span>+ ) : isExpanded ? (+ <ChevronDown size={12} />+ ) : (+ <ChevronRight size={12} />+ )}+ </button>+ {isExpanded ? (+ <FolderOpen size={14} className="tree-folder-icon open" />+ ) : (+ <Folder size={14} className="tree-folder-icon" fill="currentColor" fillOpacity={0.15} />+ )}+ <span className="tree-name" title={node.path}>{node.name}</span>+ </div>+ {isExpanded && children && children.length > 0 && (+ <div className="tree-children">+ {children.map((child) => (+ <TreeNode+ key={child.path}+ node={child}+ level={level + 1}+ expanded={expanded}+ treeCache={treeCache}+ treeLoading={treeLoading}+ currentPath={currentPath}+ onNavigate={onNavigate}+ onToggle={onToggle}+ />+ ))}+ </div>+ )}+ {isExpanded && children && children.length === 0 && !isLoading && (+ <div className="tree-empty" style={{ paddingLeft: 26 + level * 14 }}>+ Empty+ </div>+ )}+ </div>+ );+}++export default function FolderTree({+ roots,+ expanded,+ treeCache,+ treeLoading,+ currentPath,+ onNavigate,+ onToggle,+}) {+ return (+ <div className="folder-tree">+ {roots.map((root) => (+ <TreeNode+ key={root.path}+ node={root}+ level={0}+ expanded={expanded}+ treeCache={treeCache}+ treeLoading={treeLoading}+ currentPath={currentPath}+ onNavigate={onNavigate}+ onToggle={onToggle}+ />+ ))}+ </div>+ );+}diff --git a/frontend/src/components/file-manager/ImageThumb.jsx b/frontend/src/components/file-manager/ImageThumb.jsxnew file mode 100644index 00000000..c9c108e6--- /dev/null+++ b/frontend/src/components/file-manager/ImageThumb.jsx@@ -0,0 +1,34 @@+import { useEffect, useState } from 'react';+import { api } from '../../services/api';++// Auth-fetches a file via the download endpoint, converts to a blob URL, and+// renders it as an <img>. Falls back to whatever JSX is passed in `fallback`.+export default function ImageThumb({ path, fallback, className = 'thumb-image', alt = '' }) {+ const [src, setSrc] = useState(null);+ const [errored, setErrored] = useState(false);++ useEffect(() => {+ let blobUrl = null;+ let cancelled = false;+ (async () => {+ try {+ const token = api.getToken();+ const url = `${api.baseUrl}/files/download?path=${encodeURIComponent(path)}`;+ const res = await fetch(url, { headers: { Authorization: `Bearer ${token}` } });+ if (!res.ok) throw new Error('thumb fetch failed');+ const blob = await res.blob();+ blobUrl = URL.createObjectURL(blob);+ if (!cancelled) setSrc(blobUrl);+ } catch {+ if (!cancelled) setErrored(true);+ }+ })();+ return () => {+ cancelled = true;+ if (blobUrl) URL.revokeObjectURL(blobUrl);+ };+ }, [path]);++ if (errored || !src) return fallback;+ return <img src={src} alt={alt} className={className} loading="lazy" />;+}diff --git a/frontend/src/components/file-manager/PreviewDrawer.jsx b/frontend/src/components/file-manager/PreviewDrawer.jsxnew file mode 100644index 00000000..f0d69785--- /dev/null+++ b/frontend/src/components/file-manager/PreviewDrawer.jsx@@ -0,0 +1,153 @@+import { useEffect } from 'react';+import { X, Edit3, Download, EyeOff, Lock, Trash2, Copy } from 'lucide-react';+import { Button } from '@/components/ui/button';+import FileIcon from './FileIcon';+import ImageThumb from './ImageThumb';+import { getFileType } from './fileTypes';++export default function PreviewDrawer({+ file,+ fileContent,+ setFileContent,+ editing,+ onStartEdit,+ onCancelEdit,+ onSave,+ onClose,+ onDownload,+ onRename,+ onPermissions,+ onDelete,+ onCopyPath,+}) {+ // Lock body scroll while open+ useEffect(() => {+ if (!file) return;+ const prev = document.body.style.overflow;+ document.body.style.overflow = 'hidden';+ return () => { document.body.style.overflow = prev; };+ }, [file]);++ if (!file) return null;++ const type = getFileType(file);+ const isImage = type === 'image';++ return (+ <>+ <div className="preview-drawer-backdrop" onClick={onClose} />+ <aside className="preview-drawer" role="dialog" aria-label="File preview">+ <header className="preview-drawer-header">+ <FileIcon entry={file} size={20} />+ <div className="preview-drawer-title">+ <h3>{file.name}</h3>+ <p className="preview-drawer-path">{file.path}</p>+ </div>+ <button className="preview-drawer-close" onClick={onClose} aria-label="Close">+ <X size={18} />+ </button>+ </header>++ <div className="preview-drawer-meta">+ <div className="meta-item">+ <span className="meta-label">Size</span>+ <span className="meta-value">{file.size_human}</span>+ </div>+ <div className="meta-item">+ <span className="meta-label">Owner</span>+ <span className="meta-value">{file.owner}</span>+ </div>+ <div className="meta-item">+ <span className="meta-label">Group</span>+ <span className="meta-value">{file.group}</span>+ </div>+ <div className="meta-item">+ <span className="meta-label">Permissions</span>+ <span className="meta-value mono">{file.permissions}</span>+ </div>+ {file.mime_type && (+ <div className="meta-item meta-item-wide">+ <span className="meta-label">MIME</span>+ <span className="meta-value mono">{file.mime_type}</span>+ </div>+ )}+ <div className="meta-item meta-item-wide">+ <span className="meta-label">Modified</span>+ <span className="meta-value">{new Date(file.modified).toLocaleString()}</span>+ </div>+ </div>++ <div className="preview-drawer-actions">+ {!file.is_dir && (+ <button className="drawer-action-btn" onClick={() => onDownload(file)}>+ <Download size={14} /> Download+ </button>+ )}+ <button className="drawer-action-btn" onClick={() => onCopyPath(file.path)}>+ <Copy size={14} /> Copy path+ </button>+ <button className="drawer-action-btn" onClick={() => onRename(file)}>+ <Edit3 size={14} /> Rename+ </button>+ <button className="drawer-action-btn" onClick={() => onPermissions(file)}>+ <Lock size={14} /> Permissions+ </button>+ <button className="drawer-action-btn danger" onClick={() => onDelete(file)}>+ <Trash2 size={14} /> Delete+ </button>+ </div>++ <div className="preview-drawer-body">+ {isImage ? (+ <div className="preview-image-wrap">+ <ImageThumb+ path={file.path}+ fallback={+ <div className="preview-unavailable">+ <EyeOff size={48} strokeWidth={1.5} />+ <p>Image preview unavailable</p>+ </div>+ }+ />+ </div>+ ) : file.is_editable ? (+ <div className="editor-wrap">+ <div className="editor-toolbar">+ <span className="editor-status">{editing ? 'Editing' : 'Read-only'}</span>+ <div className="editor-buttons">+ {!editing ? (+ <Button size="sm" onClick={onStartEdit}>+ <Edit3 size={14} /> Edit+ </Button>+ ) : (+ <>+ <Button variant="outline" size="sm" onClick={onCancelEdit}>+ Cancel+ </Button>+ <Button size="sm" onClick={onSave}>Save</Button>+ </>+ )}+ </div>+ </div>+ <textarea+ className="file-editor"+ value={fileContent}+ onChange={(e) => setFileContent(e.target.value)}+ readOnly={!editing}+ spellCheck={false}+ />+ </div>+ ) : (+ <div className="preview-unavailable">+ <EyeOff size={48} strokeWidth={1.5} />+ <p>Preview not available for this file type</p>+ <Button onClick={() => onDownload(file)}>+ <Download size={16} /> Download File+ </Button>+ </div>+ )}+ </div>+ </aside>+ </>+ );+}diff --git a/frontend/src/components/file-manager/fileTypes.js b/frontend/src/components/file-manager/fileTypes.jsnew file mode 100644index 00000000..012c92c7--- /dev/null+++ b/frontend/src/components/file-manager/fileTypes.js@@ -0,0 +1,55 @@+// File-type detection, constants, formatters shared across the file manager.++export const FILE_TYPES = {+ code: ['js', 'jsx', 'ts', 'tsx', 'py', 'rb', 'php', 'java', 'c', 'cpp', 'h', 'go', 'rs', 'swift', 'kt'],+ image: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp', 'ico', 'avif'],+ video: ['mp4', 'avi', 'mkv', 'mov', 'wmv', 'webm', 'flv'],+ audio: ['mp3', 'wav', 'flac', 'aac', 'ogg', 'wma', 'm4a'],+ archive: ['zip', 'tar', 'gz', 'rar', '7z', 'bz2', 'xz'],+ data: ['json', 'xml', 'yaml', 'yml', 'csv', 'db', 'sqlite', 'sql', 'toml'],+ text: ['txt', 'md', 'log', 'ini', 'conf', 'cfg', 'env'],+ terminal: ['sh', 'bash', 'zsh', 'fish'],+};++export function getFileType(entry) {+ if (entry.is_dir) return 'folder';+ const ext = (entry.name.split('.').pop() || '').toLowerCase();+ for (const [type, exts] of Object.entries(FILE_TYPES)) {+ if (exts.includes(ext)) return type;+ }+ return 'default';+}++export function getFileExt(entry) {+ if (entry.is_dir) return '';+ const parts = entry.name.split('.');+ if (parts.length < 2 || parts[0] === '') return '';+ return parts.pop().toUpperCase().slice(0, 4);+}++export function formatBytes(bytes) {+ if (!bytes) return '0 B';+ const units = ['B', 'KB', 'MB', 'GB', 'TB'];+ const i = Math.floor(Math.log(bytes) / Math.log(1024));+ return `${(bytes / Math.pow(1024, i)).toFixed(i === 0 ? 0 : 1)} ${units[i]}`;+}++// Folders that anchor the left-sidebar tree. Backend ALLOWED_ROOTS are+// /home, /var/www, /opt, /srv, /var/log, plus the SERVERKIT_DIR.+export const TREE_ROOTS = [+ { path: '/home', name: 'home' },+ { path: '/var/www', name: 'var/www' },+ { path: '/opt', name: 'opt' },+ { path: '/srv', name: 'srv' },+ { path: '/var/log', name: 'var/log' },+];++export const DEFAULT_PINNED = [+ { path: '/home', name: 'Home' },+ { path: '/var/www', name: 'Web Root' },+ { path: '/var/log', name: 'Logs' },+ { path: '/opt', name: 'Opt' },+ { path: '/srv', name: 'Srv' },+];++// Filter chip definitions are kept in the page since they import lucide icons.diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsxindex e18730c5..ad34c4e4 100644--- a/frontend/src/pages/FileManager.jsx+++ b/frontend/src/pages/FileManager.jsx@@ -1,36 +1,78 @@-import { useState, useEffect, useRef } from 'react';+import { useState, useEffect, useRef, useMemo, useCallback } from 'react';import { api } from '../services/api';import { useToast } from '../contexts/ToastContext';import Spinner from '../components/Spinner';import ConfirmDialog from '../components/ConfirmDialog';-import { ProgressBar } from '../components/ProgressBar';import {- Folder, File, FileCode, FileText, FileImage, FileVideo, FileAudio,- FileArchive, Database, Terminal, Upload, FolderPlus, FilePlus,- ArrowLeft, Search, X, RefreshCw, Eye, EyeOff, Download, Edit3,- Trash2, Lock, BarChart3, ChevronDown, ChevronRight, HardDrive,- PieChart, Clock, PanelRightClose, PanelRightOpen+ Folder, File, Upload, FolderPlus, FilePlus,+ ArrowLeft, ArrowRight, ArrowUp, Search, X, RefreshCw, Eye, EyeOff,+ Download, Edit3, Trash2, BarChart3, ChevronDown, ChevronRight,+ HardDrive, PieChart, Clock, PanelLeftClose, PanelLeftOpen,+ LayoutGrid, List, Home, CloudUpload, Star, StarOff,+ Check, Copy, ArrowUpDown, ZoomIn, ZoomOut, Code2, FileJson,+ Image as ImageIcon, Film, Music, Archive, FileType, FileText,+ FolderTree as FolderTreeIcon, MousePointer2,} from 'lucide-react';-import { PieChart as RechartsPie, Pie, Cell, ResponsiveContainer, Tooltip, Legend } from 'recharts';+import { PieChart as RechartsPie, Pie, Cell, ResponsiveContainer, Tooltip } from 'recharts';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';-// LocalStorage keys-const SIDEBAR_VISIBLE_KEY = 'serverkit-fm-sidebar';-const DISK_COLLAPSED_KEY = 'serverkit-fm-disk-collapsed';+import FolderTree from '../components/file-manager/FolderTree';+import FileCard from '../components/file-manager/FileCard';+import FileRow from '../components/file-manager/FileRow';+import PreviewDrawer from '../components/file-manager/PreviewDrawer';+import ContextMenu from '../components/file-manager/ContextMenu';+import { TREE_ROOTS, DEFAULT_PINNED, getFileType, formatBytes } from '../components/file-manager/fileTypes';++const STORAGE = {+ sidebar: 'serverkit-fm-sidebar',+ treeCollapsed: 'serverkit-fm-tree-collapsed',+ quickCollapsed: 'serverkit-fm-quick-collapsed',+ diskCollapsed: 'serverkit-fm-disk-collapsed',+ expanded: 'serverkit-fm-tree-expanded',+ viewMode: 'serverkit-fm-view-mode',+ gridSize: 'serverkit-fm-grid-size',+ sortBy: 'serverkit-fm-sort-by',+ sortDir: 'serverkit-fm-sort-dir',+ pinned: 'serverkit-fm-pinned',+};++const FILTER_CHIPS = [+ { id: 'all', label: 'All', icon: FileType },+ { id: 'folder', label: 'Folders', icon: Folder },+ { id: 'image', label: 'Images', icon: ImageIcon },+ { id: 'code', label: 'Code', icon: Code2 },+ { id: 'text', label: 'Documents', icon: FileText },+ { id: 'data', label: 'Data', icon: FileJson },+ { id: 'video', label: 'Videos', icon: Film },+ { id: 'audio', label: 'Audio', icon: Music },+ { id: 'archive', label: 'Archives', icon: Archive },+];function FileManager() {+ // ─── core ────────────────────────────────────────────const [currentPath, setCurrentPath] = useState('/home');const [entries, setEntries] = useState([]);const [parentPath, setParentPath] = useState(null);const [loading, setLoading] = useState(true);const [showHidden, setShowHidden] = useState(false);++ // ─── search ──────────────────────────────────────────const [searchQuery, setSearchQuery] = useState('');const [searchResults, setSearchResults] = useState(null);- const [selectedFile, setSelectedFile] = useState(null);++ // ─── selection ───────────────────────────────────────+ const [selectedPaths, setSelectedPaths] = useState(new Set());+ const [lastClickedPath, setLastClickedPath] = useState(null);+ const [selectMode, setSelectMode] = useState(false);++ // ─── preview ─────────────────────────────────────────+ const [previewFile, setPreviewFile] = useState(null);const [fileContent, setFileContent] = useState('');- const [editingFile, setEditingFile] = useState(null);+ const [editing, setEditing] = useState(false);++ // ─── modals ──────────────────────────────────────────const [showNewFileModal, setShowNewFileModal] = useState(false);const [showNewFolderModal, setShowNewFolderModal] = useState(false);const [showRenameModal, setShowRenameModal] = useState(false);@@ -41,48 +83,91 @@ function FileManager() {const [newName, setNewName] = useState('');const [permissionsTarget, setPermissionsTarget] = useState(null);const [newPermissions, setNewPermissions] = useState('');- const [uploadProgress, setUploadProgress] = useState(null);const [confirmDialog, setConfirmDialog] = useState(null);++ // ─── upload ──────────────────────────────────────────+ const [uploads, setUploads] = useState([]);+ const [dragActive, setDragActive] = useState(false);const fileInputRef = useRef(null);- const toast = useToast();+ const dragCounter = useRef(0);- // Sidebar and disk usage state+ // ─── view prefs ──────────────────────────────────────+ const [viewMode, setViewMode] = useState(() => localStorage.getItem(STORAGE.viewMode) || 'grid');+ const [gridSize, setGridSize] = useState(() => localStorage.getItem(STORAGE.gridSize) || 'lg');+ const [sortBy, setSortBy] = useState(() => localStorage.getItem(STORAGE.sortBy) || 'name');+ const [sortDir, setSortDir] = useState(() => localStorage.getItem(STORAGE.sortDir) || 'asc');+ const [activeFilter, setActiveFilter] = useState('all');+ const [sortOpen, setSortOpen] = useState(false);++ // ─── left sidebar ────────────────────────────────────const [sidebarVisible, setSidebarVisible] = useState(() => {- const saved = localStorage.getItem(SIDEBAR_VISIBLE_KEY);- return saved !== null ? saved === 'true' : true;+ const v = localStorage.getItem(STORAGE.sidebar);+ return v !== null ? v === 'true' : true;});- const [diskCollapsed, setDiskCollapsed] = useState(() => {- const saved = localStorage.getItem(DISK_COLLAPSED_KEY);- return saved !== null ? saved === 'true' : false;+ const [treeCollapsed, setTreeCollapsed] = useState(() => localStorage.getItem(STORAGE.treeCollapsed) === 'true');+ const [quickCollapsed, setQuickCollapsed] = useState(() => localStorage.getItem(STORAGE.quickCollapsed) === 'true');+ const [diskCollapsed, setDiskCollapsed] = useState(() => localStorage.getItem(STORAGE.diskCollapsed) === 'true');++ // ─── folder tree state ───────────────────────────────+ const [treeExpanded, setTreeExpanded] = useState(() => {+ try {+ const stored = localStorage.getItem(STORAGE.expanded);+ return stored ? new Set(JSON.parse(stored)) : new Set();+ } catch { return new Set(); }});+ const [treeCache, setTreeCache] = useState(new Map());+ const [treeLoading, setTreeLoading] = useState(new Set());++ // ─── disk ────────────────────────────────────────────const [diskMounts, setDiskMounts] = useState([]);const [diskLastUpdated, setDiskLastUpdated] = useState(null);const [diskLoading, setDiskLoading] = useState(false);- // Analysis state+ // ─── pinned ──────────────────────────────────────────+ const [pinned, setPinned] = useState(() => {+ try {+ const stored = localStorage.getItem(STORAGE.pinned);+ return stored ? JSON.parse(stored) : DEFAULT_PINNED;+ } catch { return DEFAULT_PINNED; }+ });++ // ─── analysis ────────────────────────────────────────const [analysisLoading, setAnalysisLoading] = useState(false);const [directoryAnalysis, setDirectoryAnalysis] = useState(null);const [typeBreakdown, setTypeBreakdown] = useState(null);- const [analysisView, setAnalysisView] = useState('directories'); // 'directories' | 'files'+ const [analysisView, setAnalysisView] = useState('directories');- useEffect(() => {- loadDirectory(currentPath);- loadDiskMounts();- }, [currentPath, showHidden]);+ // ─── history ─────────────────────────────────────────+ const [history, setHistory] = useState(['/home']);+ const [historyIdx, setHistoryIdx] = useState(0);+ const navByHistory = useRef(false);- useEffect(() => {- localStorage.setItem(SIDEBAR_VISIBLE_KEY, sidebarVisible);- }, [sidebarVisible]);+ // ─── context menu ────────────────────────────────────+ const [contextMenu, setContextMenu] = useState(null);+ const toast = useToast();++ // ─── persistence ─────────────────────────────────────+ useEffect(() => { localStorage.setItem(STORAGE.sidebar, sidebarVisible); }, [sidebarVisible]);+ useEffect(() => { localStorage.setItem(STORAGE.treeCollapsed, treeCollapsed); }, [treeCollapsed]);+ useEffect(() => { localStorage.setItem(STORAGE.quickCollapsed, quickCollapsed); }, [quickCollapsed]);+ useEffect(() => { localStorage.setItem(STORAGE.diskCollapsed, diskCollapsed); }, [diskCollapsed]);+ useEffect(() => { localStorage.setItem(STORAGE.viewMode, viewMode); }, [viewMode]);+ useEffect(() => { localStorage.setItem(STORAGE.gridSize, gridSize); }, [gridSize]);+ useEffect(() => { localStorage.setItem(STORAGE.sortBy, sortBy); }, [sortBy]);+ useEffect(() => { localStorage.setItem(STORAGE.sortDir, sortDir); }, [sortDir]);+ useEffect(() => { localStorage.setItem(STORAGE.pinned, JSON.stringify(pinned)); }, [pinned]);useEffect(() => {- localStorage.setItem(DISK_COLLAPSED_KEY, diskCollapsed);- }, [diskCollapsed]);+ localStorage.setItem(STORAGE.expanded, JSON.stringify([...treeExpanded]));+ }, [treeExpanded]);- const loadDirectory = async (path) => {+ // ─── load directory ──────────────────────────────────+ const loadDirectory = useCallback(async (path) => {setLoading(true);setSearchResults(null);setDirectoryAnalysis(null);setTypeBreakdown(null);+ setSelectedPaths(new Set());try {const data = await api.browseFiles(path, showHidden);setEntries(data.entries || []);@@ -93,30 +178,55 @@ function FileManager() {} finally {setLoading(false);}- };+ }, [showHidden, toast]);++ useEffect(() => {+ loadDirectory(currentPath);+ }, [currentPath, showHidden]); // eslint-disable-line react-hooks/exhaustive-deps++ useEffect(() => {+ loadDiskMounts();+ }, []);++ // history tracking+ useEffect(() => {+ if (navByHistory.current) {+ navByHistory.current = false;+ return;+ }+ setHistory((h) => {+ const trimmed = h.slice(0, historyIdx + 1);+ if (trimmed[trimmed.length - 1] === currentPath) return h;+ return [...trimmed, currentPath];+ });+ setHistoryIdx((i) => (history[i] === currentPath ? i : i + 1));+ }, [currentPath]); // eslint-disable-line react-hooks/exhaustive-deps+ // ─── disk mounts ─────────────────────────────────────const loadDiskMounts = async () => {setDiskLoading(true);try {const data = await api.getAllDiskMounts();setDiskMounts(data.mounts || []);setDiskLastUpdated(new Date());- } catch (error) {- console.error('Failed to load disk mounts:', error);+ } catch (e) {+ console.error('Failed to load disk mounts:', e);} finally {setDiskLoading(false);}};+ // ─── analysis ────────────────────────────────────────const analyzeDirectory = async () => {setAnalysisLoading(true);try {const [analysisData, breakdownData] = await Promise.all([api.analyzeDirectory(currentPath, 2, 15),- api.getFileTypeBreakdown(currentPath, 3)+ api.getFileTypeBreakdown(currentPath, 3),]);setDirectoryAnalysis(analysisData);setTypeBreakdown(breakdownData);+ if (!sidebarVisible) setSidebarVisible(true);} catch (error) {toast.error(`Analysis failed: ${error.message}`);} finally {@@ -124,16 +234,52 @@ function FileManager() {}};- const closeAnalysis = () => {- setDirectoryAnalysis(null);- setTypeBreakdown(null);- };-- const handleSearch = async () => {- if (!searchQuery.trim()) {- setSearchResults(null);+ // ─── tree expand/collapse ────────────────────────────+ const toggleTreeExpand = useCallback(async (path) => {+ if (treeExpanded.has(path)) {+ const next = new Set(treeExpanded);+ next.delete(path);+ setTreeExpanded(next);return;}+ if (!treeCache.has(path)) {+ setTreeLoading((s) => { const n = new Set(s); n.add(path); return n; });+ try {+ const data = await api.browseFiles(path, false);+ const folders = (data.entries || []).filter((e) => e.is_dir).map((e) => ({+ path: e.path,+ name: e.name,+ }));+ setTreeCache((c) => { const n = new Map(c); n.set(path, folders); return n; });+ } catch {+ setTreeCache((c) => { const n = new Map(c); n.set(path, []); return n; });+ } finally {+ setTreeLoading((s) => { const n = new Set(s); n.delete(path); return n; });+ }+ }+ setTreeExpanded((s) => { const n = new Set(s); n.add(path); return n; });+ }, [treeExpanded, treeCache]);++ // Auto-expand the tree along the current path so the active row is visible.+ useEffect(() => {+ const parts = currentPath.split('/').filter(Boolean);+ const ancestors = [];+ let acc = '';+ for (const p of parts) {+ acc += '/' + p;+ ancestors.push(acc);+ }+ ancestors.forEach((a) => {+ const isUnderRoot = TREE_ROOTS.some((r) => a === r.path || a.startsWith(r.path + '/') || r.path.startsWith(a + '/'));+ if (isUnderRoot && !treeExpanded.has(a) && a !== currentPath) {+ toggleTreeExpand(a);+ }+ });+ }, [currentPath]); // eslint-disable-line react-hooks/exhaustive-deps++ // ─── search ──────────────────────────────────────────+ const handleSearch = async () => {+ if (!searchQuery.trim()) { setSearchResults(null); return; }setLoading(true);try {const data = await api.searchFiles(currentPath, searchQuery);@@ -145,52 +291,86 @@ function FileManager() {}};- const handleNavigate = (entry) => {- if (entry.is_dir) {- setCurrentPath(entry.path);- setSelectedFile(null);- setEditingFile(null);- } else {- handleFileClick(entry);+ // ─── navigation ──────────────────────────────────────+ const navigateTo = (path) => {+ setPreviewFile(null);+ setEditing(false);+ setCurrentPath(path);+ };++ const goBack = () => {+ if (historyIdx > 0) {+ navByHistory.current = true;+ setHistoryIdx(historyIdx - 1);+ setCurrentPath(history[historyIdx - 1]);}};+ const goForward = () => {+ if (historyIdx < history.length - 1) {+ navByHistory.current = true;+ setHistoryIdx(historyIdx + 1);+ setCurrentPath(history[historyIdx + 1]);+ }+ };+ const goUp = () => parentPath && navigateTo(parentPath);- const handleFileClick = async (entry) => {- setSelectedFile(entry);- if (entry.is_editable) {- try {- const data = await api.readFile(entry.path);- setFileContent(data.content);- } catch (error) {- toast.error(`Failed to read file: ${error.message}`);+ const handleOpen = async (entry) => {+ if (entry.is_dir) {+ navigateTo(entry.path);+ } else {+ setPreviewFile(entry);+ setEditing(false);+ if (entry.is_editable) {+ try {+ const data = await api.readFile(entry.path);+ setFileContent(data.content);+ } catch (error) {+ toast.error(`Failed to read file: ${error.message}`);+ }}}};- const handleEditFile = () => {- if (selectedFile && selectedFile.is_editable) {- setEditingFile(selectedFile);+ // ─── selection ───────────────────────────────────────+ const handleToggleSelect = (entry, e) => {+ const path = entry.path;+ if (e?.shiftKey && lastClickedPath) {+ const list = sortedFiltered;+ const a = list.findIndex((x) => x.path === lastClickedPath);+ const b = list.findIndex((x) => x.path === path);+ if (a >= 0 && b >= 0) {+ const [from, to] = [Math.min(a, b), Math.max(a, b)];+ const rangePaths = list.slice(from, to + 1).map((x) => x.path);+ setSelectedPaths(new Set([...selectedPaths, ...rangePaths]));+ }+ } else {+ const next = new Set(selectedPaths);+ if (next.has(path)) next.delete(path); else next.add(path);+ setSelectedPaths(next);+ setLastClickedPath(path);}};+ const clearSelection = () => setSelectedPaths(new Set());++ // ─── ops ─────────────────────────────────────────────const handleSaveFile = async () => {- if (!editingFile) return;+ if (!previewFile) return;try {- await api.writeFile(editingFile.path, fileContent);- toast.success('File saved successfully');- setEditingFile(null);+ await api.writeFile(previewFile.path, fileContent);+ toast.success('File saved');+ setEditing(false);loadDirectory(currentPath);} catch (error) {- toast.error(`Failed to save file: ${error.message}`);+ toast.error(`Failed to save: ${error.message}`);}};const handleCreateFile = async () => {if (!newFileName.trim()) return;- const filePath = `${currentPath}/${newFileName}`;try {- await api.createFile(filePath);- toast.success('File created successfully');+ await api.createFile(`${currentPath}/${newFileName}`);+ toast.success('File created');setShowNewFileModal(false);setNewFileName('');loadDirectory(currentPath);@@ -201,36 +381,54 @@ function FileManager() {const handleCreateFolder = async () => {if (!newFolderName.trim()) return;- const folderPath = `${currentPath}/${newFolderName}`;try {- await api.createDirectory(folderPath);- toast.success('Folder created successfully');+ await api.createDirectory(`${currentPath}/${newFolderName}`);+ toast.success('Folder created');setShowNewFolderModal(false);setNewFolderName('');loadDirectory(currentPath);+ // Refresh tree cache for parent so the new folder appears in the tree+ const parent = currentPath;+ if (treeCache.has(parent)) {+ try {+ const data = await api.browseFiles(parent, false);+ const folders = (data.entries || []).filter((e) => e.is_dir).map((e) => ({ path: e.path, name: e.name }));+ setTreeCache((c) => { const n = new Map(c); n.set(parent, folders); return n; });+ } catch { /* ignore */ }+ }} catch (error) {toast.error(`Failed to create folder: ${error.message}`);}};- const handleDelete = async (entry) => {+ const handleDelete = (target) => {+ const items = Array.isArray(target) ? target : [target];+ if (items.length === 0) return;+ const message = items.length === 1+ ? `Delete "${items[0].name}"?${items[0].is_dir ? ' All contents inside will be removed.' : ''}`+ : `Delete ${items.length} items? This cannot be undone.`;setConfirmDialog({title: 'Delete Confirmation',- message: `Are you sure you want to delete "${entry.name}"? ${entry.is_dir ? 'This will delete all contents inside.' : ''}`,+ message,confirmText: 'Delete',variant: 'danger',onConfirm: async () => {- try {- await api.deleteFile(entry.path);- toast.success(`${entry.is_dir ? 'Folder' : 'File'} deleted successfully`);- setSelectedFile(null);- loadDirectory(currentPath);- } catch (error) {- toast.error(`Failed to delete: ${error.message}`);+ const failures = [];+ for (const it of items) {+ try {+ await api.deleteFile(it.path);+ } catch (error) {+ failures.push(`${it.name}: ${error.message}`);+ }}+ if (failures.length === 0) toast.success(`Deleted ${items.length} item${items.length > 1 ? 's' : ''}`);+ else toast.error(`Failed: ${failures.join(', ')}`);+ if (previewFile && items.some((i) => i.path === previewFile.path)) setPreviewFile(null);+ clearSelection();+ loadDirectory(currentPath);setConfirmDialog(null);},- onCancel: () => setConfirmDialog(null)+ onCancel: () => setConfirmDialog(null),});};@@ -238,7 +436,7 @@ function FileManager() {if (!renameTarget || !newName.trim()) return;try {await api.renameFile(renameTarget.path, newName);- toast.success('Renamed successfully');+ toast.success('Renamed');setShowRenameModal(false);setRenameTarget(null);setNewName('');@@ -252,74 +450,201 @@ function FileManager() {if (!permissionsTarget || !newPermissions.trim()) return;try {await api.changeFilePermissions(permissionsTarget.path, newPermissions);- toast.success('Permissions changed successfully');+ toast.success('Permissions updated');setShowPermissionsModal(false);setPermissionsTarget(null);setNewPermissions('');loadDirectory(currentPath);} catch (error) {- toast.error(`Failed to change permissions: ${error.message}`);- }- };-- const handleUpload = async (e) => {- const file = e.target.files[0];- if (!file) return;-- try {- await api.uploadFile(currentPath, file, (progress) => {- setUploadProgress(progress);- });- toast.success('File uploaded successfully');- loadDirectory(currentPath);- } catch (error) {- toast.error(`Upload failed: ${error.message}`);- } finally {- setUploadProgress(null);- if (fileInputRef.current) {- fileInputRef.current.value = '';- }+ toast.error(`Failed: ${error.message}`);}};- const handleDownload = (entry) => {- api.downloadFile(entry.path);- };-const openRenameModal = (entry) => {setRenameTarget(entry);setNewName(entry.name);setShowRenameModal(true);};-const openPermissionsModal = (entry) => {setPermissionsTarget(entry);setNewPermissions(entry.permissions_octal || '755');setShowPermissionsModal(true);};- const getFileIcon = (entry) => {- if (entry.is_dir) return <Folder size={18} className="file-icon-svg folder" />;-- const ext = entry.name.split('.').pop().toLowerCase();- const codeExts = ['js', 'jsx', 'ts', 'tsx', 'py', 'rb', 'php', 'java', 'c', 'cpp', 'h', 'go', 'rs'];- const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'svg', 'webp', 'ico'];- const videoExts = ['mp4', 'avi', 'mkv', 'mov', 'wmv', 'webm'];- const audioExts = ['mp3', 'wav', 'flac', 'aac', 'ogg', 'wma'];- const archiveExts = ['zip', 'tar', 'gz', 'rar', '7z', 'bz2'];- const dataExts = ['json', 'xml', 'yaml', 'yml', 'csv', 'db', 'sqlite', 'sql'];- const textExts = ['txt', 'md', 'log', 'ini', 'conf', 'cfg'];-- if (codeExts.includes(ext)) return <FileCode size={18} className="file-icon-svg code" />;- if (imageExts.includes(ext)) return <FileImage size={18} className="file-icon-svg image" />;- if (videoExts.includes(ext)) return <FileVideo size={18} className="file-icon-svg video" />;- if (audioExts.includes(ext)) return <FileAudio size={18} className="file-icon-svg audio" />;- if (archiveExts.includes(ext)) return <FileArchive size={18} className="file-icon-svg archive" />;- if (dataExts.includes(ext)) return <Database size={18} className="file-icon-svg data" />;- if (textExts.includes(ext)) return <FileText size={18} className="file-icon-svg text" />;- if (['sh', 'bash', 'zsh'].includes(ext)) return <Terminal size={18} className="file-icon-svg terminal" />;-- return <File size={18} className="file-icon-svg" />;+ // ─── upload ──────────────────────────────────────────+ const uploadFiles = async (files) => {+ const fileList = Array.from(files);+ if (fileList.length === 0) return;+ const queue = fileList.map((f, i) => ({+ id: `${Date.now()}-${i}`,+ name: f.name,+ size: f.size,+ progress: 0,+ status: 'pending',+ }));+ setUploads((p) => [...p, ...queue]);++ let succeeded = 0;+ for (let i = 0; i < fileList.length; i++) {+ const file = fileList[i];+ const itemId = queue[i].id;+ try {+ setUploads((p) => p.map((u) => u.id === itemId ? { ...u, status: 'uploading' } : u));+ await api.uploadFile(currentPath, file, (progress) => {+ setUploads((p) => p.map((u) => u.id === itemId ? { ...u, progress } : u));+ });+ setUploads((p) => p.map((u) => u.id === itemId ? { ...u, status: 'done', progress: 100 } : u));+ succeeded++;+ } catch (error) {+ setUploads((p) => p.map((u) => u.id === itemId ? { ...u, status: 'error', error: error.message } : u));+ }+ }+ if (succeeded > 0) toast.success(`Uploaded ${succeeded} of ${fileList.length} file${fileList.length > 1 ? 's' : ''}`);+ loadDirectory(currentPath);+ setTimeout(() => {+ setUploads((p) => p.filter((u) => u.status === 'uploading' || u.status === 'pending'));+ }, 4000);+ };++ const handleUploadInput = (e) => {+ if (e.target.files) uploadFiles(e.target.files);+ if (fileInputRef.current) fileInputRef.current.value = '';+ };++ const handleDragEnter = (e) => {+ e.preventDefault(); e.stopPropagation();+ dragCounter.current += 1;+ if (e.dataTransfer.items?.length > 0) setDragActive(true);+ };+ const handleDragLeave = (e) => {+ e.preventDefault(); e.stopPropagation();+ dragCounter.current -= 1;+ if (dragCounter.current === 0) setDragActive(false);+ };+ const handleDragOver = (e) => { e.preventDefault(); e.stopPropagation(); };+ const handleDrop = (e) => {+ e.preventDefault(); e.stopPropagation();+ dragCounter.current = 0;+ setDragActive(false);+ if (e.dataTransfer.files?.length > 0) uploadFiles(e.dataTransfer.files);+ };++ // ─── pinned ──────────────────────────────────────────+ const isPinned = useCallback((path) => pinned.some((p) => p.path === path), [pinned]);+ const togglePin = useCallback((target) => {+ const path = typeof target === 'string' ? target : target.path;+ const name = typeof target === 'string' ? path.split('/').pop() || path : (target.name || target.path.split('/').pop());+ if (isPinned(path)) {+ setPinned((p) => p.filter((x) => x.path !== path));+ } else {+ setPinned((p) => [...p, { path, name }]);+ }+ }, [isPinned]);++ // ─── derived ─────────────────────────────────────────+ const breadcrumbs = useMemo(() => {+ const parts = currentPath.split('/').filter(Boolean);+ const crumbs = [{ name: '/', path: '/' }];+ let acc = '';+ parts.forEach((p) => { acc += '/' + p; crumbs.push({ name: p, path: acc }); });+ return crumbs;+ }, [currentPath]);++ const sortedFiltered = useMemo(() => {+ let list = [...(searchResults || entries)];+ if (activeFilter !== 'all') list = list.filter((e) => getFileType(e) === activeFilter);+ const dir = sortDir === 'asc' ? 1 : -1;+ list.sort((a, b) => {+ if (a.is_dir !== b.is_dir) return a.is_dir ? -1 : 1;+ switch (sortBy) {+ case 'size': return ((a.size || 0) - (b.size || 0)) * dir;+ case 'modified': return (new Date(a.modified) - new Date(b.modified)) * dir;+ case 'type': return getFileType(a).localeCompare(getFileType(b)) * dir;+ case 'name':+ default: return a.name.localeCompare(b.name) * dir;+ }+ });+ return list;+ }, [entries, searchResults, sortBy, sortDir, activeFilter]);++ const filterCounts = useMemo(() => {+ const counts = { all: entries.length };+ FILTER_CHIPS.forEach((c) => { if (c.id !== 'all') counts[c.id] = 0; });+ entries.forEach((e) => { const t = getFileType(e); if (counts[t] !== undefined) counts[t]++; });+ return counts;+ }, [entries]);++ const stats = useMemo(() => {+ const list = sortedFiltered;+ const folders = list.filter((e) => e.is_dir).length;+ const files = list.length - folders;+ const totalBytes = list.reduce((s, e) => s + (e.size || 0), 0);+ const selectedList = list.filter((e) => selectedPaths.has(e.path));+ const selectedBytes = selectedList.reduce((s, e) => s + (e.size || 0), 0);+ return { folders, files, totalBytes, total: list.length, selectedCount: selectedList.length, selectedBytes };+ }, [sortedFiltered, selectedPaths]);++ const activeUploads = uploads.filter((u) => u.status === 'uploading' || u.status === 'pending');+ const totalUploadProgress = activeUploads.length > 0+ ? activeUploads.reduce((s, u) => s + u.progress, 0) / activeUploads.length+ : 0;++ const selectedEntries = useMemo(+ () => sortedFiltered.filter((e) => selectedPaths.has(e.path)),+ [sortedFiltered, selectedPaths],+ );++ // ─── shortcuts ───────────────────────────────────────+ useEffect(() => {+ const handler = (e) => {+ const inInput = ['INPUT', 'TEXTAREA'].includes(e.target.tagName);+ if (inInput) return;+ if (e.key === 'Escape') {+ if (contextMenu) setContextMenu(null);+ else if (sortOpen) setSortOpen(false);+ else if (previewFile) setPreviewFile(null);+ else if (selectedPaths.size > 0) clearSelection();+ }+ if ((e.key === 'Delete' || (e.key === 'Backspace' && e.metaKey)) && selectedEntries.length > 0) {+ e.preventDefault();+ handleDelete(selectedEntries);+ }+ if (e.key === 'F2' && selectedEntries.length === 1) openRenameModal(selectedEntries[0]);+ if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'a') {+ e.preventDefault();+ setSelectedPaths(new Set(sortedFiltered.map((x) => x.path)));+ }+ if (e.key === 'Backspace' && !e.metaKey && parentPath) { e.preventDefault(); goUp(); }+ };+ window.addEventListener('keydown', handler);+ return () => window.removeEventListener('keydown', handler);+ }, [selectedEntries, sortedFiltered, contextMenu, sortOpen, previewFile, parentPath, selectedPaths]); // eslint-disable-line++ // ─── close popovers ──────────────────────────────────+ useEffect(() => {+ if (!contextMenu && !sortOpen) return;+ const close = () => { setContextMenu(null); setSortOpen(false); };+ document.addEventListener('click', close);+ return () => document.removeEventListener('click', close);+ }, [contextMenu, sortOpen]);++ const openContextMenu = (e, entry) => {+ e.preventDefault();+ e.stopPropagation();+ if (!selectedPaths.has(entry.path)) {+ setSelectedPaths(new Set([entry.path]));+ setLastClickedPath(entry.path);+ }+ setContextMenu({ x: e.clientX, y: e.clientY, entry });+ };++ const copyPathToClipboard = async (path) => {+ try { await navigator.clipboard.writeText(path); toast.success('Path copied'); }+ catch { toast.error('Could not copy path'); }+ };++ const downloadSelected = () => {+ selectedEntries.filter((e) => !e.is_dir).forEach((e) => api.downloadFile(e.path));};const getDiskColor = (percent) => {@@ -328,10 +653,15 @@ function FileManager() {return 'healthy';};- const displayedEntries = searchResults || entries;-+ // ─── render ──────────────────────────────────────────return (- <div className={`page-container file-manager-page file-manager ${sidebarVisible ? 'sidebar-open' : ''}`}>+ <div+ className={`page-container file-manager-page file-manager ${sidebarVisible ? 'sidebar-open' : ''} view-${viewMode} grid-${gridSize} ${selectMode ? 'select-mode' : ''}`}+ onDragEnter={handleDragEnter}+ onDragOver={handleDragOver}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ ><div className="page-header"><div className="page-header-content"><h1>File Manager</h1>@@ -339,247 +669,356 @@ function FileManager() {</div><div className="page-header-actions"><Button variant="outline" onClick={() => fileInputRef.current?.click()}>- <Upload size={16} />- Upload+ <Upload size={16} /> Upload</Button><Button variant="outline" onClick={() => setShowNewFolderModal(true)}>- <FolderPlus size={16} />- New Folder+ <FolderPlus size={16} /> New Folder</Button><Button onClick={() => setShowNewFileModal(true)}>- <FilePlus size={16} />- New File+ <FilePlus size={16} /> New File</Button><inputtype="file"ref={fileInputRef}+ multiplestyle={{ display: 'none' }}- onChange={handleUpload}+ onChange={handleUploadInput}/></div></div>- {uploadProgress !== null && (- <div className="upload-progress">- <ProgressBar percent={uploadProgress} />- <span>{Math.round(uploadProgress)}%</span>+ {uploads.length > 0 && (+ <div className="upload-tray">+ <div className="upload-tray-header">+ <CloudUpload size={16} />+ <span>+ {activeUploads.length > 0+ ? `Uploading ${activeUploads.length} file${activeUploads.length > 1 ? 's' : ''}…`+ : 'Uploads complete'}+ </span>+ {activeUploads.length > 0 && (+ <span className="upload-tray-percent">{Math.round(totalUploadProgress)}%</span>+ )}+ <button className="toolbar-icon-btn small" onClick={() => setUploads([])} title="Clear">+ <X size={14} />+ </button>+ </div>+ <div className="upload-tray-list">+ {uploads.map((u) => (+ <div key={u.id} className={`upload-tray-item status-${u.status}`}>+ <span className="upload-name">{u.name}</span>+ <div className="upload-bar">+ <div className="upload-bar-fill" style={{ width: `${u.progress}%` }} />+ </div>+ <span className="upload-status">+ {u.status === 'done' ? 'Done' : u.status === 'error' ? 'Failed' : `${Math.round(u.progress)}%`}+ </span>+ </div>+ ))}+ </div></div>)}<div className="file-manager-toolbar">- <div className="path-breadcrumb">- <Button- variant="ghost"- size="icon"- onClick={() => parentPath && setCurrentPath(parentPath)}- disabled={!parentPath}+ <div className="toolbar-left">+ <button+ className="toolbar-icon-btn"+ onClick={() => setSidebarVisible(!sidebarVisible)}+ title={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}>- <ArrowLeft size={16} />- </Button>- <span className="current-path">{currentPath}</span>+ {sidebarVisible ? <PanelLeftClose size={14} /> : <PanelLeftOpen size={14} />}+ </button>+ <div className="nav-buttons">+ <button className="nav-btn" onClick={goBack} disabled={historyIdx === 0} title="Back">+ <ArrowLeft size={14} />+ </button>+ <button className="nav-btn" onClick={goForward} disabled={historyIdx >= history.length - 1} title="Forward">+ <ArrowRight size={14} />+ </button>+ <button className="nav-btn" onClick={goUp} disabled={!parentPath} title="Up">+ <ArrowUp size={14} />+ </button>+ <button className="nav-btn" onClick={() => navigateTo('/home')} title="Home">+ <Home size={14} />+ </button>+ </div>+ <div className="path-breadcrumb">+ {breadcrumbs.map((crumb, idx) => (+ <span key={crumb.path + idx} className="crumb-segment">+ {idx > 0 && <ChevronRight size={12} className="crumb-separator" />}+ <button+ className={`crumb ${idx === breadcrumbs.length - 1 ? 'crumb-active' : ''}`}+ onClick={() => navigateTo(crumb.path)}+ >+ {crumb.name}+ </button>+ </span>+ ))}+ <button+ className={`crumb-pin ${isPinned(currentPath) ? 'pinned' : ''}`}+ onClick={() => togglePin(currentPath)}+ title={isPinned(currentPath) ? 'Unpin' : 'Pin to Quick Access'}+ >+ {isPinned(currentPath) ? <Star size={12} fill="currentColor" /> : <StarOff size={12} />}+ </button>+ </div></div>- <div className="toolbar-actions">- <div className="search-box">- <Search size={16} className="search-icon" />+ <div className="toolbar-right">+ <div className="search-field">+ <Search size={14} className="search-field-icon" /><inputtype="text"- placeholder="Search files..."+ placeholder="Search files…"value={searchQuery}onChange={(e) => setSearchQuery(e.target.value)}onKeyDown={(e) => e.key === 'Enter' && handleSearch()}/>- {searchResults && (- <Button variant="ghost" size="icon" className="btn-sm" onClick={() => setSearchResults(null)}>- <X size={14} />- </Button>+ {(searchResults || searchQuery) && (+ <button+ className="search-field-clear"+ onClick={() => { setSearchResults(null); setSearchQuery(''); }}+ title="Clear"+ >+ <X size={12} />+ </button>+ )}+ </div>+ <div className="sort-control" onClick={(e) => e.stopPropagation()}>+ <button className="toolbar-chip" onClick={() => setSortOpen(!sortOpen)} title="Sort">+ <ArrowUpDown size={14} />+ <span>Sort</span>+ </button>+ {sortOpen && (+ <div className="sort-popover">+ <div className="sort-popover-label">Sort by</div>+ {[+ { id: 'name', label: 'Name' },+ { id: 'size', label: 'Size' },+ { id: 'modified', label: 'Modified' },+ { id: 'type', label: 'Type' },+ ].map((opt) => (+ <button+ key={opt.id}+ className={`sort-popover-item ${sortBy === opt.id ? 'active' : ''}`}+ onClick={() => { setSortBy(opt.id); setSortOpen(false); }}+ >+ {sortBy === opt.id && <Check size={12} />}+ <span>{opt.label}</span>+ </button>+ ))}+ <div className="sort-popover-divider" />+ <button+ className={`sort-popover-item ${sortDir === 'asc' ? 'active' : ''}`}+ onClick={() => { setSortDir('asc'); setSortOpen(false); }}+ >+ {sortDir === 'asc' && <Check size={12} />}+ <span>Ascending</span>+ </button>+ <button+ className={`sort-popover-item ${sortDir === 'desc' ? 'active' : ''}`}+ onClick={() => { setSortDir('desc'); setSortOpen(false); }}+ >+ {sortDir === 'desc' && <Check size={12} />}+ <span>Descending</span>+ </button>+ </div>)}</div>- <Button- variant="outline"- size="sm"+ <button+ className={`toolbar-chip ${selectMode ? 'active' : ''}`}+ onClick={() => { setSelectMode(!selectMode); if (selectMode) clearSelection(); }}+ title="Toggle selection mode"+ >+ <MousePointer2 size={14} />+ <span>Select</span>+ </button>+ {viewMode === 'grid' && (+ <div className="view-toggle">+ <button+ className={`view-toggle-btn ${gridSize === 'sm' ? 'active' : ''}`}+ onClick={() => setGridSize('sm')}+ title="Small thumbnails"+ >+ <ZoomOut size={14} />+ </button>+ <button+ className={`view-toggle-btn ${gridSize === 'md' ? 'active' : ''}`}+ onClick={() => setGridSize('md')}+ title="Medium thumbnails"+ >+ <LayoutGrid size={14} />+ </button>+ <button+ className={`view-toggle-btn ${gridSize === 'lg' ? 'active' : ''}`}+ onClick={() => setGridSize('lg')}+ title="Large thumbnails"+ >+ <ZoomIn size={14} />+ </button>+ </div>+ )}+ <div className="view-toggle">+ <button+ className={`view-toggle-btn ${viewMode === 'grid' ? 'active' : ''}`}+ onClick={() => setViewMode('grid')}+ title="Grid view"+ >+ <LayoutGrid size={14} />+ </button>+ <button+ className={`view-toggle-btn ${viewMode === 'list' ? 'active' : ''}`}+ onClick={() => setViewMode('list')}+ title="List view"+ >+ <List size={14} />+ </button>+ </div>+ <button+ className={`toolbar-chip ${showHidden ? 'active' : ''}`}+ onClick={() => setShowHidden(!showHidden)}+ title="Toggle hidden files"+ >+ {showHidden ? <Eye size={14} /> : <EyeOff size={14} />}+ <span>Hidden</span>+ </button>+ <button+ className="toolbar-chip"onClick={analyzeDirectory}disabled={analysisLoading}title="Analyze directory sizes"><BarChart3 size={14} />- Analyze- </Button>- <label className="checkbox-label">- <input- type="checkbox"- checked={showHidden}- onChange={(e) => setShowHidden(e.target.checked)}- />- {showHidden ? <Eye size={14} /> : <EyeOff size={14} />}- Hidden- </label>- <Button variant="ghost" size="icon" onClick={() => loadDirectory(currentPath)} title="Refresh">- <RefreshCw size={16} />- </Button>- <Button- variant="ghost"- size="icon"- onClick={() => setSidebarVisible(!sidebarVisible)}- title={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}+ <span>{analysisLoading ? 'Analyzing…' : 'Analyze'}</span>+ </button>+ <button+ className="toolbar-icon-btn"+ onClick={() => loadDirectory(currentPath)}+ title="Refresh">- {sidebarVisible ? <PanelRightClose size={16} /> : <PanelRightOpen size={16} />}- </Button>+ <RefreshCw size={14} className={loading ? 'spinning' : ''} />+ </button></div></div>- <div className="file-manager-layout">- <div className="file-manager-main">- <div className="file-manager-content">- <div className="file-list-container">- {loading ? (- <div className="loading-state">- <Spinner />- </div>- ) : displayedEntries.length === 0 ? (- <div className="empty-state">- <Folder size={48} strokeWidth={1.5} />- <p>{searchResults ? 'No files found matching your search' : 'This directory is empty'}</p>+ <div className="filter-chips-row">+ {FILTER_CHIPS.map((chip) => {+ const Icon = chip.icon;+ const count = filterCounts[chip.id] ?? 0;+ return (+ <button+ key={chip.id}+ className={`filter-chip ${activeFilter === chip.id ? 'active' : ''}`}+ onClick={() => setActiveFilter(chip.id)}+ disabled={chip.id !== 'all' && count === 0}+ >+ <Icon size={13} />+ <span>{chip.label}</span>+ <span className="filter-chip-count">{count}</span>+ </button>+ );+ })}+ </div>++ {selectedPaths.size > 0 && (+ <div className="bulk-bar">+ <div className="bulk-bar-info">+ <Check size={14} />+ <span>{selectedPaths.size} selected · {formatBytes(stats.selectedBytes)}</span>+ </div>+ <div className="bulk-bar-actions">+ <button className="bulk-btn" onClick={downloadSelected}>+ <Download size={14} /> Download+ </button>+ {selectedEntries.length === 1 && (+ <>+ <button className="bulk-btn" onClick={() => openRenameModal(selectedEntries[0])}>+ <Edit3 size={14} /> Rename+ </button>+ <button className="bulk-btn" onClick={() => copyPathToClipboard(selectedEntries[0].path)}>+ <Copy size={14} /> Copy path+ </button>+ </>+ )}+ <button className="bulk-btn danger" onClick={() => handleDelete(selectedEntries)}>+ <Trash2 size={14} /> Delete+ </button>+ <button className="bulk-btn ghost" onClick={clearSelection}>+ <X size={14} /> Clear+ </button>+ </div>+ </div>+ )}++ <div className="file-manager-body">+ {sidebarVisible && (+ <aside className="file-manager-sidebar left">+ {/* Folder Tree */}+ <div className="sidebar-section">+ <button className="sidebar-section-header" onClick={() => setTreeCollapsed(!treeCollapsed)}>+ <FolderTreeIcon size={16} />+ <span>Folders</span>+ {treeCollapsed ? <ChevronRight size={16} /> : <ChevronDown size={16} />}+ </button>+ {!treeCollapsed && (+ <div className="sidebar-section-content tree-content">+ <FolderTree+ roots={TREE_ROOTS}+ expanded={treeExpanded}+ treeCache={treeCache}+ treeLoading={treeLoading}+ currentPath={currentPath}+ onNavigate={navigateTo}+ onToggle={toggleTreeExpand}+ /></div>- ) : (- <div className="file-list">- <div className="file-list-header">- <span className="col-name">Name</span>- <span className="col-size">Size</span>- <span className="col-modified">Modified</span>- <span className="col-permissions">Permissions</span>- <span className="col-actions">Actions</span>- </div>- {displayedEntries.map((entry) => (+ )}+ </div>++ {/* Quick Access */}+ <div className="sidebar-section">+ <button className="sidebar-section-header" onClick={() => setQuickCollapsed(!quickCollapsed)}>+ <Star size={16} />+ <span>Quick Access</span>+ {quickCollapsed ? <ChevronRight size={16} /> : <ChevronDown size={16} />}+ </button>+ {!quickCollapsed && (+ <div className="sidebar-section-content quick-access-list">+ {pinned.length === 0 && (+ <div className="quick-access-empty">+ Star folders from the breadcrumb to pin them here.+ </div>+ )}+ {pinned.map((p) => (<div- key={entry.path}- className={`file-item ${selectedFile?.path === entry.path ? 'selected' : ''}`}- onClick={() => handleNavigate(entry)}+ key={p.path}+ className={`quick-access-item ${currentPath === p.path ? 'active' : ''}`}+ onClick={() => navigateTo(p.path)}>- <span className="col-name">- {getFileIcon(entry)}- {entry.name}- {entry.is_link && <span className="link-indicator">→</span>}- </span>- <span className="col-size">{entry.is_dir ? '-' : entry.size_human}</span>- <span className="col-modified">- {new Date(entry.modified).toLocaleDateString()}- </span>- <span className="col-permissions">{entry.permissions}</span>- <span className="col-actions" onClick={(e) => e.stopPropagation()}>- {!entry.is_dir && (- <Button- variant="ghost"- size="icon"- className="btn-sm"- onClick={() => handleDownload(entry)}- title="Download"- >- <Download size={14} />- </Button>- )}- <Button- variant="ghost"- size="icon"- className="btn-sm"- onClick={() => openRenameModal(entry)}- title="Rename"- >- <Edit3 size={14} />- </Button>- <Button- variant="ghost"- size="icon"- className="btn-sm"- onClick={() => openPermissionsModal(entry)}- title="Permissions"- >- <Lock size={14} />- </Button>- <Button- variant="destructive"- size="icon"- className="btn-sm"- onClick={() => handleDelete(entry)}- title="Delete"- >- <Trash2 size={14} />- </Button>- </span>+ <Folder size={14} fill="currentColor" fillOpacity={0.15} />+ <div className="quick-access-text">+ <div className="quick-access-name">{p.name}</div>+ <div className="quick-access-path">{p.path}</div>+ </div>+ <button+ className="quick-access-remove"+ onClick={(e) => { e.stopPropagation(); togglePin(p.path); }}+ title="Unpin"+ >+ <X size={12} />+ </button></div>))}</div>)}</div>- {selectedFile && !selectedFile.is_dir && (- <div className="file-preview">- <div className="preview-header">- <h3>{selectedFile.name}</h3>- <div className="preview-actions">- {selectedFile.is_editable && !editingFile && (- <Button size="sm" onClick={handleEditFile}>- <Edit3 size={14} />- Edit- </Button>- )}- {editingFile && (- <>- <Button variant="outline" size="sm" onClick={() => setEditingFile(null)}>- Cancel- </Button>- <Button size="sm" onClick={handleSaveFile}>- Save- </Button>- </>- )}- <Button variant="ghost" size="icon" className="btn-sm" onClick={() => setSelectedFile(null)}>- <X size={16} />- </Button>- </div>- </div>- <div className="preview-info">- <span>Size: {selectedFile.size_human}</span>- <span>Owner: {selectedFile.owner}</span>- <span>Group: {selectedFile.group}</span>- {selectedFile.mime_type && <span>Type: {selectedFile.mime_type}</span>}- </div>- {selectedFile.is_editable ? (- <textarea- className="file-editor"- value={fileContent}- onChange={(e) => setFileContent(e.target.value)}- readOnly={!editingFile}- spellCheck={false}- />- ) : (- <div className="preview-unavailable">- <EyeOff size={48} strokeWidth={1.5} />- <p>Preview not available for this file type</p>- <Button onClick={() => handleDownload(selectedFile)}>- <Download size={16} />- Download File- </Button>- </div>- )}- </div>- )}- </div>- </div>-- {/* Sidebar */}- {sidebarVisible && (- <div className="file-manager-sidebar">- {/* Disk Usage Section */}+ {/* Disk Usage */}<div className="sidebar-section">- <button- className="sidebar-section-header"- onClick={() => setDiskCollapsed(!diskCollapsed)}- >+ <button className="sidebar-section-header" onClick={() => setDiskCollapsed(!diskCollapsed)}><HardDrive size={16} /><span>Disk Usage</span>{diskCollapsed ? <ChevronRight size={16} /> : <ChevronDown size={16} />}</button>-{!diskCollapsed && (<div className="sidebar-section-content"><div className="disk-header-row">@@ -589,18 +1028,10 @@ function FileManager() {{diskLastUpdated.toLocaleTimeString()}</span>)}- <Button- variant="ghost"- size="icon"- className="btn-sm"- onClick={loadDiskMounts}- disabled={diskLoading}- title="Refresh"- >+ <button className="toolbar-icon-btn small" onClick={loadDiskMounts} disabled={diskLoading} title="Refresh"><RefreshCw size={12} className={diskLoading ? 'spinning' : ''} />- </Button>+ </button></div>-{diskMounts.map((mount, idx) => (<div key={idx} className="disk-mount-item"><div className="disk-mount-header">@@ -610,10 +1041,7 @@ function FileManager() {</span></div><div className={`disk-progress ${getDiskColor(mount.percent)}`}>- <div- className="disk-progress-fill"- style={{ width: `${mount.percent}%` }}- />+ <div className="disk-progress-fill" style={{ width: `${mount.percent}%` }} /></div><div className="disk-mount-info"><span>{mount.used_human} / {mount.total_human}</span>@@ -625,60 +1053,47 @@ function FileManager() {)}</div>- {/* Analysis Section */}+ {/* Analysis */}{(directoryAnalysis || analysisLoading) && (<div className="sidebar-section analysis-section"><div className="sidebar-section-header static"><BarChart3 size={16} /><span>Directory Analysis</span>- <Button- variant="ghost"- size="icon"- className="btn-sm close-btn"- onClick={closeAnalysis}- >+ <button className="toolbar-icon-btn small" onClick={() => { setDirectoryAnalysis(null); setTypeBreakdown(null); }}><X size={14} />- </Button>+ </button></div>-<div className="sidebar-section-content">{analysisLoading ? (<div className="analysis-loading">- <Spinner />- <span>Analyzing...</span>+ <Spinner /><span>Analyzing…</span></div>) : (<><div className="analysis-total">Total: {directoryAnalysis.total_size_human}</div>-- {/* View Toggle */}<div className="analysis-tabs"><buttonclassName={`analysis-tab ${analysisView === 'directories' ? 'active' : ''}`}onClick={() => setAnalysisView('directories')}>- <Folder size={14} />- Directories+ <Folder size={14} /> Directories</button><buttonclassName={`analysis-tab ${analysisView === 'files' ? 'active' : ''}`}onClick={() => setAnalysisView('files')}>- <File size={14} />- Files+ <File size={14} /> Files</button></div>-- {/* Directory Sizes */}{analysisView === 'directories' && (<div className="analysis-bars">{directoryAnalysis.directories.slice(0, 10).map((dir, idx) => (<divkey={idx}className="analysis-bar-item"- onClick={() => setCurrentPath(dir.path)}+ onClick={() => navigateTo(dir.path)}><div className="analysis-bar-header"><span className="analysis-bar-name">@@ -688,36 +1103,23 @@ function FileManager() {<span className="analysis-bar-size">{dir.size_human}</span></div><div className="analysis-bar-track">- <div- className="analysis-bar-fill"- style={{ width: `${dir.percent}%` }}- />+ <div className="analysis-bar-fill" style={{ width: `${dir.percent}%` }} /></div></div>))}- {directoryAnalysis.directories.length === 0 && (- <div className="analysis-empty">No subdirectories</div>- )}+ {directoryAnalysis.directories.length === 0 && <div className="analysis-empty">No subdirectories</div>}</div>)}-- {/* Largest Files */}{analysisView === 'files' && (<div className="analysis-files">{directoryAnalysis.largest_files.slice(0, 10).map((file, idx) => (- <div- key={idx}- className="analysis-file-item"- onClick={() => handleFileClick(file)}- >+ <div key={idx} className="analysis-file-item" onClick={() => handleOpen(file)}><File size={12} /><span className="analysis-file-name">{file.name}</span><span className="analysis-file-size">{file.size_human}</span></div>))}- {directoryAnalysis.largest_files.length === 0 && (- <div className="analysis-empty">No files</div>- )}+ {directoryAnalysis.largest_files.length === 0 && <div className="analysis-empty">No files</div>}</div>)}</>@@ -726,7 +1128,7 @@ function FileManager() {</div>)}- {/* Type Breakdown Section */}+ {/* Type breakdown chart */}{typeBreakdown && typeBreakdown.breakdown && typeBreakdown.breakdown.length > 0 && (<div className="sidebar-section"><div className="sidebar-section-header static">@@ -754,7 +1156,7 @@ function FileManager() {<Tooltipformatter={(value, name) => [typeBreakdown.breakdown.find(b => b.name === name)?.size_human || value,- name+ name,]}/></RechartsPie>@@ -763,10 +1165,7 @@ function FileManager() {<div className="type-breakdown-legend">{typeBreakdown.breakdown.map((cat, idx) => (<div key={idx} className="type-legend-item">- <span- className="type-legend-color"- style={{ background: cat.color }}- />+ <span className="type-legend-color" style={{ background: cat.color }} /><span className="type-legend-name">{cat.name}</span><span className="type-legend-size">{cat.size_human}</span></div>@@ -775,19 +1174,173 @@ function FileManager() {</div></div>)}- </div>+ </aside>)}++ <main className="file-manager-main">+ <div+ className="file-list-container"+ onClick={(e) => {+ if (e.target === e.currentTarget) clearSelection();+ }}+ >+ {dragActive && (+ <div className="drag-overlay">+ <div className="drag-overlay-inner">+ <CloudUpload size={56} strokeWidth={1.5} />+ <h3>Drop to upload</h3>+ <p>Files will be uploaded to <code>{currentPath}</code></p>+ </div>+ </div>+ )}++ {loading ? (+ <div className="loading-state">+ <Spinner />+ </div>+ ) : sortedFiltered.length === 0 ? (+ <div className="empty-state">+ <Folder size={56} strokeWidth={1.25} />+ <h3>{searchResults ? 'No matches' : activeFilter !== 'all' ? `No ${activeFilter} files` : 'This folder is empty'}</h3>+ <p>+ {searchResults+ ? 'Try a different search term or browse another folder.'+ : activeFilter !== 'all'+ ? 'Try a different filter.'+ : 'Drop files here, or use the buttons above to create something new.'}+ </p>+ </div>+ ) : viewMode === 'grid' ? (+ <div className="file-grid">+ {sortedFiltered.map((entry) => (+ <FileCard+ key={entry.path}+ entry={entry}+ selected={selectedPaths.has(entry.path)}+ selectMode={selectMode}+ onOpen={handleOpen}+ onToggleSelect={handleToggleSelect}+ onContext={openContextMenu}+ />+ ))}+ </div>+ ) : (+ <div className="file-list">+ <div className="file-list-header">+ <span className="col-check">+ <button+ className="checkbox-btn"+ onClick={() => {+ if (selectedPaths.size === sortedFiltered.length) clearSelection();+ else setSelectedPaths(new Set(sortedFiltered.map((x) => x.path)));+ }}+ >+ <span className={`checkbox ${selectedPaths.size === sortedFiltered.length && sortedFiltered.length > 0 ? 'checked' : ''}`}>+ {selectedPaths.size === sortedFiltered.length && sortedFiltered.length > 0 && <Check size={12} />}+ </span>+ </button>+ </span>+ <span className="col-name">Name</span>+ <span className="col-size">Size</span>+ <span className="col-modified">Modified</span>+ <span className="col-permissions">Permissions</span>+ <span className="col-actions">Actions</span>+ </div>+ {sortedFiltered.map((entry) => (+ <FileRow+ key={entry.path}+ entry={entry}+ selected={selectedPaths.has(entry.path)}+ selectMode={selectMode}+ onOpen={handleOpen}+ onToggleSelect={handleToggleSelect}+ onContext={openContextMenu}+ onDownload={(e) => api.downloadFile(e.path)}+ onRename={openRenameModal}+ onPermissions={openPermissionsModal}+ onDelete={(e) => handleDelete(e)}+ />+ ))}+ </div>+ )}+ </div>+ </main></div>- {/* New File Modal */}+ <div className="status-bar">+ <div className="status-bar-left">+ <span className="status-item">+ <span className="status-label">Total</span>+ <span className="status-value">{stats.total} item{stats.total !== 1 ? 's' : ''}</span>+ </span>+ <span className="status-divider" />+ <span className="status-item">+ <Folder size={12} />+ <span>{stats.folders} folder{stats.folders !== 1 ? 's' : ''}</span>+ </span>+ <span className="status-item">+ <File size={12} />+ <span>{stats.files} file{stats.files !== 1 ? 's' : ''}</span>+ </span>+ {stats.totalBytes > 0 && (+ <>+ <span className="status-divider" />+ <span className="status-item">+ <span className="status-label">Size</span>+ <span className="status-value">{formatBytes(stats.totalBytes)}</span>+ </span>+ </>+ )}+ </div>+ <div className="status-bar-right">+ {stats.selectedCount > 0 && (+ <span className="status-selection">+ {stats.selectedCount} selected · {formatBytes(stats.selectedBytes)}+ </span>+ )}+ <span className="status-shortcuts" title="Keyboard shortcuts">+ ⌫ Up · Del Delete · F2 Rename · ⌘A All+ </span>+ </div>+ </div>++ <ContextMenu+ menu={contextMenu}+ selectionCount={selectedEntries.length}+ isPinned={isPinned}+ onClose={() => setContextMenu(null)}+ onOpen={handleOpen}+ onDownload={(e) => api.downloadFile(e.path)}+ onRename={openRenameModal}+ onPermissions={openPermissionsModal}+ onCopyPath={copyPathToClipboard}+ onTogglePin={togglePin}+ onDelete={(e) => handleDelete(selectedEntries.length > 1 ? selectedEntries : e)}+ />++ <PreviewDrawer+ file={previewFile}+ fileContent={fileContent}+ setFileContent={setFileContent}+ editing={editing}+ onStartEdit={() => setEditing(true)}+ onCancelEdit={() => setEditing(false)}+ onSave={handleSaveFile}+ onClose={() => { setPreviewFile(null); setEditing(false); }}+ onDownload={(e) => api.downloadFile(e.path)}+ onRename={openRenameModal}+ onPermissions={openPermissionsModal}+ onCopyPath={copyPathToClipboard}+ onDelete={(e) => handleDelete(e)}+ />++ {/* Modals */}{showNewFileModal && (<div className="modal-overlay" onClick={() => setShowNewFileModal(false)}><div className="modal" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Create New File</h2>- <Button variant="ghost" size="icon" onClick={() => setShowNewFileModal(false)}>- <X size={20} />- </Button>+ <Button variant="ghost" size="icon" onClick={() => setShowNewFileModal(false)}><X size={20} /></Button></div><div className="modal-body"><div className="form-group">@@ -798,31 +1351,25 @@ function FileManager() {onChange={(e) => setNewFileName(e.target.value)}placeholder="example.txt"autoFocus+ onKeyDown={(e) => e.key === 'Enter' && handleCreateFile()}/></div>- <p className="text-muted">File will be created in: {currentPath}</p>+ <p className="text-muted">Will be created in: <code>{currentPath}</code></p></div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowNewFileModal(false)}>- Cancel- </Button>- <Button onClick={handleCreateFile}>- Create File- </Button>+ <Button variant="outline" onClick={() => setShowNewFileModal(false)}>Cancel</Button>+ <Button onClick={handleCreateFile}>Create File</Button></div></div></div>)}- {/* New Folder Modal */}{showNewFolderModal && (<div className="modal-overlay" onClick={() => setShowNewFolderModal(false)}><div className="modal" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Create New Folder</h2>- <Button variant="ghost" size="icon" onClick={() => setShowNewFolderModal(false)}>- <X size={20} />- </Button>+ <Button variant="ghost" size="icon" onClick={() => setShowNewFolderModal(false)}><X size={20} /></Button></div><div className="modal-body"><div className="form-group">@@ -833,31 +1380,25 @@ function FileManager() {onChange={(e) => setNewFolderName(e.target.value)}placeholder="new-folder"autoFocus+ onKeyDown={(e) => e.key === 'Enter' && handleCreateFolder()}/></div>- <p className="text-muted">Folder will be created in: {currentPath}</p>+ <p className="text-muted">Will be created in: <code>{currentPath}</code></p></div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowNewFolderModal(false)}>- Cancel- </Button>- <Button onClick={handleCreateFolder}>- Create Folder- </Button>+ <Button variant="outline" onClick={() => setShowNewFolderModal(false)}>Cancel</Button>+ <Button onClick={handleCreateFolder}>Create Folder</Button></div></div></div>)}- {/* Rename Modal */}{showRenameModal && (<div className="modal-overlay" onClick={() => setShowRenameModal(false)}><div className="modal" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Rename {renameTarget?.is_dir ? 'Folder' : 'File'}</h2>- <Button variant="ghost" size="icon" onClick={() => setShowRenameModal(false)}>- <X size={20} />- </Button>+ <Button variant="ghost" size="icon" onClick={() => setShowRenameModal(false)}><X size={20} /></Button></div><div className="modal-body"><div className="form-group">@@ -867,30 +1408,24 @@ function FileManager() {value={newName}onChange={(e) => setNewName(e.target.value)}autoFocus+ onKeyDown={(e) => e.key === 'Enter' && handleRename()}/></div></div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowRenameModal(false)}>- Cancel- </Button>- <Button onClick={handleRename}>- Rename- </Button>+ <Button variant="outline" onClick={() => setShowRenameModal(false)}>Cancel</Button>+ <Button onClick={handleRename}>Rename</Button></div></div></div>)}- {/* Permissions Modal */}{showPermissionsModal && (<div className="modal-overlay" onClick={() => setShowPermissionsModal(false)}><div className="modal" onClick={(e) => e.stopPropagation()}><div className="modal-header"><h2>Change Permissions</h2>- <Button variant="ghost" size="icon" onClick={() => setShowPermissionsModal(false)}>- <X size={20} />- </Button>+ <Button variant="ghost" size="icon" onClick={() => setShowPermissionsModal(false)}><X size={20} /></Button></div><div className="modal-body"><div className="form-group">@@ -904,31 +1439,24 @@ function FileManager() {autoFocus/></div>- <p className="text-muted">- Current: {permissionsTarget?.permissions} ({permissionsTarget?.permissions_octal})- </p>+ <p className="text-muted">Current: {permissionsTarget?.permissions} ({permissionsTarget?.permissions_octal})</p><div className="permissions-help">- <p>Common permissions:</p>+ <p>Common values:</p><ul>- <li><code>755</code> - Owner: rwx, Group/Other: rx (directories)</li>- <li><code>644</code> - Owner: rw, Group/Other: r (files)</li>- <li><code>600</code> - Owner: rw only (private files)</li>+ <li><code>755</code> Owner: rwx, Group/Other: rx (directories)</li>+ <li><code>644</code> Owner: rw, Group/Other: r (files)</li>+ <li><code>600</code> Owner: rw only (private files)</li></ul></div></div><div className="modal-footer">- <Button variant="outline" onClick={() => setShowPermissionsModal(false)}>- Cancel- </Button>- <Button onClick={handleChangePermissions}>- Apply- </Button>+ <Button variant="outline" onClick={() => setShowPermissionsModal(false)}>Cancel</Button>+ <Button onClick={handleChangePermissions}>Apply</Button></div></div></div>)}- {/* Confirm Dialog */}{confirmDialog && (<ConfirmDialogtitle={confirmDialog.title}diff --git a/frontend/src/styles/pages/_file-manager.scss b/frontend/src/styles/pages/_file-manager.scssindex 9b5b73d6..054a64c6 100644--- a/frontend/src/styles/pages/_file-manager.scss+++ b/frontend/src/styles/pages/_file-manager.scss@@ -1,10 +1,26 @@-// File Manager Page Styles+// ============================================+// FILE MANAGER+// ============================================++// Type colour palette — used for icon tinting and card glows+$ft-folder: #fbbf24;+$ft-code: #8b5cf6;+$ft-image: #10b981;+$ft-video: #ec4899;+$ft-audio: #f59e0b;+$ft-archive: #ef4444;+$ft-data: #14b8a6;+$ft-text: #94a3b8;+$ft-terminal: #34d399;+$ft-default: #94a3b8;.file-manager {display: flex;flex-direction: column;- gap: $space-4;+ gap: $space-3;+ position: relative;+ // ─── Page header ────────────────────────────────────.page-header {display: flex;justify-content: space-between;@@ -17,8 +33,8 @@font-size: $font-size-2xl;font-weight: $font-weight-semibold;margin: 0 0 $space-1 0;+ letter-spacing: -0.01em;}-.page-description {color: $text-secondary;margin: 0;@@ -29,190 +45,540 @@display: flex;gap: $space-2;flex-wrap: wrap;-- .btn {- display: flex;- align-items: center;- gap: $space-2;- }}}- .upload-progress {+ // ─── Upload tray ────────────────────────────────────+ .upload-tray {+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-lg;+ overflow: hidden;+ }++ .upload-tray-header {display: flex;align-items: center;gap: $space-3;padding: $space-3 $space-4;- background: $bg-card;- border-radius: $radius-lg;+ background: $bg-elevated;+ border-bottom: 1px solid $border-default;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;+ color: $text-primary;- .progress-bar {- flex: 1;- height: 8px;+ > svg { color: $accent-primary; flex-shrink: 0; }++ .upload-tray-percent {+ margin-left: auto;+ font-family: $font-mono;+ font-size: $font-size-xs;+ color: $text-secondary;+ }++ .upload-tray-percent + .toolbar-icon-btn { margin-left: $space-1; }+ > .toolbar-icon-btn:last-child { margin-left: auto; }+ }++ .upload-tray-list {+ max-height: 220px;+ overflow-y: auto;+ padding: $space-2 0;+ }++ .upload-tray-item {+ display: grid;+ grid-template-columns: 1fr 140px 60px;+ gap: $space-3;+ align-items: center;+ padding: $space-2 $space-4;+ font-size: $font-size-xs;++ .upload-name {+ color: $text-primary;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }++ .upload-bar {+ height: 4px;background: $border-default;border-radius: $radius-sm;overflow: hidden;- .progress-fill {+ .upload-bar-fill {height: 100%;background: $accent-primary;@include transition(width);}}- span {- font-size: $font-size-sm;- font-weight: $font-weight-medium;- color: $text-secondary;- min-width: 40px;+ .upload-status {+ text-align: right;+ color: $text-tertiary;+ font-family: $font-mono;+ }++ &.status-done {+ .upload-bar-fill { background: $success; }+ .upload-status { color: $success; }+ }+ &.status-error {+ .upload-bar-fill { background: $danger; }+ .upload-status { color: $danger; }}}+ // ─── Toolbar ────────────────────────────────────────.file-manager-toolbar {display: flex;justify-content: space-between;align-items: center;- padding: $space-3 $space-4;+ padding: $space-2 $space-3;background: $bg-card;- border-radius: $radius-lg;- gap: $space-4;+ border: 1px solid $border-default;+ border-radius: $radius-xl;+ gap: $space-3;flex-wrap: wrap;- .path-breadcrumb {+ .toolbar-left {display: flex;align-items: center;gap: $space-2;+ flex: 1;+ min-width: 0;+ }+ .toolbar-right {+ display: flex;+ align-items: center;+ gap: $space-2;+ flex-wrap: wrap;+ }+ }- .current-path {- font-family: $font-mono;- font-size: $font-size-sm;+ .nav-buttons {+ display: flex;+ gap: 2px;+ padding: 2px;+ background: $bg-tertiary;+ border-radius: $radius-md;++ .nav-btn {+ background: transparent;+ border: none;+ width: 28px;+ height: 28px;+ border-radius: $radius-sm;+ color: $text-secondary;+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ @include transition(all);++ &:hover:not(:disabled) {+ background: $bg-hover;color: $text-primary;- background: $bg-tertiary;- padding: $space-2 $space-3;- border-radius: $radius-md;}+ &:disabled { opacity: 0.35; cursor: not-allowed; }}+ }- .toolbar-actions {+ .path-breadcrumb {+ display: flex;+ align-items: center;+ flex-wrap: wrap;+ min-width: 0;+ font-family: $font-mono;+ font-size: $font-size-sm;+ gap: 1px;++ .crumb-segment { display: inline-flex; align-items: center; }+ .crumb-separator { color: $text-tertiary; margin: 0 2px; opacity: 0.5; }+ .crumb {+ background: transparent;+ border: none;+ padding: 4px $space-2;+ border-radius: $radius-sm;+ color: $text-secondary;+ cursor: pointer;+ font: inherit;+ @include transition(all);++ &:hover { background: $bg-hover; color: $text-primary; }+ &.crumb-active { color: $text-primary; font-weight: $font-weight-medium; }+ }+ .crumb-pin {+ background: transparent;+ border: none;+ padding: 4px;+ margin-left: $space-1;+ color: $text-tertiary;+ cursor: pointer;+ border-radius: $radius-sm;display: flex;align-items: center;- gap: $space-3;- flex-wrap: wrap;+ justify-content: center;+ @include transition(all);- .search-box {- display: flex;- align-items: center;- gap: $space-2;- background: $bg-tertiary;- border-radius: $radius-md;- padding: 0 $space-2;- position: relative;-- .search-icon {- color: $text-tertiary;- flex-shrink: 0;- }+ &:hover { background: $bg-hover; color: $color-star; }+ &.pinned { color: $color-star; }+ }+ }- input {- background: transparent;- border: none;- padding: $space-2 $space-3;- font-size: $font-size-sm;- width: 180px;- color: $text-primary;+ // ─── Search field ───────────────────────────────────+ .search-field {+ position: relative;+ display: flex;+ align-items: center;+ background: $bg-tertiary;+ border: 1px solid transparent;+ border-radius: $radius-md;+ min-width: 220px;+ @include transition(all);- &::placeholder {- color: $text-tertiary;- }+ &:focus-within {+ border-color: $accent-primary;+ background: $bg-body;+ }- &:focus {- outline: none;- }- }+ .search-field-icon {+ position: absolute;+ left: $space-3;+ color: $text-tertiary;+ pointer-events: none;+ }++ input {+ background: transparent;+ border: none;+ padding: 7px $space-3 7px 32px;+ font-size: $font-size-sm;+ color: $text-primary;+ width: 100%;++ &::placeholder { color: $text-tertiary; }+ &:focus { outline: none; }+ }++ .search-field-clear {+ position: absolute;+ right: 6px;+ background: transparent;+ border: none;+ padding: 4px;+ color: $text-tertiary;+ cursor: pointer;+ border-radius: $radius-sm;+ display: flex;+ align-items: center;+ justify-content: center;++ &:hover { background: $bg-hover; color: $text-primary; }+ }+ }++ // ─── Sort popover ───────────────────────────────────+ .sort-control { position: relative; }++ .sort-popover {+ position: absolute;+ top: calc(100% + 6px);+ right: 0;+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-md;+ box-shadow: $shadow-lg;+ min-width: 160px;+ padding: 4px;+ z-index: $z-dropdown;++ .sort-popover-label {+ padding: 6px $space-3 4px;+ font-size: $font-size-xs;+ color: $text-tertiary;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ font-weight: $font-weight-semibold;+ }+ .sort-popover-divider { height: 1px; background: $border-default; margin: 4px 0; }+ .sort-popover-item {+ display: flex;+ align-items: center;+ gap: $space-2;+ width: 100%;+ padding: 6px $space-3;+ background: transparent;+ border: none;+ border-radius: $radius-sm;+ color: $text-primary;+ font-size: $font-size-sm;+ text-align: left;+ cursor: pointer;+ @include transition(background);++ &:hover { background: $bg-hover; }+ &.active { color: $accent-primary; }+ svg { color: $accent-primary; }+ > span { flex: 1; }+ }+ }++ // ─── Toolbar chip / icon button ─────────────────────+ .toolbar-chip {+ display: inline-flex;+ align-items: center;+ gap: $space-2;+ padding: 6px $space-3;+ background: $bg-tertiary;+ border: 1px solid transparent;+ border-radius: $radius-md;+ color: $text-secondary;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;+ cursor: pointer;+ white-space: nowrap;+ @include transition(all);++ &:hover:not(:disabled) { background: $bg-hover; color: $text-primary; }+ &.active {+ background: $accent-glow;+ border-color: fade($accent-primary-raw, 30%);+ color: $accent-primary;+ }+ &:disabled { opacity: 0.5; cursor: not-allowed; }+ svg { flex-shrink: 0; }+ }++ .toolbar-icon-btn {+ background: transparent;+ border: none;+ padding: 7px;+ border-radius: $radius-md;+ color: $text-secondary;+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ @include transition(all);++ &:hover:not(:disabled) { background: $bg-hover; color: $text-primary; }+ &.small { padding: 4px; }+ }++ // ─── View toggles ───────────────────────────────────+ .view-toggle {+ display: flex;+ gap: 2px;+ padding: 2px;+ background: $bg-tertiary;+ border-radius: $radius-md;++ .view-toggle-btn {+ background: transparent;+ border: none;+ padding: 6px 9px;+ border-radius: $radius-sm;+ color: $text-tertiary;+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ @include transition(all);++ &:hover { color: $text-primary; }+ &.active {+ background: $bg-card;+ color: $accent-primary;+ box-shadow: $shadow-sm;}+ }+ }- .checkbox-label {- display: flex;- align-items: center;- gap: $space-2;- font-size: $font-size-sm;- color: $text-secondary;- cursor: pointer;+ // ─── Filter chips row ───────────────────────────────+ .filter-chips-row {+ display: flex;+ gap: $space-2;+ padding: $space-2 0;+ overflow-x: auto;+ scrollbar-width: thin;- input[type="checkbox"] {- width: 16px;- height: 16px;- }+ &::-webkit-scrollbar { height: 4px; }+ &::-webkit-scrollbar-thumb { background: $border-default; border-radius: $radius-sm; }+ }- svg {- color: $text-tertiary;- }+ .filter-chip {+ display: inline-flex;+ align-items: center;+ gap: $space-2;+ padding: 5px 10px 5px 9px;+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-full;+ color: $text-secondary;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;+ cursor: pointer;+ white-space: nowrap;+ @include transition(all);++ &:hover:not(:disabled) {+ background: $bg-hover;+ color: $text-primary;+ border-color: $border-active;+ }+ &.active {+ background: $accent-primary;+ border-color: $accent-primary;+ color: white;++ .filter-chip-count {+ background: rgba(255, 255, 255, 0.2);+ color: white;}}+ &:disabled { opacity: 0.4; cursor: not-allowed; }+ svg { flex-shrink: 0; }+ }++ .filter-chip-count {+ display: inline-block;+ min-width: 18px;+ padding: 0 5px;+ background: $bg-tertiary;+ border-radius: $radius-full;+ font-size: 10px;+ font-weight: $font-weight-semibold;+ text-align: center;+ line-height: 16px;+ color: $text-tertiary;}- // Main layout with sidebar- .file-manager-layout {+ // ─── Bulk action bar ────────────────────────────────+ .bulk-bar {display: flex;- gap: $space-4;- min-height: 0;+ justify-content: space-between;+ align-items: center;+ padding: $space-2 $space-3 $space-2 $space-4;+ background: linear-gradient(135deg, fade($accent-primary-raw, 12%), fade($accent-primary-raw, 6%));+ border: 1px solid fade($accent-primary-raw, 35%);+ border-radius: $radius-lg;+ animation: slide-down 0.2s ease;}- .file-manager-main {- flex: 1;- min-width: 0;+ @keyframes slide-down {+ from { transform: translateY(-6px); opacity: 0; }+ to { transform: translateY(0); opacity: 1; }}- .file-manager-content {+ .bulk-bar-info {+ display: flex;+ align-items: center;+ gap: $space-2;+ color: $accent-primary;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;++ svg {+ background: $accent-primary;+ color: white;+ padding: 2px;+ border-radius: $radius-full;+ box-sizing: content-box;+ }+ }++ .bulk-bar-actions { display: flex; gap: $space-1; }++ .bulk-btn {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 6px $space-3;+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-md;+ color: $text-primary;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;+ cursor: pointer;+ @include transition(all);++ &:hover { background: $bg-hover; border-color: $border-hover; }+ &.danger {+ color: $danger;+ border-color: transparent;+ &:hover { background: $danger-bg; border-color: $danger-border; }+ }+ &.ghost {+ background: transparent;+ border-color: transparent;+ color: $text-secondary;+ &:hover { background: $bg-hover; color: $text-primary; }+ }+ }++ // ─── Body layout: left sidebar + main ──────────────+ .file-manager-body {display: grid;- grid-template-columns: 1fr 400px;- gap: $space-4;+ grid-template-columns: 280px 1fr;+ gap: $space-3;+ min-height: 0;+ align-items: start;- @media (max-width: $breakpoint-xl) {+ @media (max-width: $breakpoint-lg) {grid-template-columns: 1fr;}}- // Sidebar- .file-manager-sidebar {- width: 320px;- flex-shrink: 0;+ &:not(.sidebar-open) .file-manager-body {+ grid-template-columns: 1fr;+ }++ .file-manager-main {+ min-width: 0;+ min-height: 0;+ }++ // ─── Left sidebar ──────────────────────────────────+ .file-manager-sidebar.left {display: flex;flex-direction: column;- gap: $space-4;+ gap: $space-3;+ max-height: calc(100vh - 200px);overflow-y: auto;- max-height: calc(100vh - 120px);- @include transition(all);+ position: sticky;+ top: $space-4;+ scrollbar-width: thin;++ &::-webkit-scrollbar { width: 4px; }+ &::-webkit-scrollbar-thumb { background: $border-default; border-radius: $radius-sm; }@media (max-width: $breakpoint-lg) {position: fixed;- right: 0;+ left: 0;top: 64px;bottom: 0;width: 100%;- max-width: 360px;+ max-width: 320px;max-height: none;background: $bg-body;padding: $space-4;z-index: $z-modal;- box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);+ box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);}}- &:not(.sidebar-open) .file-manager-sidebar {- @media (max-width: $breakpoint-lg) {- transform: translateX(100%);- }+ &:not(.sidebar-open) .file-manager-sidebar.left {+ @media (max-width: $breakpoint-lg) { transform: translateX(-100%); }}.sidebar-section {background: $bg-card;+ border: 1px solid $border-default;border-radius: $radius-lg;overflow: hidden;-- &:last-child {- max-height: none;- }}.sidebar-section-header {@@ -230,32 +596,163 @@font-weight: $font-weight-medium;@include transition(background);- &:hover {- background: $bg-tertiary;- }+ &:hover { background: $bg-tertiary; }+ &.static { cursor: default; &:hover { background: $bg-elevated; } }- &.static {- cursor: default;+ > svg:first-child { color: $accent-primary; }+ span { flex: 1; }+ }- &:hover {- background: $bg-elevated;- }+ .sidebar-section-content { padding: $space-3 $space-4; }+ .tree-content { padding: $space-2; }++ // ─── Folder tree ────────────────────────────────────+ .folder-tree {+ display: flex;+ flex-direction: column;+ font-size: $font-size-sm;+ }++ .tree-node {+ display: flex;+ flex-direction: column;+ }++ .tree-row {+ display: flex;+ align-items: center;+ gap: 4px;+ padding: 4px 6px;+ border-radius: $radius-sm;+ cursor: pointer;+ color: $text-primary;+ @include transition(background);+ user-select: none;++ &:hover { background: $bg-hover; }++ &.active {+ background: $accent-glow;++ .tree-name { color: $accent-primary; font-weight: $font-weight-medium; }+ .tree-folder-icon { color: $accent-primary; }}+ }- span {- flex: 1;+ .tree-chevron {+ background: transparent;+ border: none;+ padding: 0;+ width: 14px;+ height: 14px;+ display: flex;+ align-items: center;+ justify-content: center;+ color: $text-tertiary;+ cursor: pointer;+ flex-shrink: 0;+ border-radius: $radius-sm;++ &:hover { background: $bg-tertiary; color: $text-primary; }+ }++ .tree-chevron-spinner {+ display: flex;+ align-items: center;+ justify-content: center;+ transform: scale(0.5);+ transform-origin: center;+ }++ .tree-folder-icon {+ color: $ft-folder;+ flex-shrink: 0;++ &.open { color: $ft-folder; }+ }++ .tree-name {+ flex: 1;+ @include truncate();+ font-size: $font-size-sm;+ }++ .tree-children {+ display: flex;+ flex-direction: column;+ }++ .tree-empty {+ padding: 4px 6px;+ font-size: $font-size-xs;+ color: $text-tertiary;+ font-style: italic;+ }++ // ─── Quick Access list ──────────────────────────────+ .quick-access-list {+ display: flex;+ flex-direction: column;+ gap: 2px;+ padding: $space-2;+ }++ .quick-access-item {+ display: flex;+ align-items: center;+ gap: $space-2;+ padding: $space-2;+ border-radius: $radius-md;+ cursor: pointer;+ @include transition(background);++ &:hover {+ background: $bg-hover;+ .quick-access-remove { opacity: 1; }}- .close-btn {- margin-left: auto;+ &.active {+ background: $accent-glow;+ > svg { color: $accent-primary; }+ .quick-access-name { color: $accent-primary; }}++ > svg { color: $ft-folder; flex-shrink: 0; }}- .sidebar-section-content {- padding: $space-3 $space-4;+ .quick-access-text { flex: 1; min-width: 0; overflow: hidden; }+ .quick-access-name {+ font-size: $font-size-sm;+ color: $text-primary;+ font-weight: $font-weight-medium;+ @include truncate();+ }+ .quick-access-path {+ font-size: $font-size-xs;+ color: $text-tertiary;+ font-family: $font-mono;+ @include truncate();+ }+ .quick-access-remove {+ background: transparent;+ border: none;+ padding: 4px;+ border-radius: $radius-sm;+ color: $text-tertiary;+ cursor: pointer;+ opacity: 0;+ @include transition(all);+ &:hover { background: $bg-tertiary; color: $danger; }+ }+ .quick-access-empty {+ padding: $space-4;+ text-align: center;+ color: $text-tertiary;+ font-size: $font-size-xs;+ line-height: 1.5;}- // Disk usage section+ // ─── Disk usage ─────────────────────────────────────.disk-header-row {display: flex;justify-content: space-between;@@ -275,14 +772,8 @@padding: $space-3 0;border-bottom: 1px solid $border-subtle;- &:last-child {- border-bottom: none;- padding-bottom: 0;- }-- &:first-child {- padding-top: 0;- }+ &:last-child { border-bottom: none; padding-bottom: 0; }+ &:first-child { padding-top: 0; }}.disk-mount-header {@@ -301,7 +792,6 @@.disk-percent {font-size: $font-size-sm;font-weight: $font-weight-medium;-&.healthy { color: $success; }&.warning { color: $warning; }&.critical { color: $danger; }@@ -314,11 +804,7 @@overflow: hidden;margin-bottom: $space-2;- .disk-progress-fill {- height: 100%;- @include transition(width);- }-+ .disk-progress-fill { height: 100%; @include transition(width); }&.healthy .disk-progress-fill { background: $success; }&.warning .disk-progress-fill { background: $warning; }&.critical .disk-progress-fill { background: $danger; }@@ -331,11 +817,9 @@color: $text-tertiary;}- .disk-device {- font-family: $font-mono;- }+ .disk-device { font-family: $font-mono; }- // Analysis section+ // ─── Analysis ───────────────────────────────────────.analysis-loading {display: flex;align-items: center;@@ -374,10 +858,7 @@cursor: pointer;@include transition(all);- &:hover {- background: $bg-hover;- }-+ &:hover { background: $bg-hover; }&.active {background: $accent-glow;border-color: fade($accent-primary-raw, 30%);@@ -385,21 +866,14 @@}}- .analysis-bars {- display: flex;- flex-direction: column;- gap: $space-2;- }+ .analysis-bars { display: flex; flex-direction: column; gap: $space-2; }.analysis-bar-item {cursor: pointer;padding: $space-2;border-radius: $radius-md;@include transition(background);-- &:hover {- background: $bg-hover;- }+ &:hover { background: $bg-hover; }}.analysis-bar-header {@@ -416,11 +890,7 @@font-size: $font-size-xs;color: $text-primary;@include truncate();-- svg {- color: $warning;- flex-shrink: 0;- }+ svg { color: $ft-folder; flex-shrink: 0; }}.analysis-bar-size {@@ -442,11 +912,7 @@@include transition(width);}- .analysis-files {- display: flex;- flex-direction: column;- gap: $space-1;- }+ .analysis-files { display: flex; flex-direction: column; gap: $space-1; }.analysis-file-item {display: flex;@@ -456,15 +922,8 @@border-radius: $radius-md;cursor: pointer;@include transition(background);-- &:hover {- background: $bg-hover;- }-- svg {- color: $text-tertiary;- flex-shrink: 0;- }+ &:hover { background: $bg-hover; }+ svg { color: $text-tertiary; flex-shrink: 0; }}.analysis-file-name {@@ -487,108 +946,360 @@font-size: $font-size-sm;}- // Type breakdown chart- .type-breakdown-chart {- margin-bottom: $space-3;+ .type-breakdown-chart { margin-bottom: $space-3; }+ .type-breakdown-legend { display: flex; flex-direction: column; gap: $space-2; }+ .type-legend-item { display: flex; align-items: center; gap: $space-2; }+ .type-legend-color { width: 10px; height: 10px; border-radius: $radius-sm; flex-shrink: 0; }+ .type-legend-name { flex: 1; font-size: $font-size-xs; color: $text-primary; }+ .type-legend-size { font-size: $font-size-xs; color: $text-tertiary; font-family: $font-mono; }++ // ─── File area container ────────────────────────────+ .file-list-container {+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-lg;+ overflow: hidden;+ position: relative;+ min-height: 540px;}- .type-breakdown-legend {+ .loading-state, .empty-state {display: flex;flex-direction: column;- gap: $space-2;+ align-items: center;+ justify-content: center;+ padding: $space-12;+ color: $text-tertiary;+ text-align: center;+ min-height: 400px;++ svg { margin-bottom: $space-4; opacity: 0.6; }+ h3 {+ font-size: $font-size-lg;+ font-weight: $font-weight-semibold;+ color: $text-primary;+ margin: 0 0 $space-2;+ }+ p {+ margin: 0;+ color: $text-secondary;+ max-width: 360px;+ font-size: $font-size-sm;+ line-height: 1.5;+ }}- .type-legend-item {+ // ─── Drag overlay ───────────────────────────────────+ .drag-overlay {+ position: absolute;+ inset: 0;+ background: fade($accent-primary-raw, 12%);+ backdrop-filter: blur(6px);+ z-index: 10;display: flex;align-items: center;- gap: $space-2;+ justify-content: center;+ pointer-events: none;+ border: 2px dashed $accent-primary;+ border-radius: $radius-lg;++ .drag-overlay-inner {+ text-align: center;++ svg { color: $accent-primary; margin-bottom: $space-3; }+ h3 {+ margin: 0 0 $space-2;+ font-size: $font-size-xl;+ font-weight: $font-weight-semibold;+ color: $text-primary;+ }+ p {+ margin: 0;+ color: $text-secondary;+ font-size: $font-size-sm;++ code {+ background: $bg-tertiary;+ padding: 2px $space-2;+ border-radius: $radius-sm;+ font-family: $font-mono;+ color: $accent-primary;+ }+ }+ }}- .type-legend-color {- width: 10px;- height: 10px;- border-radius: $radius-sm;- flex-shrink: 0;+ // ─── GRID VIEW ──────────────────────────────────────+ .file-grid {+ display: grid;+ gap: $space-3;+ padding: $space-4;+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));}- .type-legend-name {- flex: 1;- font-size: $font-size-xs;- color: $text-primary;+ &.grid-sm .file-grid {+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));+ gap: $space-2;++ .file-card { padding: $space-3 $space-2; }+ .file-card-thumb { width: 56px; height: 56px; margin-bottom: $space-2; }+ .file-card-thumb > svg { width: 32px; height: 32px; }}+ &.grid-lg .file-grid {+ grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));+ gap: $space-4;- .type-legend-size {- font-size: $font-size-xs;- color: $text-tertiary;- font-family: $font-mono;+ .file-card { padding: $space-5 $space-4 $space-4; }+ .file-card-thumb { width: 110px; height: 110px; margin-bottom: $space-3; }+ .file-card-thumb > svg { width: 64px; height: 64px; }}- // File list- .file-list-container {- background: $bg-card;+ .file-card {+ position: relative;+ display: flex;+ flex-direction: column;+ align-items: center;+ padding: $space-4 $space-3 $space-3;+ background: $bg-elevated;+ border: 1px solid transparent;border-radius: $radius-lg;+ cursor: pointer;+ @include transition(all);+ user-select: none;++ // type-tinted top accent bar+ &::before {+ content: '';+ position: absolute;+ top: 0; left: 0; right: 0;+ height: 2px;+ border-radius: $radius-lg $radius-lg 0 0;+ opacity: 0;+ @include transition(opacity);+ }++ &.type-folder::before { background: $ft-folder; }+ &.type-code::before { background: $ft-code; }+ &.type-image::before { background: $ft-image; }+ &.type-video::before { background: $ft-video; }+ &.type-audio::before { background: $ft-audio; }+ &.type-archive::before { background: $ft-archive; }+ &.type-data::before { background: $ft-data; }+ &.type-text::before { background: $ft-text; }+ &.type-terminal::before { background: $ft-terminal; }+ &.type-default::before { background: $ft-default; }++ &:hover {+ background: $bg-hover;+ border-color: $border-active;+ transform: translateY(-2px);+ box-shadow: $shadow-md;++ &::before { opacity: 1; }+ .file-card-check { opacity: 1; }+ .ext-badge { opacity: 1; }+ }++ &.selected {+ background: $accent-glow;+ border-color: fade($accent-primary-raw, 50%);+ box-shadow: 0 0 0 1px fade($accent-primary-raw, 25%);++ &::before { opacity: 1; }+ .file-card-check { opacity: 1; }+ }++ // Persistent checkboxes when in select mode+ &.select-mode .file-card-check { opacity: 1; }+ }++ // Subtle type-color glow background on the thumb+ .file-card.type-folder .file-card-thumb { background: fade($ft-folder, 12%); }+ .file-card.type-code .file-card-thumb { background: fade($ft-code, 12%); }+ .file-card.type-image .file-card-thumb { background: fade($ft-image, 12%); }+ .file-card.type-video .file-card-thumb { background: fade($ft-video, 12%); }+ .file-card.type-audio .file-card-thumb { background: fade($ft-audio, 12%); }+ .file-card.type-archive .file-card-thumb { background: fade($ft-archive, 12%); }+ .file-card.type-data .file-card-thumb { background: fade($ft-data, 12%); }+ .file-card.type-text .file-card-thumb { background: fade($ft-text, 12%); }+ .file-card.type-terminal .file-card-thumb { background: fade($ft-terminal, 12%); }+ .file-card.type-default .file-card-thumb { background: fade($ft-default, 12%); }++ .file-card-thumb {+ position: relative;+ width: 88px;+ height: 88px;+ display: flex;+ align-items: center;+ justify-content: center;+ margin-bottom: $space-3;+ border-radius: $radius-md;overflow: hidden;+ @include transition(all);++ > svg { width: 50px; height: 50px; }++ .thumb-image {+ width: 100%;+ height: 100%;+ object-fit: cover;+ display: block;+ }- .loading-state,- .empty-state {+ .link-badge {+ position: absolute;+ bottom: 2px;+ right: 2px;+ width: 18px;+ height: 18px;+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-full;display: flex;- flex-direction: column;align-items: center;justify-content: center;- padding: $space-12;+ font-size: 10px;color: $text-tertiary;+ }+ }++ .ext-badge {+ position: absolute;+ bottom: 4px;+ left: 4px;+ padding: 1px 5px;+ background: rgba(0, 0, 0, 0.6);+ backdrop-filter: blur(2px);+ border-radius: $radius-sm;+ font-family: $font-mono;+ font-size: 9px;+ font-weight: $font-weight-bold;+ color: white;+ letter-spacing: 0.04em;+ opacity: 0;+ @include transition(opacity);+ }++ .file-card-body {+ width: 100%;+ text-align: center;+ min-width: 0;+ }++ .file-card-name {+ font-size: $font-size-sm;+ color: $text-primary;+ font-weight: $font-weight-medium;+ @include truncate();+ margin-bottom: 2px;+ }++ .file-card-meta {+ font-size: $font-size-xs;+ color: $text-tertiary;+ font-family: $font-mono;+ }- svg {- margin-bottom: $space-4;- }+ .file-card-check {+ position: absolute;+ top: $space-2;+ left: $space-2;+ background: transparent;+ border: none;+ padding: 4px;+ cursor: pointer;+ opacity: 0;+ @include transition(opacity);+ z-index: 2;+ }- p {- margin: 0;- }+ // ─── Checkbox primitive ─────────────────────────────+ .checkbox {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ width: 18px;+ height: 18px;+ background: $bg-card;+ border: 1.5px solid $border-active;+ border-radius: $radius-sm;+ color: white;+ @include transition(all);++ &.checked {+ background: $accent-primary;+ border-color: $accent-primary;}}+ .checkbox-btn {+ background: transparent;+ border: none;+ padding: 4px;+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ }+ // ─── LIST VIEW ──────────────────────────────────────.file-list {.file-list-header {display: grid;- grid-template-columns: 1fr 100px 120px 120px 120px;- padding: $space-3 $space-4;- background: $bg-tertiary;+ grid-template-columns: 36px 1fr 110px 130px 130px 140px;+ padding: $space-2 $space-4;+ background: $bg-elevated;font-size: $font-size-xs;font-weight: $font-weight-semibold;text-transform: uppercase;color: $text-tertiary;border-bottom: 1px solid $border-default;+ letter-spacing: 0.04em;++ .col-actions { text-align: right; }+ .col-check { display: flex; align-items: center; justify-content: center; }}.file-item {display: grid;- grid-template-columns: 1fr 100px 120px 120px 120px;+ grid-template-columns: 36px 1fr 110px 130px 130px 140px;padding: $space-3 $space-4;- border-bottom: 1px solid $border-default;+ border-bottom: 1px solid $border-subtle;cursor: pointer;+ align-items: center;+ user-select: none;@include transition(background);+ &:last-child { border-bottom: none; }+&:hover {background: $bg-hover;+ .col-actions .row-action { opacity: 1; }+ .col-check .checkbox { border-color: $border-hover; }}- &.selected {- background: $accent-glow;+ &.selected { background: $accent-glow; }++ .col-check {+ display: flex;+ align-items: center;+ justify-content: center;}.col-name {display: flex;align-items: center;- gap: $space-2;+ gap: $space-3;overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;+ min-width: 0;- .link-indicator {- color: $text-tertiary;+ .file-item-name {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ color: $text-primary;font-size: $font-size-sm;}+ .link-indicator { color: $text-tertiary; font-size: $font-size-xs; }}.col-size,@@ -597,124 +1308,159 @@font-size: $font-size-sm;color: $text-secondary;}-.col-permissions {font-family: $font-mono;font-size: $font-size-xs;+ color: $text-tertiary;}-.col-actions {display: flex;- gap: $space-1;+ gap: 2px;justify-content: flex-end;-- .btn-icon {- opacity: 0;- @include transition(opacity);- }- }-- &:hover .col-actions .btn-icon {- opacity: 1;}}}- // File icons+ .row-action {+ background: transparent;+ border: none;+ padding: 6px;+ border-radius: $radius-sm;+ color: $text-tertiary;+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ opacity: 0;+ @include transition(all);++ &:hover { background: $bg-tertiary; color: $text-primary; }+ &.danger:hover { background: $danger-bg; color: $danger; }+ }++ // ─── File icons ─────────────────────────────────────.file-icon-svg {flex-shrink: 0;- color: $text-tertiary;- &.folder { color: $warning; }- &.code { color: #8b5cf6; }- &.image { color: $success; }- &.video { color: #ec4899; }- &.audio { color: $warning; }- &.archive { color: $danger; }- &.data { color: #14b8a6; }- &.text { color: $text-secondary; }- &.terminal { color: $success; }+ &.folder { color: $ft-folder; }+ &.code { color: $ft-code; }+ &.image { color: $ft-image; }+ &.video { color: $ft-video; }+ &.audio { color: $ft-audio; }+ &.archive { color: $ft-archive; }+ &.data { color: $ft-data; }+ &.text { color: $ft-text; }+ &.terminal { color: $ft-terminal; }+ &.default { color: $ft-default; }}- // File preview- .file-preview {- background: $bg-card;- border-radius: $radius-lg;+ // ─── Status bar ─────────────────────────────────────+ .status-bar {display: flex;- flex-direction: column;- max-height: calc(100vh - 300px);+ justify-content: space-between;+ align-items: center;+ padding: $space-2 $space-3;+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-md;+ font-size: $font-size-xs;+ color: $text-tertiary;+ flex-wrap: wrap;+ gap: $space-3;- .preview-header {+ .status-bar-left, .status-bar-right {display: flex;- justify-content: space-between;align-items: center;- padding: $space-4;- border-bottom: 1px solid $border-default;+ gap: $space-2;+ flex-wrap: wrap;+ }- h3 {- margin: 0;- font-size: $font-size-base;- font-weight: $font-weight-semibold;- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- }+ .status-item {+ display: inline-flex;+ align-items: center;+ gap: $space-1;+ svg { color: $text-tertiary; }+ }- .preview-actions {- display: flex;- gap: $space-2;- }+ .status-label {+ color: $text-tertiary;+ text-transform: uppercase;+ letter-spacing: 0.04em;+ font-weight: $font-weight-semibold;+ font-size: 9px;}- .preview-info {- display: flex;- gap: $space-4;- padding: $space-3 $space-4;- background: $bg-tertiary;- font-size: $font-size-xs;+ .status-value {color: $text-secondary;- flex-wrap: wrap;+ font-family: $font-mono;}- .file-editor {- flex: 1;- padding: $space-4;- font-family: $font-mono;- font-size: $font-size-sm;- line-height: $line-height-relaxed;- background: $bg-body;- border: none;- resize: none;- color: $text-primary;+ .status-divider {+ width: 1px;+ height: 12px;+ background: $border-default;+ }- &:focus {- outline: none;- }+ .status-selection {+ color: $accent-primary;+ font-weight: $font-weight-medium;+ }- &[readonly] {- background: $bg-tertiary;- }+ .status-shortcuts {+ font-family: $font-mono;+ color: $text-tertiary;+ opacity: 0.7;+ display: none;+ @media (min-width: $breakpoint-lg) { display: inline; }}+ }- .preview-unavailable {- flex: 1;+ // ─── Context menu ───────────────────────────────────+ .context-menu {+ position: fixed;+ background: $bg-card;+ border: 1px solid $border-default;+ border-radius: $radius-md;+ box-shadow: $shadow-lg;+ min-width: 200px;+ padding: 4px;+ z-index: $z-tooltip;+ animation: ctx-pop 0.12s ease-out;++ button {display: flex;- flex-direction: column;align-items: center;- justify-content: center;- padding: $space-12;- color: $text-tertiary;-- svg {- margin-bottom: $space-4;- }+ gap: $space-2;+ width: 100%;+ padding: $space-2 $space-3;+ background: transparent;+ border: none;+ border-radius: $radius-sm;+ color: $text-primary;+ font-size: $font-size-sm;+ text-align: left;+ cursor: pointer;+ @include transition(background);- p {- margin-bottom: $space-4;- }+ &:hover { background: $bg-hover; }+ &.danger { color: $danger; }+ &.danger:hover { background: $danger-bg; }+ svg { flex-shrink: 0; opacity: 0.85; }}}+ .context-menu-divider {+ height: 1px;+ background: $border-default;+ margin: 4px 0;+ }++ @keyframes ctx-pop {+ from { transform: scale(0.95); opacity: 0; }+ to { transform: scale(1); opacity: 1; }+ }++ // ─── Permissions help ───────────────────────────────.permissions-help {margin-top: $space-4;padding: $space-3;@@ -722,75 +1468,300 @@border-radius: $radius-md;font-size: $font-size-sm;- p {- margin: 0 0 $space-2 0;- font-weight: $font-weight-medium;- }-+ p { margin: 0 0 $space-2 0; font-weight: $font-weight-medium; }ul {margin: 0;padding-left: $space-5;+ li { margin-bottom: $space-1; }+ code { background: $bg-body; padding: 2px $space-2; border-radius: $radius-sm; }+ }+ }- li {- margin-bottom: $space-1;- }+ // ─── Misc ───────────────────────────────────────────+ .spinning { animation: spin 1s linear infinite; }+ @keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }+}- code {- background: $bg-body;- padding: 2px $space-2;- border-radius: $radius-sm;- }+// ============================================+// PREVIEW DRAWER (slide-in from right)+// ============================================+$drawer-width: 520px;++.preview-drawer-backdrop {+ position: fixed;+ inset: 0;+ background: rgba(0, 0, 0, 0.45);+ backdrop-filter: blur(2px);+ z-index: $z-modal-backdrop;+ animation: drawer-fade 0.2s ease;+}++.preview-drawer {+ position: fixed;+ top: 0;+ right: 0;+ bottom: 0;+ width: $drawer-width;+ max-width: 100%;+ background: $bg-card;+ border-left: 1px solid $border-default;+ box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);+ z-index: $z-modal;+ display: flex;+ flex-direction: column;+ animation: drawer-slide 0.25s cubic-bezier(0.32, 0.72, 0.24, 1);++ @media (max-width: $breakpoint-sm) {+ width: 100%;+ }+}++@keyframes drawer-fade {+ from { opacity: 0; }+ to { opacity: 1; }+}+@keyframes drawer-slide {+ from { transform: translateX(100%); }+ to { transform: translateX(0); }+}++.preview-drawer-header {+ display: flex;+ align-items: center;+ gap: $space-3;+ padding: $space-4;+ border-bottom: 1px solid $border-default;+ background: $bg-elevated;++ > svg { flex-shrink: 0; }++ .preview-drawer-title {+ flex: 1;+ min-width: 0;++ h3 {+ margin: 0 0 2px;+ font-size: $font-size-base;+ font-weight: $font-weight-semibold;+ color: $text-primary;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ .preview-drawer-path {+ margin: 0;+ font-family: $font-mono;+ font-size: $font-size-xs;+ color: $text-tertiary;+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ }+ }++ .preview-drawer-close {+ background: transparent;+ border: none;+ padding: 6px;+ border-radius: $radius-sm;+ color: $text-secondary;+ cursor: pointer;+ display: flex;+ align-items: center;+ justify-content: center;+ @include transition(all);++ &:hover { background: $bg-hover; color: $text-primary; }+ }+}++.preview-drawer-meta {+ display: grid;+ grid-template-columns: 1fr 1fr;+ gap: $space-3;+ padding: $space-3 $space-4;+ background: $bg-elevated;+ border-bottom: 1px solid $border-default;++ .meta-item {+ display: flex;+ flex-direction: column;+ gap: 2px;+ min-width: 0;++ &.meta-item-wide { grid-column: span 2; }+ }++ .meta-label {+ font-size: 9px;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ font-weight: $font-weight-semibold;+ color: $text-tertiary;+ }++ .meta-value {+ font-size: $font-size-sm;+ color: $text-primary;+ @include truncate();++ &.mono { font-family: $font-mono; font-size: $font-size-xs; }+ }+}++.preview-drawer-actions {+ display: flex;+ flex-wrap: wrap;+ gap: $space-1;+ padding: $space-3 $space-4;+ border-bottom: 1px solid $border-default;+}++.drawer-action-btn {+ display: inline-flex;+ align-items: center;+ gap: 6px;+ padding: 6px $space-3;+ background: $bg-elevated;+ border: 1px solid $border-default;+ border-radius: $radius-md;+ color: $text-primary;+ font-size: $font-size-xs;+ font-weight: $font-weight-medium;+ cursor: pointer;+ @include transition(all);++ &:hover { background: $bg-hover; border-color: $border-hover; }+ &.danger {+ color: $danger;+ border-color: transparent;+ &:hover { background: $danger-bg; border-color: $danger-border; }+ }+ svg { flex-shrink: 0; opacity: 0.8; }+}++.preview-drawer-body {+ flex: 1;+ overflow: hidden;+ display: flex;+ flex-direction: column;+ min-height: 0;++ .preview-image-wrap {+ flex: 1;+ display: flex;+ align-items: center;+ justify-content: center;+ background:+ linear-gradient(45deg, $bg-tertiary 25%, transparent 25%),+ linear-gradient(-45deg, $bg-tertiary 25%, transparent 25%),+ linear-gradient(45deg, transparent 75%, $bg-tertiary 75%),+ linear-gradient(-45deg, transparent 75%, $bg-tertiary 75%);+ background-size: 16px 16px;+ background-position: 0 0, 0 8px, 8px -8px, -8px 0;+ background-color: $bg-body;+ padding: $space-4;+ overflow: auto;++ img {+ max-width: 100%;+ max-height: 100%;+ border-radius: $radius-md;+ box-shadow: $shadow-lg;+ }+ }++ .editor-wrap {+ flex: 1;+ display: flex;+ flex-direction: column;+ min-height: 0;+ }++ .editor-toolbar {+ display: flex;+ justify-content: space-between;+ align-items: center;+ padding: $space-2 $space-4;+ background: $bg-elevated;+ border-bottom: 1px solid $border-default;++ .editor-status {+ font-size: $font-size-xs;+ color: $text-tertiary;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ font-weight: $font-weight-semibold;}++ .editor-buttons { display: flex; gap: $space-2; }}- // Spinning animation for refresh- .spinning {- animation: spin 1s linear infinite;+ .file-editor {+ flex: 1;+ padding: $space-4;+ font-family: $font-mono;+ font-size: $font-size-sm;+ line-height: $line-height-relaxed;+ background: $bg-body;+ border: none;+ resize: none;+ color: $text-primary;+ min-height: 280px;++ &:focus { outline: none; }+ &[readonly] { background: $bg-body; }}- @keyframes spin {- from { transform: rotate(0deg); }- to { transform: rotate(360deg); }+ .preview-unavailable {+ flex: 1;+ display: flex;+ flex-direction: column;+ align-items: center;+ justify-content: center;+ padding: $space-12;+ color: $text-tertiary;+ text-align: center;++ svg { margin-bottom: $space-4; opacity: 0.6; }+ p { margin-bottom: $space-4; color: $text-secondary; }}}-// Responsive adjustments+// ─── Responsive ─────────────────────────────────────────@media (max-width: $breakpoint-md) {.file-manager {.page-header {flex-direction: column;align-items: stretch;-- .page-header-actions {- justify-content: flex-end;- }+ .page-header-actions { justify-content: flex-end; }}.file-manager-toolbar {flex-direction: column;align-items: stretch;-- .path-breadcrumb {- order: 1;- }-- .toolbar-actions {- order: 2;- justify-content: space-between;- }+ .toolbar-left, .toolbar-right { justify-content: space-between; }+ .search-field { flex: 1; min-width: 0; }}.file-list {.file-list-header,.file-item {- grid-template-columns: 1fr 80px 100px;-- .col-permissions,- .col-modified {- display: none;- }+ grid-template-columns: 36px 1fr 90px 110px;+ .col-permissions, .col-modified { display: none; }}}++ .file-grid {+ grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;+ }++ .bulk-bar {+ flex-direction: column;+ align-items: stretch;+ gap: $space-2;+ .bulk-bar-actions { justify-content: flex-end; flex-wrap: wrap; }+ }}}@@ -799,16 +1770,10 @@.file-list {.file-list-header,.file-item {- grid-template-columns: 1fr 80px;-- .col-size {- display: none;- }+ grid-template-columns: 36px 1fr 80px;+ .col-size { display: none; }}}-- .file-manager-content {- grid-template-columns: 1fr !important;- }+ .file-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; }}}