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

Tweak file upload layout, add filepond-plugin-media-preview, add disable preview option #1626

Merged
merged 15 commits into from
Feb 24, 2022
Merged

Tweak file upload layout, add filepond-plugin-media-preview, add disable preview option #1626

merged 15 commits into from
Feb 24, 2022

Conversation

jacksleight
Copy link
Contributor

@jacksleight jacksleight commented Feb 15, 2022

This PR makes some minor tweaks to the compact file upload layout, so that it fits nicely with the other fields and is actually a bit more compact. Changes are:

  • The min-height on the drop area element has been tweaked so it that it's the same height as the uploading/file element, removing the dead space below the field when a value is set
  • The padding on the uploading/file element has been tweaked so it renders at exactly 42px high, the same height as Filament single line fields
  • The drop area label text size has been reduced slightly, so it will fit at smaller widths
  • The dark mode background on the drop area element has been removed, as it covers the border and the root element already has the right background colour

This PR also adds a disablePreview() method, to switch off the image preview feature.

These changes allow for a very compact and consistently sized single file upload field that fits alongside other fields.

Before:

Screenshot 2022-02-15 at 15 47 57

After:

Screenshot 2022-02-15 at 15 49 37

Blank values:

Screenshot 2022-02-16 at 09 46 48

Also includes filepond-plugin-media-preview feature from #1643

@jacksleight jacksleight marked this pull request as draft February 16, 2022 08:42
@jacksleight jacksleight marked this pull request as ready for review February 16, 2022 09:49
@danharrin
Copy link
Member

I think I actually prefer compact as a default. What does it look like with the image preview?

@jacksleight
Copy link
Contributor Author

jacksleight commented Feb 16, 2022

Yeah me too. With preview:

Screenshot 2022-02-16 at 12 23 19

And multiple files (without preview):

Screenshot 2022-02-16 at 12 23 58

Wondering if a line between the multiple items might be good idea as well?

@danharrin
Copy link
Member

Yeah, multi file spacing is a must. Then, we can use a compact layout by default :)

Make sure that the ->avatar() layout isnt broken by any of this, btw.

@jacksleight
Copy link
Contributor Author

Added some spacing:

Screenshot 2022-02-16 at 12 54 22

At the moment these changes have no impact on the avatar() layout, as that uses compact circle and the styles target compact only.

Screenshot 2022-02-16 at 13 02 58

The only thing I've (just) done is set the initial min-height correctly on an avatar upload, so that doesn't cause a height change when FilePond loads.

@jacksleight jacksleight marked this pull request as draft February 17, 2022 12:22
@jacksleight jacksleight changed the title Tweak compact file upload layout, add disable preview option Tweak file upload layout, add filepond-plugin-media-preview, add disable preview option Feb 17, 2022
@jacksleight
Copy link
Contributor Author

jacksleight commented Feb 17, 2022

@danharrin @saade

One hiccup. Despite the allowVideoPreview and allowAudioPreview options existing in filepond-plugin-media-preview:

https://github.com/nielsboogaard/filepond-plugin-media-preview/blob/db25fa6ea9424a1d4679f311dbd0904f1228ed95/src/js/index.js#L59

It doesn't look like they're actually implemented (as far as I can see).

Not sure if there's another way we can disable the plugin or if we'd need to wait for filepond-plugin-media-preview to fix it?

@jacksleight jacksleight marked this pull request as ready for review February 17, 2022 12:45
@saade
Copy link
Member

saade commented Feb 17, 2022

@danharrin @saade

One hiccup. Despite the allowVideoPreview and allowAudioPreview options existing in filepond-plugin-media-preview:

https://github.com/nielsboogaard/filepond-plugin-media-preview/blob/db25fa6ea9424a1d4679f311dbd0904f1228ed95/src/js/index.js#L59

It doesn't look like they're actually implemented (as far as I can see).

Not sure if there's another way we can disable the plugin or if we'd need to wait for filepond-plugin-media-preview to fix it?

idk if @nielsboogaard will ever implement this. although the repo had an update 5 days ago, npm does not received a new version since June 2021. Me and @danharrin talked about forking this and maintain it ourselves. If thats ok, i can fork and make the chages, or feel free if you want to

@jacksleight
Copy link
Contributor Author

Yeah it doesn't look like it's that frequently updated. If you can fork it and implement those options that'd be great!

@nielsboogaard
Copy link

nielsboogaard commented Feb 17, 2022

Hey guys, thanks for mentioning me. Could you elaborate a bit more about what needs to be implemented in the media preview plugin?

@saade
Copy link
Member

saade commented Feb 17, 2022

Hey guys, thanks for mentioning me. Could you elaborate a bit more about what needs to be implemented in the media preview plugin?

Hey! Nice to see you!

We need allowVideoPreview and allowAudioPreview to be configurable, it doesn't seem to have effect right now.
Also, this nielsboogaard/filepond-plugin-media-preview/pull/14 looks like a good thing to have, since we always want to offer customizability for people using filament

@saade
Copy link
Member

saade commented Feb 17, 2022

also, @nielsboogaard all of your filepond plugins seems to fit very nice with filament, but we also need the security patches at least :)

@nielsboogaard
Copy link

Clear. Will have a look this afternoon at the mentioned configuration options. Will also create a release soonish containing the security fixes.

@saade
Copy link
Member

saade commented Feb 18, 2022

Clear. Will have a look this afternoon at the mentioned configuration options. Will also create a release soonish containing the security fixes.

Thank you!

@nielsboogaard
Copy link

Configuration options are taken into account now, and all dependencies are bumped to latest version. See https://github.com/nielsboogaard/filepond-plugin-media-preview, if you use latest version 1.0.11 you should be good to go.

@jacksleight
Copy link
Contributor Author

Brilliant. Can confirm Filament's disablePreview() option is now working with video and audio files.

Thanks Niels!

@jacksleight
Copy link
Contributor Author

Should I set the default FileUpload layout to compact now? I think that's the last thing outstanding...

@saade
Copy link
Member

saade commented Feb 21, 2022

I think so

@saade
Copy link
Member

saade commented Feb 21, 2022

@danharrin can we get this merged? Really needing this 😛

@danharrin danharrin added enhancement New feature or request ui labels Feb 24, 2022
@danharrin
Copy link
Member

Perfect! Thank you so much.

@danharrin danharrin merged commit bf719a3 into filamentphp:2.x Feb 24, 2022
@jacksleight jacksleight deleted the file-upload-tweaks branch March 3, 2022 14:27
@robertorinaldi-dev
Copy link
Contributor

Added some spacing:

Screenshot 2022-02-16 at 12 54 22

At the moment these changes have no impact on the avatar() layout, as that uses compact circle and the styles target compact only.

Screenshot 2022-02-16 at 13 02 58

The only thing I've (just) done is set the initial min-height correctly on an avatar upload, so that doesn't cause a height change when FilePond loads.

The spacing seems to work only with 2 files, not more

@jacksleight
Copy link
Contributor Author

@robertorinaldi-dev Thanks, have submitted a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants