feat(image-upload): add button to clear uploaded image - #1725
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR adds a clear-image button to the ImageUpload component, including an onClearClick handler, Cross2Icon import, and new CSS classes for an avatar wrapper and corner button. It also updates the organization edit form to include an avatar default value. ChangesImage Upload Clear Action and Avatar Default
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 73877f1a-7a20-49b8-a993-6b593a2b9d63
📒 Files selected for processing (3)
web/sdk/admin/views/organizations/details/edit/organization.tsxweb/sdk/client/components/image-upload/image-upload.module.cssweb/sdk/client/components/image-upload/image-upload.tsx
Coverage Report for CI Build 28511703765Coverage remained the same at 44.02%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Summary
Adds a "clear" affordance to the shared
ImageUploadcomponent so users can remove a previously uploaded image (e.g. an organization logo), which was previously impossible once an image was set. Also wires the organizationavatarfield into the edit form's default values so then current logo renders and can be cleared/edited correctly.Changes
image-upload.tsx: Added a small corner "clear" button (Cross2Icon) that appears over the avatar when a value is present and the field is enabled. Clicking it callsonChange('')to clear the image. Wrapped the uploadIconButtonin a positionedavatarWrapperso the corner button can be anchored to it.image-upload.module.css: Added.avatarWrapper(relative, inline-flex positioning context) and.cornerButton(absolutely positioned top-right badge styling) styles.organization.tsx: Addedavatar: organization?.avatar || ""togetDefaultValue()so the existing org logo populates the edit form's default values.Technical Details
!disabled && value— an empty field just shows the upload icon, and disabled fields can't be cleared.onClearClickemits an empty string through the existingonChangehandler rather than introducing a separate callback. This keeps the component's API unchanged for consumers..cornerButtonuses design-system tokens (--rs-color-*,--rs-radius-full,--rs-shadow-sm) for consistency with the rest of the SDK.Test Plan
SQL Safety (if your PR touches
*_repository.goorgoqu.*)N/A