Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update project tree scroll to current ID context menu, top bar #29427

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

adamleithp
Copy link
Contributor

Problem

When an project tree/lemon tree item was clicked we went to that URL, but when we refreshed, we'd lose that context in the tree.
Also, drag and drop (currently) is initiated by holding command key/use context menu, which is not obvious, so I added a dismissable banner to help users know what's going on.

Changes

  • Save clicked project tree item, show active item in lemon tree on load
  • Scroll to active item on load
  • Scroll to focused item
  • Added context menu (which has the same controls as the sideAction)
    • Added storybook entry
  • Added banner to project tree to help users understand what's what
  • Added top bar with
    • edit/cancel to allow drag and drop/cancel pending actions,
    • save pending actions

2025-03-03 14 11 29

2025-02-28 14 56 04

Does this work well for both Cloud and self-hosted?

It should

How did you test this code?

Locally

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances the project tree component with improved state persistence, context menus, and drag-and-drop functionality.

  • Added context menu functionality to tree items using a new ContextMenu component based on Radix UI primitives
  • Implemented state persistence to maintain selected tree items across page refreshes and scroll to active items
  • Replaced command key requirement for drag-and-drop with intuitive visual indicators and right-click context menu
  • Added a dismissable help banner explaining navigation features and a top bar with edit/save/cancel controls
  • Updated styling with new highlight variables and z-index settings to support context menus and visual feedback

8 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -463,8 +504,10 @@ const LemonTree = forwardRef<HTMLDivElement, LemonTreeProps>(
// Update focusedId when clicking
setFocusedId(item?.id)

const isFolder = item?.children && item?.children?.length >= 0
Copy link
Contributor

Choose a reason for hiding this comment

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

style: The condition item?.children && item?.children?.length >= 0 will always be true if item.children exists, even if it's an empty array. Consider using item?.children !== undefined instead for clarity.

adamleithp and others added 3 commits March 3, 2025 15:45
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…jectTree.tsx

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@adamleithp adamleithp requested review from mariusandra and Twixes March 3, 2025 15:47
@adamleithp adamleithp changed the title chore: update project tree scroll to current ID context menu, top bar chore: update project tree scroll to current ID context menu, top bar Mar 3, 2025
Copy link
Contributor

github-actions bot commented Mar 3, 2025

Size Change: 0 B

Total Size: 9.73 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 9.73 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

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.

2 participants