Skip to content

FE-1541: Add a generic ResizeHandle and adopt it across the panels - #9429

Open
kube wants to merge 2 commits into
mainfrom
claude/fe-1541-resize-handle
Open

FE-1541: Add a generic ResizeHandle and adopt it across the panels#9429
kube wants to merge 2 commits into
mainfrom
claude/fe-1541-resize-handle

Conversation

@kube

@kube kube commented Aug 29, 2026

Copy link
Copy Markdown
Collaborator

🌟 What is the purpose of this PR?

One shared edge-resize implementation for the package. Adds the generic ResizeHandle primitive (a drag handle around the existing useResizeDrag, with min/max clamping and two visual appearances) and moves the package's two hand-rolled copies onto it. Bottom of the Notebook view stack, but independent of it: everything here is existing-UI refactoring plus one new component.

🔗 Related links

🔍 What does this change?

  • ui/resize/resize-handle.tsx: the primitive — edge (top/bottom/left/right), controlled size with min/max clamping, roving-tab-order-friendly (tabIndex={-1}), and an appearance prop: "hidden" tints the strip on hover, "line" shows a centred pill; both turn blue while resizing. It exposes data-resizing/data-resize-edge so ancestors can style themselves against an active drag with :has().
  • GlassPanel drops its inline handle (styles, positioning switch, drag wiring) and renders the primitive; its dragged-edge border highlight now derives from the handle's data attributes via :has(). The LeftSideBar, PropertiesPanel, and BottomPanel ride this unchanged.
  • The AI assistant panel drops its hand-rolled pointer-drag path for the primitive with the line appearance, keeping its hover-pill affordance. Its shell already clamps to the viewport in CSS, so a static maxSize replaces the per-drag window-width computation.
  • A layer declaration for ui/resize in the architecture docs.

Net −162 lines: three implementations become one.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing
    • behaviour-preserving refactor of unreleased-alongside code; the Notebook stack above carries the release changeset

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

No unit tests — the primitive is DOM-drag behaviour. Verified by driving the browser: all three GlassPanel-backed panels resize with the dragged-edge highlight reacting, and the AI panel resizes with exact pixel deltas through its new handle.

❓ How to test this?

  1. yarn workspace @hashintel/petrinaut storybook
  2. In any editor story, drag the sidebar, properties, and bottom panel edges — the panel border should highlight while dragging.
  3. In the WithAiAssistant story, open the assistant and drag its left edge — a pill line shows on hover and while resizing.

kube added 2 commits August 29, 2026 03:23
A reusable drag handle around the existing useResizeDrag hook, for
resizing a positioned ancestor from any edge with min/max clamping,
and a layer declaration for the resize folder.
GlassPanel drops its inline copy of the handle: the primitive renders
it, and the panel's dragged-edge border highlight now derives from the
handle's data-resizing/data-resize-edge attributes via :has(), so the
three editor panels ride the shared implementation unchanged.

The AI assistant panel drops its hand-rolled pointer-drag path for the
same primitive with the new line appearance — a centred pill that shows
on hover and turns blue while resizing. Its shell already clamps to the
viewport in CSS, so the static maxSize replaces the per-drag
window-width computation.
@kube kube self-assigned this Aug 29, 2026
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview Aug 29, 2026 1:46am
petrinaut Ready Ready Preview Aug 29, 2026 1:46am
petrinaut-docs Ready Ready Preview Aug 29, 2026 1:46am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview Aug 29, 2026 1:46am

Request Review

@cursor

cursor Bot commented Aug 29, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Behavior-preserving UI refactor in petrinaut; no auth, data, or API surface changes, with manual Storybook verification called out in the PR.

Overview
Introduces a reusable ResizeHandle built on useResizeDrag, with edge selection, min/max clamping, hidden vs line visuals, and data-resizing / data-resize-edge so parents can react during drags (e.g. border highlights via :has()).

GlassPanel drops its inlined handle styles and drag wiring and renders ResizeHandle instead; dragged-edge border tinting now keys off the handle’s data attributes rather than local resize state.

The AI assistant sidebar replaces a custom pointer-drag resize path with ResizeHandle (appearance="line"), keeping the pill affordance while sharing the same drag overlay behavior as the other panels.

Adds an architecture @layerRoot ui.resize note on the drag hook module.

Reviewed by Cursor Bugbot for commit 3d3e245. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3d3e245. Configure here.

window.removeEventListener("pointermove", onPointerMove);
window.removeEventListener("pointerup", onPointerUp);
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle sits off the visible edge

Medium Severity

Adopting ResizeHandle on the padded assistant shell places the 5px hit target and hover pill on the shell's left edge, away from the inset card. The previous handle reached the visible card edge, so grabbing that edge no longer starts a resize.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3d3e245. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant