ipfs-shipyard / ipfs-share-files

Share files via IPFS
https://share.ipfs.io
MIT License
148 stars 31 forks source link

feat: add drag-n-drop to the add files box #100

Closed rafaelramalho19 closed 3 years ago

rafaelramalho19 commented 3 years ago

closes #83

terichadbourne commented 3 years ago

@jessicaschilling @lidel The drag and drop is now ready for proofing! Thanks to @rafaelramalho19 for the pairing!

terichadbourne commented 3 years ago

This looks and feels absolutely gorgeous, but is there any way we can keep the user from dragging a directory? See screenshot - video here is actually a directory, and the result is something that's greyed out but also displays a click hand on hover.

Nice catch, @jessicaschilling! I don't know off hand whether this is about a limitation of IPFS Share, a limitation of the react-dnd package, or just a failure to hook up a setting correctly so our code knows whether it's receiving a file or a directory. @rafaelramalho19 & @lidel is it obvious to either of you at first glance?

Made myself a note to demo with a single file! :)

terichadbourne commented 3 years ago

Perhaps we went astray be using doAddFiles directly instead of onAddFiles or onAddFolder? But those are definied in a different file (add-files/AddFiles.js) and we'd need to sort out the logic of which to use?

export const AddFiles = ({ t, doAddFiles }) => {
  const onAddFiles = (ev) => {
    const filesList = parseFiles(ev)
    doAddFiles(filesList)
  }

  const onAddFolder = (ev) => {
    const filesList = parseFiles(ev).filter(({ name }) => !IGNORED_FILES.includes(name))
    doAddFiles(filesList)
  }