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

Allow Unselecting Images from a Product #189

Closed
wants to merge 1 commit into from

Conversation

SyedImtiyaz-1
Copy link
Contributor

@SyedImtiyaz-1 SyedImtiyaz-1 commented Mar 2, 2025

📌 Description

This PR adds functionality to unselect images from a product without deleting them from the API.

🔧 Changes Made

  • Added an "Unselect Image" button below the product image.
  • Updated the UI to remove the image from the frontend when unselected.
  • Ensured proper event handling (onclick instead of on:click).
  • Improved UX by instantly reflecting changes in the UI.

🔗 Related Issue

📸 Preview

image

image

Let me know if any improvements are needed!

Copy link

vercel bot commented Mar 2, 2025

Someone is attempting to deploy a commit to the openfoodfacts Team on Vercel.

A member of the Team first needs to authorize it.

<!-- Unselect Image Button -->
<button
class="mt-2 rounded bg-orange-500 px-3 py-1 text-sm text-white transition hover:bg-red-600"
onclick={() => productStore.update((p) => ({ ...p, image_ingredients_url: '' }))}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephanegigandet is this the right way of deselecting an image? POSTing an empty url?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into it too.

@SyedImtiyaz-1
Copy link
Contributor Author

Video for Reference :

Screencast.from.02-03-25.10.34.14.PM.IST.webm

@VaiTon
Copy link
Member

VaiTon commented Mar 6, 2025

@SyedImtiyaz-1 I'm closing this for now. Feel free to reopen.

@VaiTon VaiTon closed this Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Allow unselecting images from a product
4 participants