-
Notifications
You must be signed in to change notification settings - Fork 32
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 'n drop #551
Drag 'n drop #551
Conversation
This works now, some pain points:
Test on:
|
5d7b197
to
ec861ad
Compare
ok so I think that broke uploading when it should work (when using drag & drop) |
ec861ad
to
c28c79a
Compare
oh right, tests won't work because I made some local changes to
|
c4f07aa
to
bdd3e34
Compare
This enables to simulate drag events and allows to test drag&drop file upload in c-files in cockpit-project/cockpit-files#551
This enables to simulate drag events and allows to test drag&drop file upload in c-files in cockpit-project/cockpit-files#551
@garrett I think we can now start talking about how to show that files can be dropped for upload. Right now I have this: Take it as a concept screenshot, I needed something that "works" and is not a The upload icon appears when user is dragging some file over the files card. Maybe it should instead work on the whole page. |
222e2b8
to
b946f6c
Compare
So this is a quick attempt to mock up something. Notes:
I'll probably need to help with the CSS. Source: drop-file-to-upload.svg WDYT? |
I think that looks good, I like it! Thanks for the mockup |
be2b62d
to
655dea1
Compare
I'm afraid this is not possible, the |
6a0cd5e
to
2bdcbf1
Compare
I would also suggest showing that you can't drop a file when an upload is in progress, to show a different backdrop which explains an upload is in progress. |
Or we can not block the dropzone/upload button when there is another upload in progress EDIT: |
aa8e935
to
a06532e
Compare
a6ddbf5
to
9c1e070
Compare
9c1e070
to
c1a873b
Compare
|
||
export const UploadContext = createContext({ | ||
uploadedFiles: {}, | ||
setUploadedFiles: () => console.warn("UploadContext not initialized!"), |
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.
This added line is not executed by any test.
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.
Looks good, thanks! 🚀
@tomasmatus interested?
One tricky thing here is we already have an upload-button component, so the eventlistener should be set up there instead so we don't have to pass
files
around.Drag-and-Drop file upload
It is now possible to upload files by simply dragging them from your desktop or a file explorer and dropping them directly into Cockpit Files.