fix(desktop): sidebar labels truncate instead of pushing header icons out

Flex containers around section/lane labels kept their default min-width:auto,
so a long project title refused to shrink at narrow sidebar widths and shoved
the trailing action icons (caret, +, kebab, branch) past the edge. Give every
header label min-w-0 so its truncate can engage, pin shrink-0 on the caret at
the primitive level and on SidebarSectionMeta, and clip LaneLabel's pinned
tail inside the label. Icons now stay visible at any width.
This commit is contained in:
Brooklyn Nicholson 2026-07-30 01:19:31 -05:00
parent 98e43be8e0
commit 958ab818b8
6 changed files with 14 additions and 8 deletions

View file

@ -10,7 +10,7 @@ import { cn } from '@/lib/utils'
/** The muted slot beside a section label (loading glyph, status hint). */
export function SidebarSectionMeta({ children }: { children: React.ReactNode }) {
return <span className="text-[0.6875rem] font-medium text-(--ui-text-quaternary)">{children}</span>
return <span className="shrink-0 text-[0.6875rem] font-medium text-(--ui-text-quaternary)">{children}</span>
}
// ── Row geometry (session row is canonical — everything composes these) ─────

View file

@ -135,7 +135,7 @@ export function SidebarCronJobsSection({
<SidebarGroup className="shrink-0 p-0 pb-1">
<div className="group/section flex shrink-0 items-center justify-between pb-1 pt-1.5">
<button
className="group/section-label flex w-fit items-center gap-1 bg-transparent text-left leading-none"
className="group/section-label flex w-fit min-w-0 items-center gap-1 bg-transparent text-left leading-none"
onClick={onToggle}
type="button"
>

View file

@ -24,7 +24,9 @@ function LaneLabel({ label, title }: { label: string; title?: string }) {
const tail = label.slice(label.length - tailLen)
return (
<span className="flex min-w-0" title={title}>
// overflow-hidden: the pinned tail is shrink-0, so at extreme narrow widths
// it must clip inside the label rather than push the trailing icons out.
<span className="flex min-w-0 overflow-hidden" title={title}>
<span className="truncate">{head}</span>
<span className="shrink-0 whitespace-pre">{tail}</span>
</span>

View file

@ -64,7 +64,9 @@ function SidebarSectionHeader({
<div className="group/section flex shrink-0 items-center justify-between gap-1 pb-1 pt-1.5">
{collapsible ? (
<button
className="group/section-label flex w-fit items-center gap-1 bg-transparent text-left leading-none"
// min-w-0 lets the label truncate at narrow sidebar widths instead of
// pushing the header's trailing action icons out of view.
className="group/section-label flex w-fit min-w-0 items-center gap-1 bg-transparent text-left leading-none"
onClick={onToggle}
type="button"
>
@ -75,7 +77,7 @@ function SidebarSectionHeader({
/>
</button>
) : (
<div className="flex w-fit items-center gap-1 leading-none">{labelBody}</div>
<div className="flex w-fit min-w-0 items-center gap-1 leading-none">{labelBody}</div>
)}
{action}
</div>

View file

@ -173,11 +173,13 @@ export function KeybindSettings() {
function CategoryHeader({ label, onToggle, open }: { label: string; onToggle: () => void; open: boolean }) {
return (
<button
className="group/kbd-cat flex w-fit items-center gap-1 px-2.5 pb-1 pt-3 text-left leading-none"
className="group/kbd-cat flex w-fit min-w-0 items-center gap-1 px-2.5 pb-1 pt-3 text-left leading-none"
onClick={onToggle}
type="button"
>
<span className="text-[0.64rem] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70">{label}</span>
<span className="min-w-0 truncate text-[0.64rem] font-semibold uppercase tracking-[0.12em] text-muted-foreground/70">
{label}
</span>
<DisclosureCaret
className="text-(--ui-text-tertiary) opacity-0 transition group-hover/kbd-cat:opacity-100"
open={open}

View file

@ -11,7 +11,7 @@ interface DisclosureCaretProps extends Omit<CodiconProps, 'name'> {
export function DisclosureCaret({ className, open, size = '0.75rem', ...props }: DisclosureCaretProps) {
return (
<Codicon
className={cn('transition-transform duration-150', open && 'rotate-90', className)}
className={cn('shrink-0 transition-transform duration-150', open && 'rotate-90', className)}
name="chevron-right"
size={size}
{...props}