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

Fixed dragging with empty orphan favorites #9205

Merged
merged 2 commits into from
Dec 23, 2024
Merged

Conversation

lucasbordeau
Copy link
Contributor

Created a resizable container tied to dragging state to create suitable droppable zone when there's no orphan favorites.

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 improves drag-and-drop functionality for favorites by implementing dynamic container sizing and removing fixed margins that were causing positioning issues.

  • Removed hardcoded 15px margin in /packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberFavorites.tsx that was causing drop area overlap
  • Added dynamic height (24px/1px) for empty orphan favorites container in /packages/twenty-front/src/modules/favorites/components/CurrentWorkspaceMemberOrphanFavorites.tsx to create proper droppable zones
  • Replaced theme-based spacing with state-based container sizing for better drag-and-drop accuracy

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 161 to 162
// TODO: (Drag Drop Bug) Adding bottom margin to ensure drag-to-last-position works. Need to find better solution that doesn't affect spacing.
// Issue: Without margin, dragging to last position triggers next folder drop area
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 TODO comment is now outdated since the margin-based workaround has been removed. Either update or remove this comment to reflect the new solution.

@@ -67,7 +66,7 @@ export const CurrentWorkspaceMemberOrphanFavorites = () => {
/>
))
) : (
<StyledEmptyContainer />
<StyledEmptyContainer style={{ height: isDragging ? '24px' : '1px' }} />
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using theme.spacing(3) instead of hardcoded '24px' to maintain consistency with the design system

@@ -67,7 +66,7 @@ export const CurrentWorkspaceMemberOrphanFavorites = () => {
/>
))
) : (
<StyledEmptyContainer />
<StyledEmptyContainer style={{ height: isDragging ? '24px' : '1px' }} />
Copy link
Contributor

Choose a reason for hiding this comment

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

style: 1px height might cause layout shift when transitioning to drag state - consider using 0 instead

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

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

LGTM

@Weiko Weiko merged commit 74cf00a into main Dec 23, 2024
18 checks passed
@Weiko Weiko deleted the fix/favorite-margin-bottom branch December 23, 2024 14:57
samyakpiya pushed a commit to samyakpiya/twenty that referenced this pull request Dec 28, 2024
Created a resizable container tied to dragging state to create suitable
droppable zone when there's no orphan favorites.

Co-authored-by: Weiko <[email protected]>
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