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

Add initial drag n drop implementation (Wiki mode, local space) #889

Conversation

Komediruzecki
Copy link
Contributor

@Komediruzecki Komediruzecki commented Mar 25, 2021

Add initial drag n drop implementation (#860, #575, #690, #571)

Add folder drag and drop
Add note drag and drop
Add note and folder to workspace drag and drop
Add a note to a note drag and drop
Add rename folder error handling (same folder pathname exists)
Add drag leave for folder/workspace/note leave event (dragged over effect)

Demo:
https://user-images.githubusercontent.com/18196945/113562045-c344c900-9605-11eb-9049-c06940a33de3.mp4

Open Points:

  • Styling of dragged-over

Tested in

  • Local dev
  • Production AppImage (Linux)

Add folder drag and drop
Add note drag and drop
Add note and folder to workspace drag and drop
Add a note on a note drag and drop
Add rename folder error handling (same folder pathname exists)
Add drag leave for folder/workspace/note leave event (dragged over effect)
newFolderPathname
)
.then(() => {
// refresh works for file system (FSNote) database
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dunno why, looked over code from Pouch and FSNote, seems similar, update is done on storage level,
But notes are not seen after dragging the folder into another place (it refreshes the folder location but sub-folders and notes disappear from view in Pouch DB. After Ctrl+R - reload, they are correctly placed in the new destination place.

})
}

const handleDropNavigatorItem = (event: React.DragEvent) => {
Copy link
Contributor Author

@Komediruzecki Komediruzecki Mar 25, 2021

Choose a reason for hiding this comment

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

This code repeats in 3 places, but not sure how to refactor - should I send updateNote and renameFolder functions to a utility function, and then it can handle all details for all three usages (on note/folder/workspace drop)?

Another thing that comes to mind is to wrap the NavigatorItem component and use that everywhere. And in the wrapper provide all drag-drop functionality if parent enables it, in that way logic would be in Wrapper and those items folder/note/workspace can use the wrapper to add NavigatorItem with drag and drop?

@Komediruzecki Komediruzecki requested a review from Rokt33r March 25, 2021 21:45
@Komediruzecki Komediruzecki changed the title Add initial drag n drop implementation Add initial drag n drop implementation (Wiki mode, local space) Mar 25, 2021
@Komediruzecki Komediruzecki added the awaiting review ❇️ Pull request is awaiting a review. label Mar 26, 2021
@Komediruzecki Komediruzecki mentioned this pull request Apr 5, 2021
@Komediruzecki
Copy link
Contributor Author

Closing in favor of new sidebar with it's implementation already merged.

@ithinuel
Copy link

ithinuel commented Jun 4, 2021

@Komediruzecki For reference, do you have by any chance the PR number for that new sidebar impl ?

@Komediruzecki
Copy link
Contributor Author

Hi ithinuel,

Yes, but the PR is for whole local space refactor, it uses cloud/shared sidebar and implement local space needed setup for the shared component.

This one: #948

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review ❇️ Pull request is awaiting a review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants