Skip to content

chore(editor): reorganize (dev)/ui showcase with sidebar nav - #750

Merged
softmarshmallow merged 2 commits into
mainfrom
chore/dev-ui-reorg
May 26, 2026
Merged

softmarshmallow merged 2 commits into
mainfrom
chore/dev-ui-reorg

Conversation

@softmarshmallow

@softmarshmallow softmarshmallow commented May 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a shared sidebar nav (_nav.ts, _sidebar.tsx, layout.tsx) across the (dev)/ui showcase pages
  • Move the tree-view showcase into the @grida/tree-view packages page; drop the standalone components/tree-view/page.tsx and the old components/layout.tsx
  • Refresh floating-window, frames, and tree-view fixtures/patterns to match the new layout

No behavioral changes outside of the dev-only (dev)/ui routes.

Test plan

  • pnpm turbo dev --filter=editor → visit /ui and confirm the sidebar groups (Components / Packages / Forms / Showcases) render and links route correctly
  • /packages/@grida/tree-view shows the migrated tree-view showcase
  • /ui/floating-window and /ui/frames still render as expected

Summary by CodeRabbit

  • New Features

    • Sidebar navigation for organized browsing of UI workbench
    • Multiple tree-view pattern demos (selection, keyboard nav, move/copy, virtualization, guides)
    • macOS desktop and window frame examples
  • Refactor

    • Floating window positioning and boundary handling improved
    • Showcases reorganized to use a shared SVG editor scaffold and unified layout
  • Chore

    • Workbench landing page simplified; some demo pages condensed or removed

Review Change Stack

- Add shared sidebar (_nav.ts, _sidebar.tsx, layout.tsx) for /ui dev pages
- Move tree-view showcase into the @grida/tree-view packages page
- Refresh floating-window, frames, and tree-view fixtures/patterns
@vercel

vercel Bot commented May 26, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
grida Ready Ready Preview, Comment May 26, 2026 6:39pm
6 Skipped Deployments
Project Deployment Actions Updated (UTC)
code Ignored Ignored May 26, 2026 6:39pm
docs Ignored Ignored Preview May 26, 2026 6:39pm
legacy Ignored Ignored May 26, 2026 6:39pm
backgrounds Skipped Skipped May 26, 2026 6:39pm
blog Skipped Skipped May 26, 2026 6:39pm
viewer Skipped Skipped May 26, 2026 6:39pm

Request Review

@coderabbitai

coderabbitai Bot commented May 26, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 37daf6f7-b53e-4202-9252-bbe20729630d

📥 Commits

Reviewing files that changed from the base of the PR and between 2cd7050 and 89ce86c.

📒 Files selected for processing (3)
  • editor/app/(dev)/ui/components/tree-view/_patterns.tsx
  • editor/app/(dev)/ui/components/tree-view/_showcase.tsx
  • editor/components/floating-window/primitives.tsx

Walkthrough

Adds a typed dev UI navigation and persistent sidebar, splits the monolithic tree-view demo into reusable pattern panels and SVG-editor-backed showcases, simplifies the dev UI index, updates the tree-view landing page and frames demo, and modernizes floating-window primitives to use element-based boundary/measurement APIs.

Changes

UI Workbench and Demo Infrastructure

Layer / File(s) Summary
Navigation Foundation
editor/app/(dev)/ui/_nav.ts, editor/app/(dev)/ui/_sidebar.tsx, editor/app/(dev)/ui/layout.tsx
NavItem/NavGroup types and uiNavGroups constant define grouped nav entries; UISidebar renders grouped menu items with active-state detection; UILayout wraps pages with SidebarProvider and SidebarInset.
Tree-View Fixture Cleanup
editor/app/(dev)/ui/components/tree-view/_fixtures.ts
DemoMeta drops geometry/rendering fields; buildSceneFixture() helper is removed.
Tree-View Pattern Components
editor/app/(dev)/ui/components/tree-view/_patterns.tsx
New client module exporting multiple demo panels (PlainHierarchy, MultiSelect, KeyboardNav, ConstraintsPanel, MoveCopyPanel, VirtualizedPanel, DeepVirtualizedPanel, GuidesPanel) plus useControllerForLayers, FigmaDeepRow custom row renderer, and intent/selection helpers.
Tree-View Showcase Refactoring
editor/app/(dev)/ui/components/tree-view/_showcase.tsx
Replaces custom SVG canvas with SvgEditorProvider/SvgEditorCanvas; adds ACTIVITY_SVG, tone bundles (GRIDA_TONE, FIGMA_TONE), SvgRow, and useAutoRevealSelection for tree-editor sync.
Dev UI Landing Page Simplification
editor/app/(dev)/ui/page.tsx
Replaces dynamic component index with a static "Internal / Grida UI Workbench" landing block and GitHub link.
Tree-View Package Landing Page
editor/app/(tools)/(packages)/packages/[%40grida]/tree-view/page.tsx
Adds PatternSection wrapper and restructures the page into "Examples" (pattern demos) and "Recipes" sections; removes the "Open documentation" CTA.
macOS Frames Demo
editor/app/(dev)/ui/frames/page.tsx
Adds macOS Desktop/Window demos composed from MacOSDesktop, MacOSMenuBar, MacOSWindow, and MacOSDock, sourcing dock icons from Resources.

Floating Window API Modernization

Layer / File(s) Summary
Floating Window Boundary and Measurement API
editor/components/floating-window/primitives.tsx
BoundsRenderProps exposes boundaryEl; FloatingWindowRootProps accepts boundaryEl and legacy boundaryRef; FloatingWindowBounds syncs a callback-ref boundaryEl state with the legacy ref; FloatingWindowRoot uses a callback-ref windowEl, resolves effective boundary via useResolvedBoundaryEl, and updates measurement/positioning to operate on resolved elements.
Floating Window Demo Updated
editor/app/(dev)/ui/floating-window/page.tsx
Demo now uses FloatingWindowBounds render-prop passing boundaryEl, updates window sizing/positioning and body/title markup, and makes InspectorExample conditionally throw during render based on internal state.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • gridaco/grida#466: Introduces floating-window system with boundary-clamping behavior; this PR updates that API to use element-based boundaries in addition to legacy refs.
  • gridaco/grida#719: Adds DemoMeta geometry fields and buildSceneFixture() helper; this PR removes those same fields and helper to transition to pattern-based demos.
  • gridaco/grida#467: Earlier floating-window page refactor; this PR builds on the same demo page structure and updates it to use the new boundary API.

Suggested labels

chore

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(editor): reorganize (dev)/ui showcase with sidebar nav' directly and clearly summarizes the main change: reorganizing the dev UI showcase with a new sidebar navigation system.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/dev-ui-reorg

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2cd7050e33

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

🧹 Nitpick comments (1)
editor/components/floating-window/primitives.tsx (1)

650-693: 💤 Low value

Polling approach is sound but consider a bail-out limit.

The rAF polling continues indefinitely until ref.current resolves. In edge cases where the ref is never populated (misconfiguration, conditional unmounting), this silently polls forever. A maximum iteration limit with a dev-mode warning would surface these issues earlier.

That said, the cleanup is correct and the intended use-case (brief mount timing gap) should resolve within a few frames — this is a minor defensive hardening suggestion.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@editor/components/floating-window/primitives.tsx` around lines 650 - 693,
useResolvedBoundaryEl currently rAF-polls indefinitely via
poll/requestAnimationFrame until ref.current resolves; add a max-attempts
bail-out to avoid endless polling: introduce a counter (e.g. attempts) and a
constant MAX_ATTEMPTS, increment attempts each tick in poll, and if attempts >=
MAX_ATTEMPTS cancel the rAF, set rafId = null, and setResolved(null) (or leave
as-is) and in development emit a console.warn mentioning
useResolvedBoundaryEl/ref boundary not resolving; ensure cleanup still cancels
rafId as before and reference symbols poll, rafId, requestAnimationFrame, and
useResolvedBoundaryEl when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@editor/app/`(dev)/ui/components/tree-view/_patterns.tsx:
- Around line 229-245: The chevron button is still rendered for leaf rows
(row.isContainer === false) but marked aria-hidden, creating an invalid
focusable control; change the JSX to only render the interactive <button> when
row.isContainer is true (so the onClick and controller.toggle(row.id) logic
stays inside that branch) and for non-containers render either nothing or a
non-focusable element (e.g., a <span> or null) instead of a button; ensure
ChevronDownIcon/ChevronRightIcon remain inside the conditional so only
containers create a focusable control and remove aria-hidden from any remaining
focusable element.

