feat(desktop): drag-and-drop for panes between tabs#859
Conversation
- Tabs show subtle bg-primary/5 highlight when dragging over - NewTabDropZone shows left indicator bar without layout shift
📝 WalkthroughWalkthroughAdds pane drag-and-drop across tabs: introduces a drag-pane Zustand store, a reusable NewTabDropZone, drop handling in GroupItem/GroupStrip, drag wiring in BasePaneWindow, and guards in tabs store and move-pane action to avoid unintended removals or duplicates. Changes
Sequence DiagramsequenceDiagram
participant User
participant BasePaneWindow
participant DragPaneStore
participant GroupItem
participant GroupStrip
participant TabsStore
User->>BasePaneWindow: drag start (onDragStart)
BasePaneWindow->>DragPaneStore: setDragging(paneId, sourceTabId)
DragPaneStore->>DragPaneStore: store draggingPaneId, draggingSourceTabId
User->>GroupItem: hover / enter
GroupItem->>DragPaneStore: read draggingPaneId & draggingSourceTabId
GroupItem->>GroupItem: canDrop? (not same, not duplicate, not last-in-tab)
Note over GroupItem: show highlight if droppable
User->>GroupItem: drop
alt canDrop true
GroupItem->>GroupStrip: onPaneDrop(paneId)
GroupStrip->>TabsStore: movePaneToTab(paneId, targetTabId) / movePaneToNewTab(paneId)
TabsStore->>TabsStore: check duplicate, update layouts, preserve panes that moved away
end
User->>BasePaneWindow: drag end (onDragEnd)
BasePaneWindow->>DragPaneStore: clearDragging()
DragPaneStore->>DragPaneStore: reset dragging state
Estimated Code Review Effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
Return { handled: true } from drop handlers to signal that the drop
was processed, preventing mosaic from also trying to handle the drop.
🧹 Preview Cleanup CompleteThe following preview resources have been cleaned up:
Thank you for your contribution! 🎉 |
Summary
drag-pane-storeto track which pane is being dragged (since MosaicDragItem only has mosaicId)Test plan
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.