Skip to content

fix(user-settings): collapse sidebar to icon-only rail on mobile#15678

Open
carlh7777 wants to merge 3 commits into
infiniflow:mainfrom
carlh7777:feat/nav-mobile-responsive
Open

fix(user-settings): collapse sidebar to icon-only rail on mobile#15678
carlh7777 wants to merge 3 commits into
infiniflow:mainfrom
carlh7777:feat/nav-mobile-responsive

Conversation

@carlh7777
Copy link
Copy Markdown

Summary

Improves the responsiveness of the User Settings layout by converting the left navigation sidebar into a compact icon-only rail on mobile devices.

Previously, the sidebar retained its full desktop width on narrow viewports, reducing the available space for settings content and making pages such as Data Sources difficult to use on phones and smaller tablets.

With this change:

  • Desktop layouts retain the existing full sidebar experience
  • Mobile layouts (<768px) display a compact 64px icon-only navigation rail
  • Main content receives significantly more horizontal space
  • Navigation and logout actions remain fully accessible on mobile

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Screenshots

Before After
image image

What Changed

Mobile Sidebar Optimization

  • Added responsive mobile behavior using useIsMobile()
  • Displays avatar and navigation icons only on mobile
  • Hides user email, navigation labels, version information, theme switcher, and logout text on smaller screens
  • Preserves navigation and logout functionality through icon actions

Layout Improvements

  • Updated settings page grid layout to use fixed sidebar widths:
    • Mobile: 4rem (64px)
    • Desktop: 303px
  • Uses minmax(0, 1fr) for the content panel to prevent overflow and allow proper shrinking
  • Prevents sidebar width from expanding based on content

Impact

  • Improves usability of User Settings pages on phones and small tablets
  • Increases available space for settings content
  • Reduces horizontal crowding and overflow issues
  • Maintains the existing desktop experience

Test Plan

Desktop (≥768px)

  • Verify the full sidebar is displayed
  • Confirm email, navigation labels, version information, theme switch, and logout text are visible
  • Ensure all navigation items function correctly

Mobile (<768px)

  • Verify the sidebar collapses to a 64px icon-only rail
  • Confirm main content remains readable without horizontal crowding
  • Verify navigation icons route correctly:
    • Data Sources
    • Model Providers
    • MCP
    • Team
    • Profile
    • API
  • Confirm logout works from the icon button

Verification

  • Run npm run build
  • Hard refresh when testing production or Docker deployments
  • Verify responsive behavior using browser device emulation

- Updated the sidebar component to utilize the `useIsMobile` hook for better responsiveness on mobile devices.
- Adjusted CSS classes for the sidebar and main content area to improve layout and spacing across different screen sizes.
- Ensured that user information and menu items adapt based on the device type, enhancing user experience on mobile.
- Cleaned up unused code and comments for better readability.
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 506fc1e5-a0df-46d2-b764-4fd94ccdfbf5

📥 Commits

Reviewing files that changed from the base of the PR and between cb45c0d and 37aedbf.

📒 Files selected for processing (1)
  • web/src/pages/user-setting/sidebar/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/pages/user-setting/sidebar/index.tsx

📝 Walkthrough

Walkthrough

The UserSetting page grid classes and inner wrapper were updated, and the SideBar was refactored for responsive behavior: mobile icon-only navigation, hidden labels/metadata on small screens, responsive sizing/ARIA attributes, and an icon-only logout on mobile.

Changes

Responsive User Settings Layout

Layer / File(s) Summary
Page layout adjustment
web/src/pages/user-setting/index.tsx
Updated the outer <section> grid classes and reformatted the main content wrapper className into a multi-line cn(...) call with adjusted Tailwind padding/spacing.
Sidebar mobile-responsive behavior
web/src/pages/user-setting/sidebar/index.tsx
Added LucideLogOut import, removed placeholder menu comments, and rewrote SideBar JSX to use responsive widths (w-16 md:w-[303px]), hide email and menu text on mobile (icons-only), add aria-label to menu buttons, adjust mobile button sizing, hide version/theme on mobile, and show an icon-only logout control on small screens.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🐰
A pocket of icons in the night,
Labels fold away from sight,
Padding snug and grid aligned,
Mobile hops, desktop stays kind,
Little logout gleams — compact delight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: converting the sidebar to an icon-only rail on mobile devices.
Description check ✅ Passed The description is comprehensive and complete, including problem statement, type of change, detailed explanation of what changed, impact, and a thorough test plan.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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


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
Contributor

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/src/pages/user-setting/index.tsx (1)

11-15: 💤 Low value

Optional: Simplify unnecessary cn() wrapper.

The cn() call wraps a single static className string with no conditional logic. This can be simplified to a direct className prop.

♻️ Simplification
-      <div
-        className={cn(
-          'pr-2 md:pr-6 pb-6 flex flex-1 min-w-0 rounded-lg overflow-hidden',
-        )}
-      >
+      <div className="pr-2 md:pr-6 pb-6 flex flex-1 min-w-0 rounded-lg overflow-hidden">
         <Outlet />
       </div>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@web/src/pages/user-setting/index.tsx` around lines 11 - 15, The JSX div in
user-setting/index.tsx currently wraps a single static class string with the
cn() helper; remove the unnecessary cn() call and pass the literal class string
directly to the className prop (replace className={cn('pr-2 md:pr-6 pb-6 flex
flex-1 min-w-0 rounded-lg overflow-hidden')} with className="pr-2 md:pr-6 pb-6
flex flex-1 min-w-0 rounded-lg overflow-hidden") to simplify the code and avoid
an unneeded dependency call.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/pages/user-setting/sidebar/index.tsx`:
- Around line 75-80: The sidebar width is driven by JS state from useIsMobile
causing an initial mismatch with the parent grid; replace the JS conditional
class on the <aside> (and other places using isMobile) with Tailwind responsive
classes so the browser-applied media query and component classes match on first
render (e.g., use mobile-first classes like w-16 and larger-breakpoint classes
like md:w-[303px] to mirror grid-cols-[4rem_minmax(0,1fr)]), update className
usage in the same way where cn(...) checks isMobile (header, email visibility,
navigation list, buttons, footer), and remove useIsMobile if no other logic
depends on it.

---

Nitpick comments:
In `@web/src/pages/user-setting/index.tsx`:
- Around line 11-15: The JSX div in user-setting/index.tsx currently wraps a
single static class string with the cn() helper; remove the unnecessary cn()
call and pass the literal class string directly to the className prop (replace
className={cn('pr-2 md:pr-6 pb-6 flex flex-1 min-w-0 rounded-lg
overflow-hidden')} with className="pr-2 md:pr-6 pb-6 flex flex-1 min-w-0
rounded-lg overflow-hidden") to simplify the code and avoid an unneeded
dependency call.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 339390b6-c2a1-4ea8-aabe-8b820dd4c920

📥 Commits

Reviewing files that changed from the base of the PR and between eee6ad5 and b15043b.

📒 Files selected for processing (2)
  • web/src/pages/user-setting/index.tsx
  • web/src/pages/user-setting/sidebar/index.tsx

Comment thread web/src/pages/user-setting/sidebar/index.tsx Outdated
…esponsiveness

- Removed the `useIsMobile` hook and adjusted CSS classes to streamline the sidebar's layout.
- Enhanced responsiveness by ensuring user information and menu items adapt correctly across different screen sizes.
- Cleaned up unused code and improved readability for better maintainability.
Copy link
Copy Markdown
Contributor

@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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/pages/user-setting/sidebar/index.tsx`:
- Around line 106-109: Replace the invalid <section> used inside the Button
content with a phrasing element: wrap the icon and label in a <span> that
preserves the classes "flex items-center gap-2.5 max-md:gap-0" and keep the
{icon} and <span className="hidden md:inline">{label}</span> children unchanged;
update the JSX in web/src/pages/user-setting/sidebar/index.tsx where the Button
renders this block so the wrapper is a <span> instead of <section>.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ff9eb860-c651-4b1b-8600-74dae1c628f6

📥 Commits

Reviewing files that changed from the base of the PR and between b15043b and cb45c0d.

📒 Files selected for processing (1)
  • web/src/pages/user-setting/sidebar/index.tsx

Comment thread web/src/pages/user-setting/sidebar/index.tsx Outdated
- Changed the sidebar layout from a section to a span element for improved semantic structure.
- Maintained existing styles and responsiveness while enhancing code clarity.
@carlh7777
Copy link
Copy Markdown
Author

@JinHai-CN, @dcc123456 could you please check this PR?

@carlh7777
Copy link
Copy Markdown
Author

@KevinHuSh @yingfeng could you please check this pr?

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

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant