From 10c983cc2f0d1b4c62b5b8c2a5dadcd69862aa3d Mon Sep 17 00:00:00 2001 From: Roo Code Date: Fri, 18 Jul 2025 18:53:32 +0000 Subject: [PATCH] fix: improve UI scaling when sidebar width is reduced (#2678) - Adjust Settings View compact mode threshold from 500px to 600px for earlier activation - Improve text truncation in mode selector dropdowns with better Tailwind classes - Enhance chat text area API config dropdown responsiveness with min-w-0 classes - Add responsive CSS utilities for narrow containers and better text overflow handling Fixes #2678 --- .../src/components/chat/ChatTextArea.tsx | 2 +- webview-ui/src/components/modes/ModesView.tsx | 25 ++----- .../src/components/settings/SettingsView.tsx | 4 +- webview-ui/src/index.css | 68 +++++++++++++++++++ 4 files changed, 77 insertions(+), 22 deletions(-) diff --git a/webview-ui/src/components/chat/ChatTextArea.tsx b/webview-ui/src/components/chat/ChatTextArea.tsx index 6c541353eb..2352b887e4 100644 --- a/webview-ui/src/components/chat/ChatTextArea.tsx +++ b/webview-ui/src/components/chat/ChatTextArea.tsx @@ -955,7 +955,7 @@ const ChatTextArea = forwardRef( placeholder={displayName} options={getApiConfigOptions} onChange={handleApiConfigChange} - triggerClassName="w-full text-ellipsis overflow-hidden" + triggerClassName="w-full text-ellipsis overflow-hidden min-w-0" itemClassName="group" renderItem={renderApiConfigItem} /> diff --git a/webview-ui/src/components/modes/ModesView.tsx b/webview-ui/src/components/modes/ModesView.tsx index 170d03b0e4..188cd6cb1e 100644 --- a/webview-ui/src/components/modes/ModesView.tsx +++ b/webview-ui/src/components/modes/ModesView.tsx @@ -663,29 +663,16 @@ const ModesView = ({ onDone }: ModesViewProps) => { setOpen(false) }} data-testid={`mode-option-${modeConfig.slug}`}> -
+
+ className="truncate flex-1 min-w-0 mr-2" + title={modeConfig.name}> {modeConfig.name} + className="text-foreground text-xs opacity-70 truncate flex-shrink-0 max-w-[40%] text-right" + style={{ direction: "rtl" }} + title={modeConfig.slug}> {modeConfig.slug}
diff --git a/webview-ui/src/components/settings/SettingsView.tsx b/webview-ui/src/components/settings/SettingsView.tsx index fd3a8a129b..d794c84d44 100644 --- a/webview-ui/src/components/settings/SettingsView.tsx +++ b/webview-ui/src/components/settings/SettingsView.tsx @@ -386,8 +386,8 @@ const SettingsView = forwardRef(({ onDone, t const observer = new ResizeObserver((entries) => { for (const entry of entries) { - // If container width is less than 500px, switch to compact mode - setIsCompactMode(entry.contentRect.width < 500) + // If container width is less than 600px, switch to compact mode + setIsCompactMode(entry.contentRect.width < 600) } }) diff --git a/webview-ui/src/index.css b/webview-ui/src/index.css index fbb362ca8f..94795c42ca 100644 --- a/webview-ui/src/index.css +++ b/webview-ui/src/index.css @@ -479,3 +479,71 @@ input[cmdk-input]:focus { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; } + +/* Responsive utilities for narrow containers */ +@media (max-width: 640px) { + .responsive-text { + font-size: 0.875rem; + } + + .responsive-gap { + gap: 0.25rem; + } + + .responsive-padding { + padding: 0.5rem; + } +} + +/* Container query support for components */ +@container (max-width: 600px) { + .container-compact { + flex-direction: column; + gap: 0.5rem; + } + + .container-compact .settings-tab { + min-width: auto; + flex: 1; + } +} + +/* Improved flex utilities for narrow containers */ +.flex-responsive { + display: flex; + flex-wrap: wrap; + gap: 0.5rem; +} + +.flex-responsive > * { + min-width: 0; + flex: 1 1 auto; +} + +/* Better text truncation for dropdowns and selectors */ +.dropdown-text { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + min-width: 0; + max-width: 100%; +} + +.dropdown-container { + min-width: 0; + flex: 1; + overflow: hidden; +} + +/* Ensure proper text wrapping and overflow handling */ +.text-wrap { + word-wrap: break-word; + overflow-wrap: break-word; +} + +.text-ellipsis-safe { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + min-width: 0; +}