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

Drag and Drop Files into Folder #1417

Open
alexapostolu opened this issue May 5, 2020 · 11 comments · May be fixed by #3008
Open

Drag and Drop Files into Folder #1417

alexapostolu opened this issue May 5, 2020 · 11 comments · May be fixed by #3008

Comments

@alexapostolu
Copy link

Nature of issue?

  • New feature request

New feature details:

So I noticed how when you create a folder in p5.js, you can't drag and drop existing files into that folder. Instead you have to manually import files into that specific folder. So I'm wondering, could it be a possibility that you could drag and drop existing files into a folder? Thanks

@welcome
Copy link

welcome bot commented May 5, 2020

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

@catarak
Copy link
Member

catarak commented May 6, 2020

Thanks for the feature suggestion! Related to #704. This would be super, super useful. Another related suggestion is allowing file renaming with slashes (#765). All slightly different features though!

I think this is a great idea. I also wonder how this would work, from a UI/UX perspective, to also support #375.

@SundeepChand
Copy link
Contributor

SundeepChand commented Oct 14, 2020

@catarak I would like to look give it a try. Can you please tell me the files, that I need to look at to get started?

@catarak
Copy link
Member

catarak commented Oct 14, 2020

@SundeepChand sure! I would take a look at FileUploader.jsx and also Sidebar.jsx.

@ron-debajyoti
Copy link

@SundeepChand if u aren't working on it I would like to give it a try.

@SundeepChand
Copy link
Contributor

Sure @ron-debajyoti, you can work on this.

@ron-debajyoti
Copy link

@catarak Hi ! Sorry for being late, I was having some difficulties going through the code. A feature suggestion from me would be a proper documentation for developers (esp for newbies like me), and perhaps using Docusaurus.

Regarding the drag and drop utility in the Sketch files area of the web editor, I think it's becoming a bit complicated because the current implementation of adding new files under a folder relies on using buttons that have the hooks to the state update for example here. So it becomes easy for dropzone to complete all the callbacks required (like it's used in FileUploader like here.
If we extend the dropzone to sketch area for the drag and drop feature, then maintaining the parentId without using the hooks is a bit difficult to implement. Also, in case we have multiple empty folders, maintaining the parent folder for a bunch of files uploaded is difficult too..

@catarak I would appreciate your views and suggestions regarding this problem.

@ron-debajyoti
Copy link

ron-debajyoti commented Mar 3, 2021

@catarak I did a temporary fix to the issue for now. I added a dropzone to the bottom of Sketch Files list and added the feature of directly uploading one or multiple files to the project. If we want to add multiple files to a particular folder to the project, then selecting the folder first and then uploading the files in the dropzone automatically uploads the files in the correct place.

Although this fix technically doesn't allow us to rearrange the files within the Sketch Files list, we don't have to manually create and upload files to the project. Please provide some feedback regarding this.

I'll try to add a PR and try to solve related issues like #765 in this PR itself.

Demo video:

demo1.mp4

@mhsh312
Copy link
Contributor

mhsh312 commented Jan 30, 2024

The way I understand this is that the currently the Sidebar.jsx component has a bunch of FileNode.jsx components that reflect the current file-and-folder hierarchy of the project. To implement this feature, we need to make the FileNode.jsx components draggable and then reflect the changes to the project instance in the database.

For the drag and drop, React DnD seems like the way to go.

I would like to work on this issue so please assign it to me if it is still active. @lindapaiste @raclim

@lindapaiste
Copy link
Collaborator

The way I understand this is that the currently the Sidebar.jsx component has a bunch of FileNode.jsx components that reflect the current file-and-folder hierarchy of the project. To implement this feature, we need to make the FileNode.jsx components draggable and then reflect the changes to the project instance in the database.

For the drag and drop, React DnD seems like the way to go.

I would like to work on this issue so please assign it to me if it is still active. @lindapaiste @raclim

Yes that sounds good. There is the UI portion, which is handling the drag action and using it to initiate moving the file. Then there's the Redux portion where we need to move the file to have a different parent. We actually don't have support for that right now. I can help you with the Redux part because the files reducer is a mess. You should focus on the UI, and triggering the right action at the right time.

@mhsh312
Copy link
Contributor

mhsh312 commented Feb 5, 2024

There is the UI portion, which is handling the drag action and using it to initiate moving the file.

Alright, I will start creating the UI using React DnD.

I can help you with the Redux part because the files reducer is a mess.

After I'm done with the UI, I'll look into the files reducer and see if I can work on it. If I can't, I will submit the UI section in a PR and leave Redux to you.

@mhsh312 mhsh312 linked a pull request Feb 8, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants