Skip to content

Commit 10c983c

Browse files
committed
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
1 parent 8c34976 commit 10c983c

File tree

4 files changed

+77
-22
lines changed

4 files changed

+77
-22
lines changed

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
955955
placeholder={displayName}
956956
options={getApiConfigOptions}
957957
onChange={handleApiConfigChange}
958-
triggerClassName="w-full text-ellipsis overflow-hidden"
958+
triggerClassName="w-full text-ellipsis overflow-hidden min-w-0"
959959
itemClassName="group"
960960
renderItem={renderApiConfigItem}
961961
/>

webview-ui/src/components/modes/ModesView.tsx

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -663,29 +663,16 @@ const ModesView = ({ onDone }: ModesViewProps) => {
663663
setOpen(false)
664664
}}
665665
data-testid={`mode-option-${modeConfig.slug}`}>
666-
<div className="flex items-center justify-between w-full">
666+
<div className="flex items-center justify-between w-full min-w-0">
667667
<span
668-
style={{
669-
whiteSpace: "nowrap",
670-
overflow: "hidden",
671-
textOverflow: "ellipsis",
672-
flex: 2,
673-
minWidth: 0,
674-
}}>
668+
className="truncate flex-1 min-w-0 mr-2"
669+
title={modeConfig.name}>
675670
{modeConfig.name}
676671
</span>
677672
<span
678-
className="text-foreground"
679-
style={{
680-
whiteSpace: "nowrap",
681-
overflow: "hidden",
682-
textOverflow: "ellipsis",
683-
direction: "rtl",
684-
textAlign: "right",
685-
flex: 1,
686-
minWidth: 0,
687-
marginLeft: "0.5em",
688-
}}>
673+
className="text-foreground text-xs opacity-70 truncate flex-shrink-0 max-w-[40%] text-right"
674+
style={{ direction: "rtl" }}
675+
title={modeConfig.slug}>
689676
{modeConfig.slug}
690677
</span>
691678
</div>

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone, t
386386

387387
const observer = new ResizeObserver((entries) => {
388388
for (const entry of entries) {
389-
// If container width is less than 500px, switch to compact mode
390-
setIsCompactMode(entry.contentRect.width < 500)
389+
// If container width is less than 600px, switch to compact mode
390+
setIsCompactMode(entry.contentRect.width < 600)
391391
}
392392
})
393393

webview-ui/src/index.css

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,71 @@ input[cmdk-input]:focus {
479479
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
480480
transition-duration: 150ms;
481481
}
482+
483+
/* Responsive utilities for narrow containers */
484+
@media (max-width: 640px) {
485+
.responsive-text {
486+
font-size: 0.875rem;
487+
}
488+
489+
.responsive-gap {
490+
gap: 0.25rem;
491+
}
492+
493+
.responsive-padding {
494+
padding: 0.5rem;
495+
}
496+
}
497+
498+
/* Container query support for components */
499+
@container (max-width: 600px) {
500+
.container-compact {
501+
flex-direction: column;
502+
gap: 0.5rem;
503+
}
504+
505+
.container-compact .settings-tab {
506+
min-width: auto;
507+
flex: 1;
508+
}
509+
}
510+
511+
/* Improved flex utilities for narrow containers */
512+
.flex-responsive {
513+
display: flex;
514+
flex-wrap: wrap;
515+
gap: 0.5rem;
516+
}
517+
518+
.flex-responsive > * {
519+
min-width: 0;
520+
flex: 1 1 auto;
521+
}
522+
523+
/* Better text truncation for dropdowns and selectors */
524+
.dropdown-text {
525+
white-space: nowrap;
526+
overflow: hidden;
527+
text-overflow: ellipsis;
528+
min-width: 0;
529+
max-width: 100%;
530+
}
531+
532+
.dropdown-container {
533+
min-width: 0;
534+
flex: 1;
535+
overflow: hidden;
536+
}
537+
538+
/* Ensure proper text wrapping and overflow handling */
539+
.text-wrap {
540+
word-wrap: break-word;
541+
overflow-wrap: break-word;
542+
}
543+
544+
.text-ellipsis-safe {
545+
white-space: nowrap;
546+
overflow: hidden;
547+
text-overflow: ellipsis;
548+
min-width: 0;
549+
}

0 commit comments

Comments
 (0)