fix(sidebar): give sessions the spare height and cap the menu section

Sessions now fills the remaining sidebar height while the Menu section is
capped at 40% and scrolls internally. Menu rows use a denser variant of
SidebarItem, cutting each row from 44px to 32px.
This commit is contained in:
Chris Scott committed 2026-10-06 21:30:47 -04:00
1 parent a81c0becfa
commit f4d2221d46
2 files changed
+9 -5

No files matched your search

@@ -15,6 +15,7 @@ import {
SidebarItem,
} from '@/components/ui/sidebar'
import { FolderGit2 } from 'lucide-react'
import { cn } from '@/lib/utils'
const ACCOUNT_ITEM_KEYS = new Set(['settings', 'logout'])
@@ -110,7 +111,7 @@ export function DesktopSidebar() {
label="Sessions"
collapsed={!isSectionOpen('sessions')}
onToggle={() => toggleSection('sessions')}
className="border-t border-border"
className={cn('border-t border-border', isSectionOpen('sessions') && 'flex-1')}
>
<DesktopSessionTree />
</SidebarCollapsibleSection>
@@ -119,16 +120,17 @@ export function DesktopSidebar() {
label="Menu"
collapsed={!isSectionOpen('menu')}
onToggle={() => toggleSection('menu')}
className="flex-1 min-h-fit border-t border-border"
className={cn('border-t border-border', isSectionOpen('sessions') ? 'shrink-0 max-h-[40%]' : 'flex-1')}
contentClassName="overflow-y-auto"
>
<div className="flex flex-col gap-1 p-2 pt-0">
<div className="flex flex-col gap-0.5 p-2 pt-0">
{toolItems.map((item: MoreDrawerItem) => (
<SidebarItem
key={item.key}
icon={item.icon}
label={item.label}
collapsed={false}
dense
onClick={() => handleItemClick(item)}
danger={item.danger}
/>
+4 -2
View File
@@ -105,6 +105,7 @@ export interface SidebarItemProps {
collapsed: boolean
onClick?: () => void
asPrimary?: boolean
dense?: boolean
variant?: 'default' | 'primary' | 'secondary' | 'danger'
}
@@ -115,13 +116,14 @@ export function SidebarItem({
collapsed,
onClick,
asPrimary = false,
dense = false,
variant = 'default',
}: SidebarItemProps) {
const baseClasses = cn(
'flex items-center gap-3 rounded-md transition-colors duration-150',
'focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',
asPrimary ? 'p-3 text-sm font-medium' : 'p-2.5 text-sm',
asPrimary ? 'p-3 text-sm font-medium' : dense ? 'px-2.5 py-1.5 text-sm' : 'p-2.5 text-sm',
variant === 'primary' && 'bg-primary text-primary-foreground hover:bg-primary/90',
variant === 'secondary' && 'bg-secondary text-secondary-foreground hover:bg-secondary/80',
variant === 'danger' && 'text-destructive hover:bg-destructive/10',
@@ -137,7 +139,7 @@ export function SidebarItem({
onClick={onClick}
title={collapsed ? label : undefined}
>
<Icon className={cn('h-5 w-5', 'flex-shrink-0')} />
<Icon className={cn(dense ? 'h-4 w-4' : 'h-5 w-5', 'flex-shrink-0')} />
{!collapsed && <span className="truncate">{label}</span>}
{collapsed && <span className="sr-only">{label}</span>}
</button>