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

Improve visual editor UX #466

Merged
merged 68 commits into from
Jul 6, 2022
Merged

Improve visual editor UX #466

merged 68 commits into from
Jul 6, 2022

Conversation

apedroferreira
Copy link
Member

@apedroferreira apedroferreira commented May 26, 2022

https://www.notion.so/mui-org/App-Editor-Enhancements-070bf8ba0e2145a2aaaf50d67a24983e

Related to #101

This is an improvement proposal for our drag & drop. It may not be perfect yet but I feel like it's an improvement and a step in the right direction.
There might still be uncaught bugs or small UX issues, but overall seems fine from what has been tested. The rest can be fixed and improved after receiving feedback.

Refactored drag & drop with several features:

  • replace old slots system with "quadrants" over every element to determine where the new element will be placed. A center area in container elements is also accounted for besides top, right, bottom and left.
  • remove ability to add row and columns - those are automatically created and can only be placed at the top level (can be changed, it's just a proposal to experiment with)
  • restored some of the previous defaults for page rows and columns, since I felt like I should not have changed them in previous PRs

Video example:

Screen.Recording.2022-06-08.at.18.33.12.mov

@Janpot I tried to be careful but let me know if I deleted something I shouldn't, or if some of the new utility methods I created would be better in some other place.

@render
Copy link

render bot commented May 26, 2022

@oliviertassinari oliviertassinari temporarily deployed to drag-and-drop-quadrants - toolpad-db PR #466 May 26, 2022 16:14 — with Render Destroyed
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged and removed PR: out-of-date The pull request has merge conflicts and can't be merged labels May 27, 2022
@render
Copy link

render bot commented May 31, 2022

@oliviertassinari oliviertassinari temporarily deployed to drag-and-drop-quadrants - toolpad-db PR #466 May 31, 2022 11:18 — with Render Destroyed
@apedroferreira apedroferreira force-pushed the drag-and-drop-quadrants branch 3 times, most recently from 9512ff1 to bb5242c Compare June 6, 2022 19:10
@apedroferreira apedroferreira marked this pull request as ready for review June 6, 2022 19:34
@apedroferreira apedroferreira changed the title [WIP] Drag & drop refactor Drag & drop refactor Jun 6, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 8, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 8, 2022
@apedroferreira
Copy link
Member Author

@Janpot I've made all the changes and added all the fixes we talked about yesterday, hopefully it's better now.
The next step would be implicit element containers that take up all remaining space in a row, but that will be a separate PR.

@apedroferreira apedroferreira force-pushed the drag-and-drop-quadrants branch 2 times, most recently from 9e30a6c to 066cf6c Compare June 8, 2022 18:04
@Janpot
Copy link
Member

Janpot commented Jun 8, 2022

The space between two elements is not behaving the best

Screen.Recording.2022-06-08.at.20.12.51.mov

@apedroferreira
Copy link
Member Author

apedroferreira commented Jun 8, 2022

The space between two elements is not behaving the best

Screen.Recording.2022-06-08.at.20.12.51.mov

i see what happened there, you dragged to the space between two elements which means you were hovering over the parent, and you dropped the new element in the parent, which adds an element as the last element in the parent...

i can try to handle situations like this but will have to change to logic to somehow not consider exactly the element you're hovering over - and be able to see which elements are close to the cursor in some way

@apedroferreira
Copy link
Member Author

apedroferreira commented Jun 8, 2022

The space between two elements is not behaving the best
Screen.Recording.2022-06-08.at.20.12.51.mov

i see what happened there, you dragged to the space between two elements which means you were hovering over the parent, and you dropped the new element in the parent, which adds an element as the last element in the parent...

i can try to handle situations like this but will have to change to logic to somehow not consider exactly the element you're hovering over - and be able to see which elements are close to the cursor in some way

i guess i can create some kind of subsystem inside containers that works like the slots that were implemented previously

@Janpot
Copy link
Member

Janpot commented Jun 9, 2022

I think a misconception that this implementation makes is that slots go on the edges of the components. Components are laid out in a structure that can have a configurable gap. If the slot goes on the edge, that makes it so there are two slots in between two consecutive children.

I think a better mental model would be that the layout components (rows, columns) divide the page in rectangles that the user components (button, input, table,...) occupy. Insert slots appear on the edges of these rectangles. For the drag&drop algorithm, these rectangles don't have spacing, the spacing only applies to the components that occupy the grid.

@apedroferreira
Copy link
Member Author

@Janpot this might be mergeable now, i thing the UX is feeling alright in general, lmk if you find any more issues!
i've seen just a few minor issues in some rare cases, i can handle those later along with everyone's feedback

@prakhargupta1
Copy link
Member

When dropping a component, the default alignment on the left felt better than the central alignment.
It could be a personal choice also I don't know how much rework would it require, so just sharing my view.

@apedroferreira
Copy link
Member Author

When dropping a component, the default alignment on the left felt better than the central alignment. It could be a personal choice also I don't know how much rework would it require, so just sharing my view.

it's an easy change, we just need to decide if we want this current behavior or if we want new elements to take up the minimum width possible. this current approach is similar to Makeswift.
another option would be to re-enable the Stack component and it could be used to put elements close together in a row or column.

@Janpot Janpot changed the title Drag & drop refactor Improve visual editor UX Jul 6, 2022
Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

👍 Great work! Let's merge this and continue polishing in follow-up PRs

@apedroferreira apedroferreira merged commit 7622368 into master Jul 6, 2022
@apedroferreira apedroferreira deleted the drag-and-drop-quadrants branch July 6, 2022 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants