asimons04 / tesseract

GNU Affero General Public License v3.0
26 stars 6 forks source link

Instance banner image in sidebar is stretched disproportionately #3

Closed weiteck closed 6 months ago

weiteck commented 6 months ago

What version of Tesseract has this bug? v1.2.9.31

Describe the bug Instance banner images are stretched disproportionately to fill the card.

To Reproduce Steps to reproduce the behavior:

  1. Deploy from main and view sidebar

Expected behavior Banner should not be distorted.

Screenshots Banner is stretched: banner_current

Banner should be centered and sized to fit, IMO: banner_proposed

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context I have edited src/lib/components/ui/Card.svelte to change the behaviour for my deployment at tes.leminal.space.

asimons04 commented 6 months ago

The stretching was a compromise to make it work the most compatibly. I agree it's not ideal.

Unfortunately, there's no standardized size for banners, so I had to pick the method that looked least worst for the most number of banners in the wild (I point my dev version to random instances to see how various banners fit).

Changing to background-size: cover, for example, looks good with, say, 70% of banners in use but then 30% just look worse than if they were stretched.

To be honest, adding the semi-transparent banners to the card was more to add some contrast/flair than to show off the banners properly.

I may be able to add an environment variable and user setting that could allow the admin to switch between "stretch" and "cover" modes. The environment variable would set the default behavior and the user option would allow users to change it from the UI.

asimons04 commented 6 months ago

So yeah, this works for me if it works for you. It should cover most use cases, though admins may need to set the default "stretch" behavior depending on how well their chosen banner image renders.

I have this implemented in 1.3.0 (not sure if I want to backport it to 1.2.9.x since I'm only doing bugfixes on that).

Changes:

Default (Not stretched - env var is not set one way or another)

image

App Setting to Control Stretch/Auto Behavior

image

Stretch Banner option toggled to 'on'

image

weiteck commented 6 months ago

Thanks for looking at this. I think having it optional is a good enhancement given the variety of banner sizes out there.

asimons04 commented 6 months ago

Sounds good. This is implemented in the current nightly branch of 1.3.0. Don't think I'm going to backport it since it's an enhancement rather than a bugfix.