feat(frontend): open session details from the header

Pressing the session title opens a details sheet with server, project, branch and directory and inline rename. Linked-server sessions show a server icon and their branch, child sessions show a parent session pill, a banner marks paused live updates while the stream reconnects, and the header context indicator is removed now that usage lives on the model pill.
This commit is contained in:
Chris Scott committed 2026-10-23 20:18:27 -04:00
1 parent 52162d5c4a
commit d99fcc268e
20 files changed
+732 -418

No files matched your search

@@ -142,6 +142,19 @@ describe('BottomSheet', () => {
})
})
it('disables the swipe gesture when the sheet is not dismissible', () => {
render(
<BottomSheet isOpen dismissible={false} onClose={() => {}} ariaLabel="Test sheet">
<div>Test content</div>
</BottomSheet>,
)
expect(useSwipeDismiss).toHaveBeenCalledWith(expect.any(Function), {
enabled: false,
threshold: 60,
})
})
it('binds gesture to the panel element with aria-modal', () => {
const mockBind = vi.fn()
vi.mocked(useSwipeDismiss).mockReturnValue({
+3 -1
View File
@@ -12,6 +12,7 @@ export interface BottomSheetProps {
className?: string
children: React.ReactNode
ariaLabel?: string
dismissible?: boolean
}
export function BottomSheet({
@@ -21,6 +22,7 @@ export function BottomSheet({
className,
children,
ariaLabel,
dismissible = true,
}: BottomSheetProps) {
const [shouldRender, setShouldRender] = useState(false)
const panelRef = useRef<HTMLDivElement>(null)
@@ -28,7 +30,7 @@ export function BottomSheet({
useRestoreFocusOnClose(isOpen, panelRef)
const { bind, swipeStyles } = useSwipeDismiss(onClose, {
enabled: isOpen,
enabled: isOpen && dismissible,
threshold: 60,
})
-107
View File
@@ -4,12 +4,8 @@ import { BackButton } from "@/components/ui/back-button";
import { PageHeader } from "@/components/ui/page-header";
import { useSettingsDialog } from "@/hooks/useSettingsDialog";
import { useTheme } from "@/hooks/useTheme";
import { EditSessionTitleDialog } from "@/components/session/EditSessionTitleDialog";
import { cn } from "@/lib/utils";
import type { ReactNode } from "react";
import { useState, useEffect } from "react";
import { useMobile } from "@/hooks/useMobile";
import { X } from "lucide-react";
interface HeaderProps {
children: ReactNode;
@@ -56,107 +52,6 @@ function HeaderTitle({ children, logo, className }: HeaderTitleProps) {
);
}
interface HeaderEditableTitleProps {
value: string;
onChange: (value: string) => void;
subtitle?: React.ReactNode;
className?: string;
}
function HeaderEditableTitle({ value, onChange, subtitle, className }: HeaderEditableTitleProps) {
const [isEditing, setIsEditing] = useState(false);
const [editTitle, setEditTitle] = useState(value);
const isMobile = useMobile();
useEffect(() => {
if (!isEditing) {
setEditTitle(value);
}
}, [value, isEditing]);
const handleTitleClick = () => {
setIsEditing(true);
setEditTitle(value);
};
const handleTitleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (editTitle.trim() && editTitle !== value) {
onChange(editTitle.trim());
}
setIsEditing(false);
};
const handleKeyDown = (e: React.KeyboardEvent) => {
if (e.key === 'Escape') {
setEditTitle(value);
setIsEditing(false);
} else if (e.key === 'Enter') {
handleTitleSubmit(e);
}
};
const handleSave = (newTitle: string) => {
if (newTitle.trim() && newTitle !== value) {
onChange(newTitle.trim());
}
setIsEditing(false);
};
return (
<div className={cn("min-w-0 flex-1", className)}>
{isMobile && (
<EditSessionTitleDialog
isOpen={isEditing}
currentTitle={value}
onClose={() => setIsEditing(false)}
onSave={handleSave}
/>
)}
{isEditing && !isMobile ? (
<form onSubmit={handleTitleSubmit} className="flex items-center gap-1 min-w-0">
<input
type="text"
value={editTitle}
onChange={(e) => setEditTitle(e.target.value)}
onBlur={(e) => {
if (!e.relatedTarget?.closest('button')) {
handleTitleSubmit(e);
}
}}
onKeyDown={handleKeyDown}
className="text-[16px] sm:text-base font-semibold bg-background border border-border rounded-l px-2 py-1 outline-none w-full truncate focus:border-primary sm:max-w-[250px] h-7"
autoFocus
/>
<Button
type="button"
variant="ghost"
size="icon"
className="h-7 w-7 rounded-l-none border border-l-0 border-border hover:bg-accent flex-shrink-0 mt-0"
onClick={() => setEditTitle("")}
>
<X className="w-3.5 h-3.5" />
</Button>
</form>
) : (
<div className="min-w-0">
<h1
className="text-xs sm:text-base font-semibold bg-gradient-to-r from-foreground to-muted-foreground bg-clip-text text-transparent truncate cursor-pointer hover:opacity-80 transition-opacity"
onClick={handleTitleClick}
>
{value}
</h1>
{subtitle && (
<p className="text-[10px] sm:text-xs text-muted-foreground truncate">
{typeof subtitle === 'string' ? subtitle : subtitle}
</p>
)}
</div>
)}
</div>
);
}
function HeaderActions({ children, className }: { children: ReactNode; className?: string }) {
return <div className={cn("flex items-center gap-2", className)}>{children}</div>;
}
@@ -180,13 +75,11 @@ function HeaderSettingsButton() {
export const Header = Object.assign(HeaderBase, {
BackButton: HeaderBackButton,
Title: HeaderTitle,
EditableTitle: HeaderEditableTitle,
Actions: HeaderActions,
Settings: HeaderSettingsButton,
}) as typeof HeaderBase & {
BackButton: typeof HeaderBackButton;
Title: typeof HeaderTitle;
EditableTitle: typeof HeaderEditableTitle;
Actions: typeof HeaderActions;
Settings: typeof HeaderSettingsButton;
};