diff --git a/ui/src/components/agents/AgentsSidebar.tsx b/ui/src/components/agents/AgentsSidebar.tsx
index 5a25c08d..75933533 100644
--- a/ui/src/components/agents/AgentsSidebar.tsx
+++ b/ui/src/components/agents/AgentsSidebar.tsx
@@ -59,6 +59,7 @@ export function AgentsSidebar({ user, activeThreadId }: AgentsSidebarProps) {
@@ -73,6 +74,7 @@ export function AgentsSidebar({ user, activeThreadId }: AgentsSidebarProps) {
@@ -83,9 +85,24 @@ export function AgentsSidebar({ user, activeThreadId }: AgentsSidebarProps) {
-
-
-
+
+
+
@@ -99,10 +116,12 @@ function ThreadGroup({
label,
threads,
activeThreadId,
+ onNavigate,
}: {
label: string;
threads: Array
;
activeThreadId?: string;
+ onNavigate?: () => void;
}) {
if (threads.length === 0) return null;
@@ -112,13 +131,26 @@ function ThreadGroup({
{label}
{threads.map((thread) => (
-
+
))}
);
}
-function ThreadRow({ thread, isActive }: { thread: AgentThread; isActive: boolean }) {
+function ThreadRow({
+ thread,
+ isActive,
+ onNavigate,
+}: {
+ thread: AgentThread;
+ isActive: boolean;
+ onNavigate?: () => void;
+}) {
const deleteThread = useDeleteAgentThread();
const badge =
thread.diffStats && thread.diffStats.additions > 0
@@ -141,6 +173,7 @@ function ThreadRow({ thread, isActive }: { thread: AgentThread; isActive: boolea
setCollapsed(!collapsed), [collapsed, setCollapsed]);
- return { width, collapsed, setWidth, setCollapsed, toggle };
+ const closeOnMobile = useCallback(() => {
+ if (typeof window === "undefined") return;
+ // State-only: don't persist, so the desktop collapsed preference is preserved.
+ if (window.matchMedia("(max-width: 767px)").matches) setCollapsedState(true);
+ }, []);
+
+ return { width, collapsed, setWidth, setCollapsed, toggle, closeOnMobile };
}
interface SidebarFrameProps {
@@ -76,10 +85,16 @@ export function SidebarFrame({
return (
);
}