Skip to content

fix: improve AvatarModal responsiveness for mobile screens#341

Open
ProthamD wants to merge 1 commit intoAOSSIE-Org:mainfrom
ProthamD:fix/avatar-modal-responsiveness
Open

fix: improve AvatarModal responsiveness for mobile screens#341
ProthamD wants to merge 1 commit intoAOSSIE-Org:mainfrom
ProthamD:fix/avatar-modal-responsiveness

Conversation

@ProthamD
Copy link
Copy Markdown
Contributor

@ProthamD ProthamD commented Mar 4, 2026

fixes #275

fix: improve AvatarModal responsiveness for mobile screens

The AvatarModal component used fixed pixel sizes and static grid layouts that caused overflow and clipping on small/mobile screens. This PR replaces all fixed sizing with responsive Tailwind classes so the modal renders correctly across all viewport widths.

Problem

  • Avatar preview image was a fixed w-32 h-32 — too large on small screens
  • Option grids (grid-cols-5) with fixed w-16 h-16 buttons overflowed on narrow viewports
  • Modal padding was fixed (px-6 pb-6) with no mobile adjustment
  • Redundant ml-6 margin pushed content off-screen on small devices

Changes

Element Before After
Modal padding px-6 pb-6 px-3 sm:px-6 pb-3 sm:pb-6
Avatar preview w-32 h-32 w-20 h-20 sm:w-32 sm:h-32
Color/style grid grid-cols-5 grid-cols-4 sm:grid-cols-5
Color/style buttons w-16 h-16 w-12 h-12 sm:w-16 sm:h-16
Accessory grid grid-cols-5 grid-cols-4 sm:grid-cols-5
Accessory buttons w-16 h-16 w-12 h-12 sm:w-16 sm:h-16
Shape/background grid grid-cols-5 grid-cols-3 sm:grid-cols-5
Shape/background buttons w-16 h-16 w-12 h-12 sm:w-16 sm:h-16
Section margin ml-6 removed

Testing

Verified layout at 320 px, 375 px, and 768 px+ viewports — no overflow, clipping, or misaligned elements observed.

Related

Fixes avatar rendering responsiveness on the Profile page (visible in the screenshot attached to the issue).

Summary by CodeRabbit

Release Notes

  • Style
    • Improved responsive design for the avatar customization modal with optimized layout on mobile and desktop devices
    • Enhanced spacing and padding for better visual presentation across different screen sizes
    • Adjusted sizing and grid organization for improved visual hierarchy and usability

ai usage: I didn't use any kind of ai for code generation

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 4, 2026

📝 Walkthrough

Walkthrough

The Avatar Modal component was refactored to improve mobile responsiveness. Horizontal padding was reduced on smaller screens, grid layouts adjusted from fixed 5-column to responsive 4-column baseline with 5 columns on larger screens, button sizes adapted for screen sizes, and margins reorganized for consistent vertical stacking across all avatar customization sections.

Changes

Cohort / File(s) Summary
Avatar Modal Responsiveness
frontend/src/components/AvatarModal.tsx
Implemented responsive design: reduced modal container padding on mobile (px-3 with sm:px-6), increased avatar image sizes on larger screens (sm:w-32/sm:h-32), adjusted grid layouts to 4-column baseline with 5 columns on small+ screens (grid-cols-4 sm:grid-cols-5), resized seed option buttons for mobile (w-12/h-12 expanding to sm:w-16/sm:h-16), and standardized spacing with vertical stacking and consistent top margins (mt-6) across all style option sections.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A modal so narrow, now stretches just right,
Grid columns dancing from mobile to light,
Padding and buttons in harmony blend,
Responsive design—the responsive trend!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: improving AvatarModal responsiveness for mobile screens, which aligns with the core objective of fixing UI overflow issues on small screens.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #275: responsive grid layouts, adjusted button sizes, reduced padding on mobile, and removal of redundant margins across all affected avatar option sections.
Out of Scope Changes check ✅ Passed All changes are directly related to improving AvatarModal responsiveness on mobile screens; no unrelated modifications to other components or functionality were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
frontend/src/components/AvatarModal.tsx (2)

443-443: Consider 3-column layout for smallest screens per issue #275.

The linked issue suggests grid-cols-3 sm:grid-cols-4 md:grid-cols-5 for optimal touch targets. The current grid-cols-4 sm:grid-cols-5 works but may feel cramped at 320px. If testing confirmed usability at that width, this is fine—otherwise consider aligning with the issue's recommendation.

♻️ Optional: Align with issue recommendations
-          <div className='grid grid-cols-4 sm:grid-cols-5 gap-2 sm:gap-4 mt-2'>
+          <div className='grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 gap-2 sm:gap-4 mt-2'>

Apply similar changes to all other grids (background color, ear, eyes, cheek, face, front hair, hair, mouth, sideburn, skin color).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/AvatarModal.tsx` at line 443, Update the avatar
option grids to use a 3-column layout on the smallest screens by replacing
instances of "grid-cols-4 sm:grid-cols-5" with "grid-cols-3 sm:grid-cols-4
md:grid-cols-5" (start with the div in AvatarModal.tsx that currently has
className 'grid grid-cols-4 sm:grid-cols-5 gap-2 sm:gap-4 mt-2'). Also apply the
same class change to the other avatar option grid containers (background color,
ear, eyes, cheek, face, front hair, hair, mouth, sideburn, skin color) so all
option grids match the recommended responsiveness and provide better touch
targets on narrow screens.

448-452: Consider extracting repeated button className pattern.

The responsive button classes (w-12 h-12 sm:w-16 sm:h-16 rounded-full border-2 transition-all duration-200) are repeated across all 11 option grids. Extracting this to a constant or utility would improve maintainability.

♻️ Optional: Extract common button styles
// Near the top of the component or in a shared styles file
const optionButtonBase = 'w-12 h-12 sm:w-16 sm:h-16 rounded-full border-2 transition-all duration-200';

// Usage in buttons
<button
  className={`${optionButtonBase} ${
    seed === s
      ? 'border-primary scale-110'
      : 'border-transparent hover:border-muted'
  }`}
>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/AvatarModal.tsx` around lines 448 - 452, Multiple
buttons in AvatarModal.tsx repeat the same responsive class string; extract that
into a shared constant (e.g., optionButtonBase) at the top of the AvatarModal
component or a shared styles file and replace each repeated literal with a
template using optionButtonBase plus the conditional part that checks seed === s
(the existing ternary that applies 'border-primary scale-110' or
'border-transparent hover:border-muted'); update all 11 option grids' button
className usages so they reference optionButtonBase to avoid duplication and
keep behavior identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@frontend/src/components/AvatarModal.tsx`:
- Line 443: Update the avatar option grids to use a 3-column layout on the
smallest screens by replacing instances of "grid-cols-4 sm:grid-cols-5" with
"grid-cols-3 sm:grid-cols-4 md:grid-cols-5" (start with the div in
AvatarModal.tsx that currently has className 'grid grid-cols-4 sm:grid-cols-5
gap-2 sm:gap-4 mt-2'). Also apply the same class change to the other avatar
option grid containers (background color, ear, eyes, cheek, face, front hair,
hair, mouth, sideburn, skin color) so all option grids match the recommended
responsiveness and provide better touch targets on narrow screens.
- Around line 448-452: Multiple buttons in AvatarModal.tsx repeat the same
responsive class string; extract that into a shared constant (e.g.,
optionButtonBase) at the top of the AvatarModal component or a shared styles
file and replace each repeated literal with a template using optionButtonBase
plus the conditional part that checks seed === s (the existing ternary that
applies 'border-primary scale-110' or 'border-transparent hover:border-muted');
update all 11 option grids' button className usages so they reference
optionButtonBase to avoid duplication and keep behavior identical.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2427bd14-d876-453e-8d28-63eae177b0e7

📥 Commits

Reviewing files that changed from the base of the PR and between 90fb523 and 4bc7521.

📒 Files selected for processing (1)
  • frontend/src/components/AvatarModal.tsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug : Avatar Modal not responsive on mobile devices

1 participant