Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

feat(webui): merge file-manager folder/chevron into one hover toggle

Sergey Kozyrenko11db9c2e0c63
diff --git a/frontend/src/components/shared/file-manager/file-manager-actions.tsx b/frontend/src/components/shared/file-manager/file-manager-actions.tsx
index 04c1afba..5dcf67ea 100644
--- a/frontend/src/components/shared/file-manager/file-manager-actions.tsx
+++ b/frontend/src/components/shared/file-manager/file-manager-actions.tsx
@@ -26,7 +26,6 @@ export const downloadAction = (
};
};
-/** Built-in copy-path action. */
export const copyPathAction = (onCopyPath: (file: FileNode) => void): FileManagerAction => ({
appliesToDirs: true,
icon: ClipboardCopy,
@@ -48,14 +47,6 @@ export const deleteAction = (onDelete: (file: FileNode) => void): FileManagerAct
separatorBefore: true,
});
-// ── Bulk-action helpers ─────────────────────────────────────────────────────
-//
-// Each helper produces a `FileManagerBulkAction` with sensible defaults; the
-// caller passes any callback / config it needs and lets the bar handle the
-// rendering, confirmation and dedup. Mirrors the row-action helpers above so
-// consumers compose `bulkActions={[bulkXAction(...), bulkYAction(...)]}` the
-// same way they compose `actions={[xAction(...), yAction(...)]}`.
-
interface BulkDeleteOptions {
/** Confirm-dialog body formatter. Default: "This will delete N items. This action cannot be undone." */
confirmDescription?: (countLabel: string) => string;
@@ -202,10 +193,6 @@ export const bulkDownloadAction = (
const href = getDownloadHref(files);
- // Trigger the download via a transient anchor so the browser respects
- // the `download` attribute and the backend's `Content-Disposition`.
- // `window.open` would do, but it can be blocked as a popup and doesn't
- // honour the filename hint the same way.
const anchor = document.createElement('a');
anchor.href = href;
diff --git a/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx b/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx
index 212e17e7..11d05af0 100644
--- a/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx
+++ b/frontend/src/components/shared/file-manager/file-manager-bulk-actions-bar.tsx
@@ -60,9 +60,6 @@ export function FileManagerBulkActionsBar({
}: FileManagerBulkActionsBarProps) {
const [pendingAction, setPendingAction] = useState<FileManagerBulkAction | null>(null);
- // Resolve the deduped FileNode[] once per render — every action callback,
- // confirm-dialog title and isDisabled / isHidden predicate share it, so
- // recomputing per call would be wasteful.
const dedupedFiles = useMemo(() => {
if (selectedPaths.size === 0) {
return [];
@@ -89,9 +86,6 @@ export function FileManagerBulkActionsBar({
const runAction = useCallback(
async (action: FileManagerBulkAction) => {
- // `dedupedFiles` is captured at click time — the state used by the
- // bar at that moment matches what the host receives, even if the
- // selection mutates while an async confirm is open.
await action.onSelect(dedupedFiles);
},
[dedupedFiles],
@@ -215,11 +209,6 @@ export function FileManagerBulkActionsBar({
);
}
-/**
- * Inline button for a single non-overflow bulk action. Extracted so the icon-only
- * variant (no `label` text on narrow screens) can be added later without bloating
- * the parent's JSX.
- */
function BulkActionButton({ action, isDisabled, onClick }: BulkActionButtonProps) {
const Icon = action.icon as ComponentType<{ className?: string }> | undefined;
const button = (
@@ -235,9 +224,6 @@ function BulkActionButton({ action, isDisabled, onClick }: BulkActionButtonProps
</Button>
);
- // Tooltip surfaces the label when the inline text is hidden on narrow
- // viewports (icon-only mode). On wider screens the label is already visible,
- // so the tooltip is a harmless duplicate but still helps with keyboard focus.
if (!action.icon) {
return button;
}
diff --git a/frontend/src/components/shared/file-manager/file-manager-row.tsx b/frontend/src/components/shared/file-manager/file-manager-row.tsx
index 64f6041f..3772b4bb 100644
--- a/frontend/src/components/shared/file-manager/file-manager-row.tsx
+++ b/frontend/src/components/shared/file-manager/file-manager-row.tsx
@@ -1,4 +1,5 @@
import { ChevronRight, Ellipsis } from 'lucide-react';
+import { motion, type Transition, useReducedMotion, type Variants } from 'motion/react';
import {
type CSSProperties,
memo,
@@ -44,6 +45,21 @@ import { formatModifiedRelative as defaultFormatModified, formatFileSize } from
const SKIP_ROW_CLICK_ATTR = 'data-fm-skip-row-click';
const skipRowClickProps = { [SKIP_ROW_CLICK_ATTR]: '' };
+// The `rest`/`hover` labels are set by the toggle's `whileHover` and reach both
+// icon layers via motion variant propagation — the layers declare no gesture of
+// their own.
+const ICON_SWAP_TRANSITION: Transition = { duration: 0.15, ease: 'easeOut' };
+const FOLDER_ICON_VARIANTS: Variants = {
+ hover: { opacity: 0, scale: 0.8 },
+ rest: { opacity: 1, scale: 1 },
+};
+const CHEVRON_ICON_VARIANTS: Variants = {
+ hover: { opacity: 1, scale: 1 },
+ rest: { opacity: 0, scale: 0.8 },
+};
+const FOLDER_ICON_VARIANTS_REDUCED: Variants = { hover: { opacity: 0 }, rest: { opacity: 1 } };
+const CHEVRON_ICON_VARIANTS_REDUCED: Variants = { hover: { opacity: 1 }, rest: { opacity: 0 } };
+
/**
* Layout/visibility/i18n props that are identical for every row in the tree.
* `FileManager` builds this object once with `useMemo` so memoized rows do not
@@ -190,6 +206,10 @@ function FileManagerRowImpl({
[file.groupIcon, file.isDir, file.name, isExpanded],
);
+ const prefersReducedMotion = useReducedMotion();
+ const folderIconVariants = prefersReducedMotion ? FOLDER_ICON_VARIANTS_REDUCED : FOLDER_ICON_VARIANTS;
+ const chevronIconVariants = prefersReducedMotion ? CHEVRON_ICON_VARIANTS_REDUCED : CHEVRON_ICON_VARIANTS;
+
const visibleActions = useMemo(() => buildVisibleActions(actions, file), [actions, file]);
const handleRowClick = (event: ReactMouseEvent) => {
@@ -219,9 +239,7 @@ function FileManagerRowImpl({
// browsers can override this by passing `onOpenDirectory`, which gets called
// instead — typical for drilling into a remote container directory by
// replacing the listing rather than expanding inline. Files always forward
- // to `onOpen` — typically wired to download / preview / open-in-tab. The
- // chevron icon on the row's left edge always toggles expand/collapse for
- // directories, regardless of `onOpenDirectory`.
+ // to `onOpen` — typically wired to download / preview / open-in-tab.
const handleRowDoubleClick = (event: ReactMouseEvent) => {
// Same React-tree-bubbling guard as `handleRowClick` — a double-click
// on a portaled menu item must not be treated as a row "open" gesture
@@ -442,42 +460,52 @@ function FileManagerRowImpl({
/>
)}
- <div className="relative flex min-w-0 items-center gap-1.5 self-stretch pl-[calc(var(--fm-depth)*16px)]">
+ <div className="relative flex min-w-0 items-center gap-1.5 self-stretch pl-[calc(var(--fm-depth)*22px)]">
{Array.from({ length: file.depth }, (_, i) => (
<span
aria-hidden="true"
className="bg-border pointer-events-none absolute -inset-y-1.75 w-px"
key={i}
- style={{ left: `${i * 16 + 6}px` }}
+ style={{ left: `${i * 22 + 6}px` }}
/>
))}
{file.isDir ? (
- <span
+ <motion.span
+ animate="rest"
aria-hidden="true"
- className="text-muted-foreground hover:bg-muted -mx-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded transition-colors"
+ className="relative -mx-0.5 inline-flex size-4 shrink-0 items-center justify-center text-blue-400"
+ initial="rest"
onClick={() => {
- // Mirror the double-click / Enter semantics here so the
- // chevron stays consistent with the row-level "open"
- // gesture: navigation-style consumers (e.g. the remote
- // container browser) drill into the folder instead of
- // toggling expansion that has no children to show.
+ // Mirror the double-click / Enter "open" gesture: navigation-style
+ // consumers (e.g. the remote container browser) drill into the folder
+ // via onOpenDirectory instead of toggling inline expansion.
if (onOpenDirectory) {
onOpenDirectory(file);
} else {
onToggleExpand(file.path, isExpanded);
}
}}
+ whileHover="hover"
{...skipRowClickProps}
>
- <ChevronRight className={cn('size-3.5 transition-transform', isExpanded && 'rotate-90')} />
- </span>
+ <motion.span
+ className="absolute inset-0 flex items-center justify-center"
+ transition={ICON_SWAP_TRANSITION}
+ variants={folderIconVariants}
+ >
+ <Icon className="size-4 shrink-0" />
+ </motion.span>
+ <motion.span
+ className="absolute inset-0 flex items-center justify-center"
+ transition={ICON_SWAP_TRANSITION}
+ variants={chevronIconVariants}
+ >
+ <ChevronRight className={cn('size-4 transition-transform', isExpanded && 'rotate-90')} />
+ </motion.span>
+ </motion.span>
) : (
- <span
- aria-hidden="true"
- className="-mx-0.5 size-4 shrink-0"
- />
+ <Icon className={cn('-mx-0.5 size-4 shrink-0', tone)} />
)}
- <Icon className={cn('size-4 shrink-0', tone)} />
<FileManagerHighlightedName
className={cn('text-sm', file.isGroupRoot && 'font-semibold')}
name={file.name}
diff --git a/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx b/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx
index 013286e2..d497c0be 100644
--- a/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx
+++ b/frontend/src/components/shared/file-manager/file-manager-skeleton.tsx
@@ -89,16 +89,8 @@ export function FileManagerSkeleton({
/>
)}
- <div className="flex min-w-0 items-center gap-1.5 pl-[calc(var(--fm-depth)*16px)]">
- {row.isDir ? (
- <Skeleton className="-mx-0.5 size-4 shrink-0 rounded-sm" />
- ) : (
- <span
- aria-hidden="true"
- className="-mx-0.5 size-4 shrink-0"
- />
- )}
- <Skeleton className="size-4 shrink-0 rounded-sm" />
+ <div className="flex min-w-0 items-center gap-1.5 pl-[calc(var(--fm-depth)*22px)]">
+ <Skeleton className="-mx-0.5 size-4 shrink-0 rounded-sm" />
<Skeleton className={cn('h-4', row.nameWidth)} />
</div>
diff --git a/frontend/src/components/shared/file-manager/file-manager-storage.ts b/frontend/src/components/shared/file-manager/file-manager-storage.ts
index ee27e3f5..5f7cf556 100644
--- a/frontend/src/components/shared/file-manager/file-manager-storage.ts
+++ b/frontend/src/components/shared/file-manager/file-manager-storage.ts
@@ -19,11 +19,6 @@ const fileManagerSortingSchema = z
})
.nullable();
-/**
- * Loader for the FileManager sort descriptor. Both "nothing stored" and
- * "stored as null" surface as `null` (no-sort) — the two cases are
- * indistinguishable from the consumer's point of view.
- */
export const loadFileManagerSorting = (key: string): FileManagerSortState =>
getStorageItem(key, fileManagerSortingSchema);
diff --git a/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx b/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx
index d6465790..f6369cf6 100644
--- a/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx
+++ b/frontend/src/components/shared/file-manager/file-manager-tree-node.tsx
@@ -26,12 +26,6 @@ interface FileManagerTreeNodeProps {
setSize: number;
}
-/**
- * Recursive tree node renderer. The component itself is not memoized — `FileManagerRow`
- * is, which is where per-row reconciliation savings actually matter. Extracting the
- * recursion into a component (instead of an inline `renderNode` function) keeps
- * `FileManager` lean and gives React DevTools a real boundary to inspect.
- */
export function FileManagerTreeNode({
actions,
activeRowPath,
@@ -51,11 +45,6 @@ export function FileManagerTreeNode({
const renderChildren = node.isDir && isExpanded && node.children.length > 0;
const dnd = bindNodeDnd(node);
- // Pre-resolve tri-state + subtree paths per row: keeping the lookup outside
- // the memoized `FileManagerRow` lets each row receive primitive/stable props
- // (`'indeterminate' | true | false | undefined` plus a `Map`-stored array
- // reference) so a selection change only re-renders the rows whose computed
- // state actually flipped.
const dirCheckboxState = node.isDir ? (dirSelectionStates.get(node.path) ?? false) : undefined;
const subtreePaths = node.isDir ? dirSubtreePaths.get(node.path) : undefined;
diff --git a/frontend/src/components/shared/file-manager/file-manager-types.ts b/frontend/src/components/shared/file-manager/file-manager-types.ts
index 47cc7c7d..dedbbd5a 100644
--- a/frontend/src/components/shared/file-manager/file-manager-types.ts
+++ b/frontend/src/components/shared/file-manager/file-manager-types.ts
@@ -34,7 +34,6 @@ export interface FileManagerAction {
label: string;
/** Triggered on item activation. Ignored when `getHref` is set. */
onSelect: (file: FileNode) => void;
- /** When true, separator is rendered before this action. */
separatorBefore?: boolean;
variant?: 'default' | 'destructive';
}
@@ -118,7 +117,6 @@ export interface FileManagerEmptyAreaAction {
id: string;
label: string;
onSelect: () => void;
- /** When true, separator is rendered before this item. */
separatorBefore?: boolean;
variant?: 'default' | 'destructive';
}
diff --git a/frontend/src/components/shared/file-manager/file-manager-utils.test.ts b/frontend/src/components/shared/file-manager/file-manager-utils.test.ts
index dfbd0bbe..844a6365 100644
--- a/frontend/src/components/shared/file-manager/file-manager-utils.test.ts
+++ b/frontend/src/components/shared/file-manager/file-manager-utils.test.ts
@@ -8,7 +8,6 @@ import {
buildFileManagerGridTemplate,
buildFileManagerTree,
clamp,
- collectAllFilePaths,
collectAllNodePaths,
collectDirectoryPaths,
collectSubtreePaths,
@@ -256,26 +255,6 @@ describe('buildFileManagerTree', () => {
});
});
-describe('collectAllFilePaths', () => {
- it('returns only file paths (no directories, no group roots)', () => {
- const tree = buildFileManagerTree(
- [file('a/b.txt'), file('a/c.txt'), file('d/e.txt')],
- [
- { id: 'a', label: 'A', pathPrefix: 'a' },
- { id: 'd', label: 'D', pathPrefix: 'd' },
- ],
- );
-
- expect(collectAllFilePaths(tree).sort()).toEqual(['a/b.txt', 'a/c.txt', 'd/e.txt']);
- });
-
- it('omits synthetic intermediate directories from the result', () => {
- const tree = buildFileManagerTree([file('foo/bar/baz.txt')]);
-
- expect(collectAllFilePaths(tree)).toEqual(['foo/bar/baz.txt']);
- });
-});
-
describe('collectVisibleFlat', () => {
it('walks only expanded directories', () => {
const tree = buildFileManagerTree([file('a/b.txt'), file('c.txt')]);
@@ -411,7 +390,6 @@ describe('walkTree', () => {
});
it('powers all collect* helpers consistently', () => {
- expect(collectAllFilePaths(tree).sort()).toEqual(['a/b/c.txt', 'a/d.txt', 'e.txt']);
expect(collectAllNodePaths(tree).sort()).toEqual(['a', 'a/b', 'a/b/c.txt', 'a/d.txt', 'e.txt'].sort());
expect(collectDirectoryPaths(tree).sort()).toEqual(['a', 'a/b']);
});
diff --git a/frontend/src/components/shared/file-manager/file-manager-utils.ts b/frontend/src/components/shared/file-manager/file-manager-utils.ts
index ae2cdd4a..c6786aa2 100644
--- a/frontend/src/components/shared/file-manager/file-manager-utils.ts
+++ b/frontend/src/components/shared/file-manager/file-manager-utils.ts
@@ -55,10 +55,6 @@ export const formatModifiedRelative = (modifiedAt?: Date | string): string => {
}
const now = Date.now();
- // All `differenceIn*` helpers are computed up-front so each branch's
- // fallback (`!minutes`, `!hours`, …) can guard against the upper unit
- // rounding down to zero — without it, an edge case like 59 minutes 30s
- // could fall through to the next branch and render as `0h ago`.
const seconds = differenceInSeconds(now, date);
const minutes = differenceInMinutes(now, date);
const hours = differenceInHours(now, date);
@@ -191,7 +187,6 @@ export const buildFileManagerTree = (
const groups = normalizeRootGroups(rootGroups);
const roots: FileManagerInternalNode[] = groups?.length ? groups.map(buildSyntheticGroupRoot) : [];
- // O(1) folder lookup by absolute path; replaces O(n) `siblings.find(...)`.
const folderByPath = new Map<string, FileManagerInternalNode>();
for (const file of sorted) {
@@ -301,10 +296,6 @@ export const walkTree = (
return result;
};
-/** Collect paths of *file* nodes only (no synthetic group roots, no directories). */
-export const collectAllFilePaths = (nodes: FileManagerInternalNode[]): string[] =>
- walkTree(nodes, { include: (node) => !node.isGroupRoot && !node.isDir });
-
/**
* Collect paths of every selectable node (files + real directories), excluding
* synthetic group roots. Used as the universe for "select all" / bulk operations.
@@ -455,9 +446,6 @@ export const sortFileManagerTree = (
}
const reordered = [...recursed].sort((a, b) => {
- // `isFoldersFirst` is treated as a primary partition before any
- // other criterion so directories always stay above files
- // regardless of the active comparator (or its absence).
if (isFoldersFirst) {
const aIsDir = a.isDir || a.isGroupRoot;
const bIsDir = b.isDir || b.isGroupRoot;
@@ -781,7 +769,6 @@ interface ComputeRowClickSelectionArgs {
/** Visible nodes in DFS order; range modifier resolves anchor/target indices against this list. */
flatVisible: readonly string[];
modifier: 'range' | 'single' | 'toggle';
- /** Path of the row that was clicked. */
path: string;
/** Current selection. Pure reducer — never mutated. */
prev: ReadonlySet<string>;
@@ -938,7 +925,6 @@ export const computeToggleSelection = ({ path, prev, subtreePaths }: ComputeTogg
};
interface ComputeToggleSelectAllArgs {
- /** Universe of every selectable path in the current visible tree. */
allSelectablePaths: readonly string[];
prev: ReadonlySet<string>;
}
diff --git a/frontend/src/components/shared/file-manager/file-manager.tsx b/frontend/src/components/shared/file-manager/file-manager.tsx
index f7b217e2..acae03da 100644
--- a/frontend/src/components/shared/file-manager/file-manager.tsx
+++ b/frontend/src/components/shared/file-manager/file-manager.tsx
@@ -78,11 +78,6 @@ const defaultSortHeaderAriaLabel = (
return `Sort by ${label} (ascending)`;
};
-/**
- * Renders the right-click context menu items for the empty area of the tree.
- * Kept as a plain helper so the same JSX can be reused inside the
- * `<ContextMenuContent>` regardless of where it lives in the render tree.
- */
const renderEmptyAreaItems = (items: readonly FileManagerEmptyAreaAction[]): ReactNode[] => {
const nodes: ReactNode[] = [];
@@ -222,12 +217,6 @@ export function FileManager({
toggleSelectAll,
} = useFileManagerSelection({ allSelectablePaths, dirSubtreePaths, flatVisible });
- // Cumulative byte total of the deduped selection — fed into the bulk bar's
- // size suffix ("3 selected · 14.2 MB"). Recomputed on selection / tree
- // changes; cheap because the dedup keeps the visit list short and each
- // subtree walk uses the same `findNodeByPath` traversal as the bar's other
- // helpers. Skipped entirely when the bar is hidden so a no-checkbox tree
- // never pays the cost.
const selectionTotalBytes = useMemo(() => {
if (!hasBulkActions || selectedPaths.size === 0) {
return 0;
@@ -254,9 +243,6 @@ export function FileManager({
return map;
}, [dirSubtreePaths, selectedPaths]);
- // Report selection changes upstream without forcing parents to memoize the
- // callback — stash it in a ref so the effect only re-fires when the actual
- // selection changes (not when a fresh function instance is passed in).
const onSelectionChangeRef = useLatestRef(onSelectionChange);
useEffect(() => {
@@ -266,10 +252,6 @@ export function FileManager({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedPaths]);
- // Same latest-ref pattern for `onOpen` / `onOpenDirectory`: both bleed into
- // the keyboard handler's deps and through `TreeNode` → `Row`, so a
- // non-memoized parent callback would otherwise invalidate the memo on every
- // row whenever the parent re-renders.
const onOpenRef = useLatestRef(onOpen);
const onOpenDirectoryRef = useLatestRef(onOpenDirectory);
@@ -367,11 +349,6 @@ export function FileManager({
[clearSelection],
);
- // Pull labels resolution and search-query trim up to render-top so they can
- // feed into `display` below. Both must be computed unconditionally — the
- // memoization that follows is guarded by `Object.is` on each dep, so a
- // missing `labels` prop ({} on every render) only invalidates `formatModified`
- // when the inner reference actually changes.
const effectiveLabels = labels ?? {};
const formatModified = effectiveLabels.formatModified;
const effectiveActions = actions ?? EMPTY_ACTIONS;
@@ -399,9 +376,6 @@ export function FileManager({
);
};
- // Bundle all per-tree-shared layout / i18n props into a single object so the
- // memoized `FileManagerRow` only does one reference check (instead of seven
- // primitive comparisons) on every parent re-render.
const display = useMemo<FileManagerRowDisplay>(
() => ({
formatModified,
@@ -415,9 +389,6 @@ export function FileManager({
[formatModified, gridTemplate, hasActions, isCheckboxVisible, isModifiedVisible, isSizeVisible, searchQuery],
);
- // Same trick for callbacks. Every dep here is already stabilized through
- // a ref or empty deps inside its source hook, so `handlers` is constructed
- // exactly once per `FileManager` instance and never invalidates row memo.
const handlers = useMemo<FileManagerRowHandlers>(
() => ({
onClick: onRowClick,
@@ -532,21 +503,20 @@ export function FileManager({
)}
<div className="flex min-w-0 items-center gap-1.5">
{allDirPaths.length > 0 ? (
- <button
+ <Button
aria-expanded={isAllExpanded}
aria-label={
isAllExpanded
? (effectiveLabels.collapseAllAriaLabel ?? 'Collapse all')
: (effectiveLabels.expandAllAriaLabel ?? 'Expand all')
}
- className="text-muted-foreground hover:bg-muted hover:text-primary focus-visible:ring-ring -mx-0.5 inline-flex size-4 shrink-0 items-center justify-center rounded transition-colors outline-none focus-visible:ring-1"
+ className="text-muted-foreground hover:bg-muted -mx-0.5 size-4 shrink-0 rounded hover:text-blue-400"
onClick={toggleExpandAll}
- type="button"
+ size="icon-xs"
+ variant="ghost"
>
- <ChevronRight
- className={cn('size-3.5 transition-transform', isAllExpanded && 'rotate-90')}
- />
- </button>
+ <ChevronRight className={cn('size-4 transition-transform', isAllExpanded && 'rotate-90')} />
+ </Button>
) : (
<span
aria-hidden="true"
diff --git a/frontend/src/components/shared/file-manager/use-file-manager-data.ts b/frontend/src/components/shared/file-manager/use-file-manager-data.ts
index 3da7a01a..4d7237cc 100644
--- a/frontend/src/components/shared/file-manager/use-file-manager-data.ts
+++ b/frontend/src/components/shared/file-manager/use-file-manager-data.ts
@@ -33,7 +33,6 @@ interface UseFileManagerDataArgs {
*/
isFoldersFirst: boolean;
rootGroups: FileManagerRootGroup[] | undefined;
- /** Raw `search.query` from props; trimming and emptiness checks live inside the hook. */
searchQuery: string | undefined;
/** Active sort descriptor; `null` preserves insertion order. */
sorting: FileManagerSortState;
@@ -59,9 +58,7 @@ interface UseFileManagerDataResult {
* including those filtered out of the visible tree by the search query.
*/
fullTree: FileManagerInternalNode[];
- /** CSS `grid-template-columns` value shared by the header and every row. */
gridTemplate: string;
- /** True when a non-empty search query is active. Drives auto-expand-on-search. */
isFiltering: boolean;
isModifiedVisible: boolean;
isSizeVisible: boolean;
@@ -71,7 +68,6 @@ interface UseFileManagerDataResult {
* treat the value as the canonical group list.
*/
normalizedRootGroups: FileManagerRootGroup[] | undefined;
- /** Trimmed search query (`''` when missing or whitespace-only). */
trimmedSearch: string;
/**
* The tree as the user actually sees it — same shape as `fullTree` when no
@@ -124,9 +120,6 @@ export function useFileManagerData({
const allSelectablePaths = useMemo(() => collectAllNodePaths(visibleTree), [visibleTree]);
- // Pre-compute the subtree path list for every directory (and group root) once
- // per tree shape: this powers both the tri-state checkbox value and the
- // "toggle whole subtree" gesture without re-walking the tree on every render.
const dirSubtreePaths = useMemo(() => {
const map = new Map<string, readonly string[]>();
diff --git a/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts b/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts
index 1146a0aa..cc7fbe12 100644
--- a/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts
+++ b/frontend/src/components/shared/file-manager/use-file-manager-dnd.ts
@@ -26,12 +26,6 @@ export interface FileManagerNodeDndHandlers {
* destination contract for them.
*/
canDrag: boolean;
- /**
- * `true` when this row is part of the in-flight drag operation. Drives the
- * "ghosted" appearance for every selected row when the user drags one of them,
- * so it's obvious that the whole batch is being moved (not just the row whose
- * native drag image the browser is showing).
- */
isBeingDragged: boolean;
isDropTarget: boolean;
onDragEnd: () => void;
@@ -214,16 +208,8 @@ export function useFileManagerDnd({
onMoveItems,
selectedPaths,
}: UseFileManagerDndParams): UseFileManagerDndResult {
- // `isEnabled` keeps its legacy meaning ("internal move DnD is on") so
- // existing consumers (e.g. row `draggable` flag, container root-drop
- // wiring) keep working unchanged. External-file drops live on a separate
- // flag and only contribute row-level handlers; they never make rows
- // draggable or wire the container.
const isEnabled = !!onMoveItems;
const isExternalDropEnabled = !!onExternalFileDrop;
- // Some node-level branches need to know whether the row should react to
- // *any* drag event (move OR external) — this combined flag avoids
- // repeating the OR at every entry.
const reactsToDrags = isEnabled || isExternalDropEnabled;
// Stash via ref so the dragstart handler doesn't re-create on every selection
@@ -264,11 +250,6 @@ export function useFileManagerDnd({
const selection = selectionRef.current;
const isPartOfSelection = !!selection && selection.has(node.path);
- // Build the source path list:
- // - If the dragged row IS part of the selection → drag everything selected
- // (deduped so a parent dir doesn't ship together with its descendants).
- // - Otherwise → drag just this row, and clear the previous selection so
- // the user isn't left with a stale highlight pointing at unrelated items.
const sourcePaths = isPartOfSelection && selection ? dedupeOverlappingPaths(selection) : [node.path];
if (!isPartOfSelection && selection && selection.size > 0) {
@@ -298,9 +279,6 @@ export function useFileManagerDnd({
// in the ref. Newline-separate so external listeners can still parse it.
event.dataTransfer.setData(FM_DND_MIME, sources.map((source) => source.path).join('\n'));
- // For multi-source drags swap the browser's default drag image (= the
- // grabbed row only) with a compact "N items" badge — without it the
- // user can't tell at a glance that the whole selection is on the move.
if (sources.length > 1) {
const badge = document.createElement('div');
@@ -360,9 +338,6 @@ export function useFileManagerDnd({
return;
}
- // Top-level files behave as part of the root drop area — let the event
- // bubble so the container handler (for FM-mime drags) or the page-
- // level external drop handler can pick it up.
if (isRootPassthrough(node)) {
return;
}
@@ -372,12 +347,6 @@ export function useFileManagerDnd({
// as a drop into the empty (root) area and call the move API on release.
event.stopPropagation();
- // Files inside a folder forward their drop logic to the parent dir
- // (returned here by `resolveDropTargetDir`), so the user can release
- // anywhere inside the folder and the items land in that folder —
- // matching Finder/Explorer. The parent's row picks up the highlight
- // automatically because every row compares `dropTargetPath` to its own
- // `node.path`, and we set the parent's path here.
const targetDir = resolveDropTargetDir(node, findNode);
// External drags accept any directory; move drags additionally need
// a valid source/destination pairing (no self-into-self / parent etc.).
@@ -705,8 +674,6 @@ export function useFileManagerDnd({
event.preventDefault();
resetDragState();
- // Selection paths are about to be invalidated by the move — clear them so
- // the bulk bar doesn't display stale "N selected".
onClearSelection?.();
void onMoveItems?.(sources, '');
},
diff --git a/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts b/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts
index 276d7cec..abdf02f0 100644
--- a/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts
+++ b/frontend/src/components/shared/file-manager/use-file-manager-keyboard.ts
@@ -11,7 +11,6 @@ interface UseFileManagerKeyboardNavigationArgs {
focusRow: (path: null | string) => void;
isCheckboxVisible: boolean;
onClearSelection: () => void;
- /** Open handler for file rows (Enter). */
onOpen?: (file: FileNode) => void;
/**
* Open handler for directory rows (Enter). When set, replaces the default
@@ -24,7 +23,6 @@ interface UseFileManagerKeyboardNavigationArgs {
onToggleExpand: (path: string, wasExpanded: boolean) => void;
/** Polymorphic selection toggle — same shape as the row checkbox handler. */
onToggleSelection: (path: string, subtreePaths?: readonly string[]) => void;
- /** Currently focused row, or `null` if nothing is focused. */
resolvedActiveRow: null | string;
visibleTree: FileManagerInternalNode[];
}
diff --git a/frontend/src/components/shared/file-manager/use-file-manager-selection.ts b/frontend/src/components/shared/file-manager/use-file-manager-selection.ts
index 5c605d0f..d5c95cb3 100644
--- a/frontend/src/components/shared/file-manager/use-file-manager-selection.ts
+++ b/frontend/src/components/shared/file-manager/use-file-manager-selection.ts
@@ -39,7 +39,6 @@ interface UseFileManagerSelection {
*/
onToggleSelection: (path: string, subtreePaths?: readonly string[]) => void;
selectedPaths: Set<string>;
- /** Replace entire selection. */
setSelection: (paths: Set<string>) => void;
/** Toggle "select all": clears if everything was selected, otherwise picks every file. */
toggleSelectAll: () => void;
@@ -65,12 +64,6 @@ interface UseFileManagerSelectionArgs {
* after files change; we derive a pruned `selectedPaths` during render. The pruned
* Set keeps reference identity when nothing was stripped, so memoized consumers
* downstream don't re-render needlessly.
- *
- * All real selection logic lives in pure reducers inside `file-manager-utils`
- * (`computeRowClickSelection`, `computeToggleSelection`, `computeToggleSelectAll`).
- * The hook is a thin wrapper that owns the state Set, the anchor ref, and a few
- * latest-ref pointers needed to keep the callbacks reference-stable across
- * expand/collapse and tree-shape changes.
*/
export function useFileManagerSelection({
allSelectablePaths,
@@ -161,9 +154,6 @@ export function useFileManagerSelection({
const isAllSelected = allSelectablePaths.length > 0 && selectedPaths.size === allSelectablePaths.length;
const isSomeSelected = selectedPaths.size > 0 && !isAllSelected;
- // Functional setState reads the current selectable universe through the ref
- // declared above, so the callback identity stays stable regardless of how
- // many times the file list or selection changes.
const toggleSelectAll = useCallback(() => {
setRawSelectedPaths((prev) =>
computeToggleSelectAll({ allSelectablePaths: allSelectablePathsRef.current, prev }),