Files
sim/packages/emcn
Waleed 4fc0fb4bad refactor(resources): converge Files onto the shared drag hook and batch bulk authorization (#6748)
* refactor(resources): converge Files onto the shared drag hook and batch bulk authorization

Files kept a 280-line copy of the foldered-list drag logic because it also
accepts OS file drops. The copies had already drifted, so the external drop
becomes an option on the shared hook and the copy goes away.

- Add `externalDrop` to `useFolderRowDragDrop`: folder rows highlight and spring
  open for an OS file drag exactly as for a move, while the body and breadcrumb
  decline so the page-level upload overlay owns those regions
- Collapse the three drop-active booleans into one `ActiveDropTarget` union, so
  exactly one affordance is armed by construction rather than by hand-clearing
- Keep drop-target writes identity-stable so `dragover` does not re-render the
  list on every event
- Give each list its own drag MIME again, restoring the cross-surface isolation
  `drag-payload.ts` documents
- Let a folder spring open more than once per drag, so a drag can walk back out
  through the breadcrumb and descend again; the guard against re-entering the
  folder already on screen moves to `useSpringNavigation`, the only layer that
  can state it
- Resolve each bulk item against the workspace context the batch already holds,
  and memoize the effective-permission lookup for the batch, replacing two
  invariant queries per item
- Fill the drop target at `--surface-active`: `--surface-4` is the button-base
  token and is lighter than hover in light mode, so the strongest row state read
  the faintest

* fix(resources): dismiss the upload overlay on a folder drop and re-check permission per item

The drag hook stops propagation on a drop it handles, so the page-level handler
that cleared the upload overlay never ran and the chrome stayed up over the
finished upload. Both consuming paths now share one dismissal.

Drop the batch permission memo: each item in a bulk move or delete commits
independently, so reusing one allow verdict let a revocation part-way through a
batch go unseen by the remaining items. The workspace context is still resolved
once per batch, which was the larger saving.
2026-08-15 16:44:03 -07:00
..