draft PR: Image Upload Support for Inventory Items #18#132
Draft
BikramMondal5 wants to merge 1 commit into
Draft
draft PR: Image Upload Support for Inventory Items #18#132BikramMondal5 wants to merge 1 commit into
BikramMondal5 wants to merge 1 commit into
Conversation
|
@BikramMondal5 is attempting to deploy a commit to the participationcorner2025-8967's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 SummaryThe provided pull request diff introduces a new feature for uploading and displaying item images in the inventory management system. It includes changes to the 📂 Files Changed
🎭 Code PoemImages uploaded with care, 🚨 Bugs & Architectural ViolationsThe provided diff does not appear to introduce any critical bugs or architectural violations. However, it's essential to review the code thoroughly to ensure that it adheres to the project's coding standards and best practices. One potential issue is the use of `URL.createObjectURL` to create a local preview of the uploaded image. This may cause memory leaks if not properly cleaned up. It's recommended to use `URL.revokeObjectURL` to release the object URL when it's no longer needed.💡 Suggestions & Best PracticesTo improve the code, consider the following suggestions: * Use a more robust error handling mechanism in the `handleImageSelect` function to handle potential errors during the image upload process. * Add accessibility attributes to the image upload button and the thumbnail container to improve the component's accessibility. * Consider using a library like `react-dropzone` to handle file uploads and provide a more seamless user experience. * Use a consistent naming convention throughout the codebase to improve readability and maintainability. * Add comments and documentation to the code to explain the purpose and functionality of each component and function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements image upload support for inventory items, allowing resellers to attach a photo of the item itself or a purchase receipt directly from the Add/Edit Item modal.
What it does:
POST /api/inventory/upload-imageserver action that accepts a multipart image, validates it (type + 5 MB size limit), uploads it to a Supabase Storage bucket (inventory-images) scoped per user (userId/timestamp.ext), and returns the public URL.Uploading…/Uploadedand a remove button lets the user clear the image before submitting.<input type="hidden" name="imageUrl">field and persisted by the Prismacreateandupdateaction handlers ininventory-management.tsx.20260708000048_add_image_url_to_inventory_item) that safely adds theimageUrl TEXTcolumn viaADD COLUMN IF NOT EXISTS— a no-op if the column already exists from the initial migration.Why it's needed:
Resellers frequently need to document items with photos for tax purposes, insurance, and easier identification. Without this, the inventory log is text-only, which is a common pain point.
Related Issues
#18
Type of Change
Checklist
var(--color-*)tokens,~/import alias, TypeScript, noanyoutside of existing patterns)Screenshots (if applicable)
NA
Additional Notes
This is a Draft PR opened to show my progress as requested.
The implementation is complete on the code side, but one manual setup step is required on the Supabase project before this can be tested end-to-end.
Once you review the code and create the
inventory-imagesbucket in supabase, I can proceed for the next step.