In `@editor/app/`(dev)/ui/components/tree-view/_showcase.tsx:
- Around line 377-393: The chevron button is still mounted for leaf rows
(row.isContainer === false) which creates hidden-but-focusable controls; change
the rendering so that only container rows render an interactive <button> with
the onClick that calls controller.toggle(row.id) and appropriate aria
attributes, and render a non-interactive element (e.g., a <span> or <div>) with
the same visual classes (tone.chevronContainer / tone.chevron(selected)) for
leaf rows so it is not focusable or tabbable; keep the same icons
(ChevronDownIcon / ChevronRightIcon) but only inside the button when
row.isContainer.

---

Nitpick comments:
In `@editor/components/floating-window/primitives.tsx`:
- Around line 650-693: useResolvedBoundaryEl currently rAF-polls indefinitely
via poll/requestAnimationFrame until ref.current resolves; add a max-attempts
bail-out to avoid endless polling: introduce a counter (e.g. attempts) and a
constant MAX_ATTEMPTS, increment attempts each tick in poll, and if attempts >=
MAX_ATTEMPTS cancel the rAF, set rafId = null, and setResolved(null) (or leave
as-is) and in development emit a console.warn mentioning
useResolvedBoundaryEl/ref boundary not resolving; ensure cleanup still cancels
rafId as before and reference symbols poll, rafId, requestAnimationFrame, and
useResolvedBoundaryEl when making the change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 336f8be7-f599-47b5-991a-8b4139ceb6cc

📥 Commits

Reviewing files that changed from the base of the PR and between 0d39b2c and 2cd7050.

📒 Files selected for processing (13)
  • editor/app/(dev)/ui/_nav.ts
  • editor/app/(dev)/ui/_sidebar.tsx
  • editor/app/(dev)/ui/components/layout.tsx
  • editor/app/(dev)/ui/components/tree-view/_fixtures.ts
  • editor/app/(dev)/ui/components/tree-view/_patterns.tsx
  • editor/app/(dev)/ui/components/tree-view/_showcase.tsx
  • editor/app/(dev)/ui/components/tree-view/page.tsx
  • editor/app/(dev)/ui/floating-window/page.tsx
  • editor/app/(dev)/ui/frames/page.tsx
  • editor/app/(dev)/ui/layout.tsx
  • editor/app/(dev)/ui/page.tsx
  • editor/app/(tools)/(packages)/packages/[%40grida]/tree-view/page.tsx
  • editor/components/floating-window/primitives.tsx
💤 Files with no reviewable changes (3)
  • editor/app/(dev)/ui/components/layout.tsx
  • editor/app/(dev)/ui/components/tree-view/page.tsx
  • editor/app/(dev)/ui/components/tree-view/_fixtures.ts

- Restore default 100% w/h on FloatingWindowBounds (via cn merge, so
  caller className still overrides) — fixes playground.tsx mounting with
  no sizing props.
- Tree-view chevron a11y: only container rows render an interactive
  button (with aria-label); leaf rows render a non-focusable span,
  removing the invalid aria-hidden focusable control.
@vercel
vercel Bot temporarily deployed to Preview – backgrounds May 26, 2026 18:37 Inactive
@vercel
vercel Bot temporarily deployed to Preview – viewer May 26, 2026 18:37 Inactive
@vercel
vercel Bot temporarily deployed to Preview – blog May 26, 2026 18:37 Inactive
@softmarshmallow
softmarshmallow merged commit ae0096a into main May 26, 2026
6 checks passed

This branch was successfully deployed

1 active and 3 inactive deployments
Preview – grida — 89ce86c0 Deployed May 26, 2026 by vercel[bot]
Preview – blog — 89ce86c0 Deployed May 26, 2026 by vercel[bot]
Preview – backgrounds — 89ce86c0 Deployed May 26, 2026 by vercel[bot]
Preview – viewer — 89ce86c0 Deployed May 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant