-
-
- {activePath ? activePath.split("/").pop() : (context?.organization?.name || "Workspace")}
-
-
- {activePath && content.kind !== "none" && (
-
- )}
- {showMainChat && (
-
- )}
-
-
- )}
-
- {/* When a file is selected: show top bar with breadcrumbs (desktop only, mobile has unified top bar) */}
- {!isMobile && activePath && content.kind !== "none" && (
-
- {showMainChat ? (
- /* Main chat view (default when no file is selected) */
- <>
-
- {
- setActiveSessionId(id);
- setActiveSubagentKey(null);
- }}
- onSessionsChange={activeSubagent ? undefined : refreshSessions}
- onSubagentSpawned={activeSubagent ? undefined : handleSubagentSpawned}
- onSubagentClick={handleSubagentClickFromChat}
- onFilePathClick={handleFilePathClickFromChat}
- onDeleteSession={activeSubagent ? undefined : handleDeleteSession}
- onRenameSession={activeSubagent ? undefined : handleRenameSession}
- compact={isMobile}
- sessionKey={activeSubagent?.childSessionKey}
- subagentTask={activeSubagent?.task}
- subagentLabel={activeSubagent?.label}
- onBack={activeSubagent ? handleBackFromSubagent : undefined}
- />
-
- {/* Chat sessions sidebar — static on desktop, drawer overlay on mobile */}
- {isMobile ? (
- chatSessionsOpen && (
-
{
- setActiveSessionId(sessionId);
- setActiveSubagentKey(null);
- void chatRef.current?.loadSession(sessionId);
- }}
- onNewSession={() => {
- setActiveSessionId(null);
- setActiveSubagentKey(null);
- void chatRef.current?.newSession();
- router.replace("/workspace", { scroll: false });
- setChatSessionsOpen(false);
- }}
- onSelectSubagent={handleSelectSubagent}
- onDeleteSession={handleDeleteSession}
- onRenameSession={handleRenameSession}
- mobile
- onClose={() => setChatSessionsOpen(false)}
- />
- )
- ) : (
- <>
- {!rightSidebarCollapsed && (
-
-
- {chatSidebarPreview ? (
- setChatSidebarPreview(null)}
- />
- ) : (
- {
- setActiveSessionId(sessionId);
- setActiveSubagentKey(null);
- void chatRef.current?.loadSession(sessionId);
- }}
- onNewSession={() => {
- setActiveSessionId(null);
- setActiveSubagentKey(null);
- void chatRef.current?.newSession();
- router.replace("/workspace", { scroll: false });
- }}
- onSelectSubagent={handleSelectSubagent}
- onDeleteSession={handleDeleteSession}
- onRenameSession={handleRenameSession}
- onCollapse={() => setRightSidebarCollapsed(true)}
- width={rightSidebarWidth}
- />
- )}
-
- )}
- {rightSidebarCollapsed && (
-
-
-
- )}
- >
- )}
- >
- ) : (
- <>
- {/* File content area */}
-
-
-
-
- {/* Chat sidebar (file/folder-scoped) — hidden for reserved paths, hidden on mobile */}
- {!isMobile && fileContext && showChatSidebar && !rightSidebarCollapsed && (
- <>
-
- >
- )}
- >
- )}
-
-