Skip to content

Commit aaec180

Browse files
committed
fix: improve UI responsiveness for narrow sidebar widths
- Add CSS rules to prevent checkbox squeezing with min-width and flex-shrink properties - Fix profile selection edit icon layout by wrapping buttons in flex-shrink-0 container - Add min-w-0 to flex containers to allow proper text truncation - Add responsive CSS adjustments for settings view in narrow containers - Ensure icon buttons maintain their size and don't get cut off
1 parent 10c983c commit aaec180

File tree

2 files changed

+94
-38
lines changed

2 files changed

+94
-38
lines changed

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

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ const ApiConfigManager = ({
225225
</div>
226226
) : (
227227
<>
228-
<div className="flex items-center gap-1">
228+
<div className="flex items-center gap-1 min-w-0">
229229
<SearchableSelect
230230
value={currentApiConfigName}
231231
onValueChange={handleSelectConfig}
@@ -247,42 +247,51 @@ const ApiConfigManager = ({
247247
placeholder={t("settings:common.select")}
248248
searchPlaceholder={t("settings:providers.searchPlaceholder")}
249249
emptyMessage={t("settings:providers.noMatchFound")}
250-
className="grow"
250+
className="grow min-w-0"
251251
data-testid="select-component"
252252
/>
253-
<StandardTooltip content={t("settings:providers.addProfile")}>
254-
<Button variant="ghost" size="icon" onClick={handleAdd} data-testid="add-profile-button">
255-
<span className="codicon codicon-add" />
256-
</Button>
257-
</StandardTooltip>
258-
{currentApiConfigName && (
259-
<>
260-
<StandardTooltip content={t("settings:providers.renameProfile")}>
261-
<Button
262-
variant="ghost"
263-
size="icon"
264-
onClick={handleStartRename}
265-
data-testid="rename-profile-button">
266-
<span className="codicon codicon-edit" />
267-
</Button>
268-
</StandardTooltip>
269-
<StandardTooltip
270-
content={
271-
isOnlyProfile
272-
? t("settings:providers.cannotDeleteOnlyProfile")
273-
: t("settings:providers.deleteProfile")
274-
}>
275-
<Button
276-
variant="ghost"
277-
size="icon"
278-
onClick={handleDelete}
279-
data-testid="delete-profile-button"
280-
disabled={isOnlyProfile}>
281-
<span className="codicon codicon-trash" />
282-
</Button>
283-
</StandardTooltip>
284-
</>
285-
)}
253+
<div className="flex items-center gap-1 flex-shrink-0">
254+
<StandardTooltip content={t("settings:providers.addProfile")}>
255+
<Button
256+
variant="ghost"
257+
size="icon"
258+
onClick={handleAdd}
259+
data-testid="add-profile-button"
260+
className="flex-shrink-0">
261+
<span className="codicon codicon-add" />
262+
</Button>
263+
</StandardTooltip>
264+
{currentApiConfigName && (
265+
<>
266+
<StandardTooltip content={t("settings:providers.renameProfile")}>
267+
<Button
268+
variant="ghost"
269+
size="icon"
270+
onClick={handleStartRename}
271+
data-testid="rename-profile-button"
272+
className="flex-shrink-0">
273+
<span className="codicon codicon-edit" />
274+
</Button>
275+
</StandardTooltip>
276+
<StandardTooltip
277+
content={
278+
isOnlyProfile
279+
? t("settings:providers.cannotDeleteOnlyProfile")
280+
: t("settings:providers.deleteProfile")
281+
}>
282+
<Button
283+
variant="ghost"
284+
size="icon"
285+
onClick={handleDelete}
286+
data-testid="delete-profile-button"
287+
disabled={isOnlyProfile}
288+
className="flex-shrink-0">
289+
<span className="codicon codicon-trash" />
290+
</Button>
291+
</StandardTooltip>
292+
</>
293+
)}
294+
</div>
286295
</div>
287296
<div className="text-vscode-descriptionForeground text-sm mt-1">
288297
{t("settings:providers.description")}

webview-ui/src/index.css

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,27 @@ vscode-dropdown::part(listbox) {
399399
min-height: 16px;
400400
}
401401

402+
/* Ensure checkbox containers don't squeeze */
403+
.vscrui-checkbox {
404+
flex-shrink: 0;
405+
min-width: fit-content;
406+
}
407+
408+
/* Prevent checkbox label text from wrapping inappropriately */
409+
.vscrui-checkbox label {
410+
display: flex;
411+
align-items: center;
412+
gap: 0.5rem;
413+
min-width: 0;
414+
}
415+
416+
/* Ensure checkbox input maintains size */
417+
.vscrui-checkbox input[type="checkbox"] {
418+
flex-shrink: 0;
419+
min-width: 16px;
420+
min-height: 16px;
421+
}
422+
402423
/**
403424
* @shadcn/ui Overrides / Hacks
404425
*/
@@ -485,11 +506,11 @@ input[cmdk-input]:focus {
485506
.responsive-text {
486507
font-size: 0.875rem;
487508
}
488-
509+
489510
.responsive-gap {
490511
gap: 0.25rem;
491512
}
492-
513+
493514
.responsive-padding {
494515
padding: 0.5rem;
495516
}
@@ -501,7 +522,7 @@ input[cmdk-input]:focus {
501522
flex-direction: column;
502523
gap: 0.5rem;
503524
}
504-
525+
505526
.container-compact .settings-tab {
506527
min-width: auto;
507528
flex: 1;
@@ -535,6 +556,32 @@ input[cmdk-input]:focus {
535556
overflow: hidden;
536557
}
537558

559+
/* Settings view specific responsive adjustments */
560+
@container (max-width: 400px) {
561+
/* Reduce button sizes in very narrow containers */
562+
.settings-view button[class*="size-icon"] {
563+
width: 2rem;
564+
height: 2rem;
565+
padding: 0.25rem;
566+
}
567+
568+
/* Adjust gap between elements */
569+
.settings-view .flex.gap-1 {
570+
gap: 0.25rem;
571+
}
572+
}
573+
574+
/* Ensure profile selector doesn't overflow */
575+
.profile-selector-container {
576+
min-width: 0;
577+
overflow: hidden;
578+
}
579+
580+
/* Prevent icon buttons from shrinking */
581+
button[class*="codicon"] {
582+
flex-shrink: 0;
583+
}
584+
538585
/* Ensure proper text wrapping and overflow handling */
539586
.text-wrap {
540587
word-wrap: break-word;

0 commit comments

Comments
 (0)