Skip to content

feat: vendor LG drawer and toolbar COMPASS-9406 #7120

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

Merged
merged 7 commits into from
Jul 18, 2025

Conversation

paula-stacho
Copy link
Contributor

Description

As a temporary solution, until we can do the proper LG upgrade - vendoring LG Drawer and LG Toolbar (with style adjustments and tests removed).

Screenshot 2025-07-17 at 15 05 29

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 13:07
@paula-stacho paula-stacho requested a review from a team as a code owner July 17, 2025 13:07
@github-actions github-actions bot added the feat label Jul 17, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR vendors the LG Drawer and Toolbar components as a temporary solution until a proper LG upgrade can be performed. The main changes include adding vendored drawer and toolbar components to the compass-components package and updating the compass-data-modeling package to use the new DrawerLayout with toolbar functionality.

  • Adds vendored LG Drawer and Toolbar components with custom styling and architecture
  • Updates compass-data-modeling to use DrawerLayout instead of custom side panel implementation
  • Simplifies side panel component by removing state management and close functionality

Reviewed Changes

Copilot reviewed 58 out of 59 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/compass-data-modeling/src/components/diagram-editor-side-panel.tsx Simplified side panel component removing state management and close functionality
packages/compass-data-modeling/src/components/data-modeling.tsx Updated to use DrawerLayout with toolbar data for side panel functionality
packages/compass-components/src/components/leafygreen.tsx Added exports for new drawer components
packages/compass-components/src/components/drawer/* Added complete vendored drawer component system with layout, toolbar, and context management
packages/compass-components/src/components/toolbar/* Added complete vendored toolbar component system with icon buttons and context management
packages/compass-components/package.json Added new LG dependencies for descendants and lib utilities
Comments suppressed due to low confidence (1)

packages/compass-data-modeling/src/components/diagram-editor-side-panel.tsx:44

  • The function name was corrected from 'DiagmramEditorSidePanel' to 'DiagramEditorSidePanel' but the connect call still references the old misspelled name. This should be updated to match the corrected function name.
})(DiagramEditorSidePanel);

@paula-stacho paula-stacho added the feature flagged PRs labeled with this label will not be included in the release notes of the next release label Jul 17, 2025
Copy link
Member

@Anemy Anemy left a comment

Choose a reason for hiding this comment

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

Changes look good. It might be good to add a README or a comment disclaimer somewhere in the components we're adding to compass-components that these are the leafygreen components and to keep that in mind when we want to make changes. We want to avoid them diverging too much as that would make it harder to switch over down the line.
The Toolbar component sounds like a generic one that might get used in other places.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can I selfishly ask not to include these changes in this patch? 😅 I'm changing state quite some in the open PR for the data-modeling drawer state and don't want to deal with extra conflicts there. After we merge it, I can follow-up and add the drawer usage in the package

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can clean it up and just include the components changes

"@leafygreen-ui/emotion": "^4.0.9",
"@leafygreen-ui/guide-cue": "^7.0.2",
"@leafygreen-ui/hooks": "^8.3.4",
"@leafygreen-ui/icon": "^13.1.2",
"@leafygreen-ui/icon-button": "16.0.2",
"@leafygreen-ui/info-sprinkle": "^4.0.2",
"@leafygreen-ui/leafygreen-provider": "^4.0.2",
"@leafygreen-ui/lib": "^15.2.0",
Copy link
Collaborator

@gribnoysup gribnoysup Jul 18, 2025

Choose a reason for hiding this comment

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

We now have two versions of lib package in compass-components, 14 and 15. Is it required to pull this dependency here at this exact version? If not, it would be better if we can keep it aligned

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm, looking closer and I think it is already somewhat of an issue due to diagramming package pulling its own leafygreen deps (not only lib, but a bunch of others too):

└─┬ @mongodb-js/[email protected] -> ./packages/compass-data-modeling
  └─┬ @mongodb-js/[email protected]
    ├─┬ @leafygreen-ui/[email protected]
    │ ├─┬ @leafygreen-ui/[email protected]
    │ │ └── @leafygreen-ui/[email protected] deduped
    │ └── @leafygreen-ui/[email protected]
    └─┬ @leafygreen-ui/[email protected]
      └── @leafygreen-ui/[email protected] deduped

... so if it's easier to keep like that for your patch, that is fine. We might need to deal with this later though, but it can wait

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The vendored packages call it directly, v14 doesn't work for them. I'm hoping we'll do the proper upgrade soon, and for the direct dependency here we'll be reminded by depcheck to clean this up. If we really want to avoid this I think we'd just need to avoid all the new lg-id bits.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Got it, that's fair, yeah

Copy link
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

One note on including leafygreen-lib in direct deps of compass-components, otherwise looks good.

Also as I mentioned, if this makes sense to you, do you mind not including changes to the data-modeling package in this patch? I think it might be easier to adjust the data-modeling package after both of our changes land (or if this patch lands first, I can just update it in my PR)

@paula-stacho paula-stacho merged commit e3c4ddf into main Jul 18, 2025
59 checks passed
@paula-stacho paula-stacho deleted the COMPASS-9496-vendoring-drawer-and-toolbar branch July 18, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat feature flagged PRs labeled with this label will not be included in the release notes of the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants