-
-
Notifications
You must be signed in to change notification settings - Fork 486
fix: center profile image properly with object-center #2082
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
Conversation
Add object-cover and object-center classes to ensure profile images are properly centered within their container. This fixes the issue where uploaded profile images would appear slightly shifted to the right instead of being centered. Changes: - Add object-center class to Next.js Image in OptimizedAvatarImage - Add object-cover and object-center to AvatarImage component for consistency across all avatar usages Fixes lukevella#2014
|
@bimakw is attempting to deploy a commit to the rallly Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughTwo avatar components are updated to replace inline object-fit styling with Tailwind classes ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Repository UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (10)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{tsx,css,config.ts}📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.tsx📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{ts,tsx,json}📄 CodeRabbit inference engine (.cursorrules)
Files:
packages/ui/**/*.tsx📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*📄 CodeRabbit inference engine (.cursorrules)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
apps/web/src/components/**📄 CodeRabbit inference engine (CLAUDE.md)
Files:
apps/web/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (apps/web/.cursor/rules/better-auth.md)
Files:
🧠 Learnings (2)📚 Learning: 2025-11-25T11:03:55.173ZApplied to files:
📚 Learning: 2025-11-25T11:03:55.173ZApplied to files:
🔇 Additional comments (2)
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hi @bimakw, thanks for trying to fix this issue. Unfortunately your changes don't seem to address the issue which is that the original image is being cropped by a few pixels on the right and bottom sides. The issue will be in how we process the image rather than how it is presented. If you'd like to have another shot at this, I would suggest using this image to test the fix: |

Summary
object-coverandobject-centerclasses to ensure profile images are properly centered within their containerOptimizedAvatarImagecomponent (Next.js Image) andAvatarImagecomponent for consistencyProblem
After uploading and cropping an image that appears centered in the crop dialog, the final rendered image displays slightly shifted to the right instead of being centered.
Solution
The issue was that the image elements were missing explicit
object-position: centerCSS. Whileobject-fit: coverwas applied, the default object-position can vary across browsers. Addingobject-center(Tailwind class forobject-position: center) ensures consistent centering.Changes
apps/web/src/components/optimized-avatar-image.tsx: Replacestyle={{ objectFit: "cover" }}withclassName="object-cover object-center"packages/ui/src/avatar.tsx: Addobject-cover object-centerto AvatarImage componentTest Plan
Fixes #2014
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.