MuckRock / documentcloud-frontend

DocumentCloud's front end source code - Please report bugs, issues and feature requests to info@documentcloud.org
https://www.documentcloud.org
GNU Affero General Public License v3.0
15 stars 5 forks source link

Support drag-n-drop upload in search view #518

Closed eyeseast closed 2 weeks ago

eyeseast commented 5 months ago

The current manager interface allows a user to start and upload by dragging a file into the search area. We should continue to let people do some version of this.

allanlasser commented 5 months ago

With the upload form on its own route, is there a way to pre-load it with files? The files variable is already exported/settable for testing purposes. Ideally, we could wrap the ResultsList in a Dropzone that routes to the upload form with the dropped files.

eyeseast commented 5 months ago

With the upload form on its own route, is there a way to pre-load it with files? The files variable is already exported/settable for testing purposes. Ideally, we could wrap the ResultsList in a Dropzone that routes to the upload form with the dropped files.

Good question. I bet there is a way, so long as we're client-side routing.

allanlasser commented 5 months ago

A little bit of research points to writable stores being a good way to pass data between routes, which makes sense!

  1. The Dropzone could add files to an DocumentUploadStore, then goto(/* uploads route*/)
  2. The DocumentUpload route could check the DocumentUploadStore, pop any contents out of it, and pass them as initializing props to the DocumentUploadForm.