-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: add drag n drop functionality to section cards #17
feat: add drag n drop functionality to section cards #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steff456 Even though I like that the custom drag-n-drop implementation, we should probably use something like react-DnD
as the current implementation is bit confusing as their is no indication about the drop position and implementing it by hand will require a lot more effort and time. See this example, we want something similar. Also, after dropping an item it should not go back to its original position and wait for the API to complete, instead it should update the UI first and then update the backend via API and if for some reason the API call fails, we display an error message (which is already handled in exception handling).
I'm unsure if there's any preference on the style of the draggable objects, in the other front end they are using three dots so the users can understand they are able to drag and drop the cards.
We don't need to add the three dots as per the new design. The curson already updates as expected so we don't need any changes in UI.
The same question goes for the drag animation, right now it is using the default
We can keep the default animation for now from the example
98fdf30
to
8734daa
Compare
@navinkarkera I'll modify the implementation to use |
@navinkarkera I just updated to use Tomorrow I'll work on adding some tests :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steff456 Thanks, I just pushed a commit to fix multiple requests on hover issue.
I see ~43 new commits as you seem to have use merge commit instead of rebasing with the base branch. Can you try to create a new branch from the base and cherry pick your and my last commit to cleanup the commit history?
8734daa
to
61ff8f4
Compare
fed03f7
to
4bb85ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steff456 Almost there. We have one more issue where if you try to select text via dragging the mouse in title while editing it, it drags the whole section. Maybe this issue can help fixing it: react-dnd/react-dnd#335
@navinkarkera the last commit fixes the text editing issue. Please let me know if there's anything else this PR needs. |
a4eca74
to
934c59f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## navin/course-outline/section #17 +/- ##
===============================================================
Coverage ? 87.94%
===============================================================
Files ? 482
Lines ? 7542
Branches ? 1603
===============================================================
Hits ? 6633
Misses ? 880
Partials ? 29 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steff456 The functionality now works as expected. We have an issue in firefox where the text inside the form cannot be selected. We can address this in a separate ticket as HTML5 drag n drop has some issues with firefox. For now it looks good.
We should add some tests (probably in CourseOutline.test.jsx
) to test ordering when it runs successfully as well as when something goes wrong (restoreCallback).
61ff8f4
to
6567ed9
Compare
a638cac
to
3c5ce0d
Compare
@navinkarkera now we have tests for the endpoints, as well I rebased this PR with the changes you made recently in your base branch. Please let me know what else is needed for this PR to be ready! |
783d5f1
to
84cf96b
Compare
84cf96b
to
8b312e8
Compare
62d03c6
to
8ed080a
Compare
@navinkarkera I just updated this branch with the latest changes of the base branch. I had to do some modifications for the scroll to work with the drag and drop given that both were using Please let me know if there's anything else needed in this PR for merging! |
50cb3b8
to
8371ce1
Compare
@steff456 The scrolling was not working properly after deleting a section. Also it broke scrolling for subsections. I pushed a fix such that the page will only scroll if the element is not visible and it will align based on the position of the element in the screen. Now it works for both sections and subsections. I'll merge this now. Thanks for you work! |
Thanks for all the review @navinkarkera! 🎉 |
Resolves
private ref
: BB-8219This PR,
Demo
Grabacion.de.pantalla.desde.05-12-23.22.51.02.mp4
Depends on
Testing instructions
make cms-up
in devstack.Questions
drag
animation, right now it is using the default