Skip to content

Commit 5a57098

Browse files
7418claude
andcommitted
feat: group chat sidebar by project folder with collapsible sections
Restructure the chat list panel to group sessions by working directory (project folder), similar to Codex App. Each project folder is shown as a collapsible section with a folder icon and project name. Features: - Sessions grouped by working_directory, sorted by most recent activity - Collapsible folder sections with persistent state in localStorage - Per-folder "+" button to create new chat in that project - "Open project folder" button in sidebar header with FolderPicker dialog - NavRail new-chat button creates sessions in most recent project - Chat header shows "projectName / sessionTitle" breadcrumb - Search filters both folder names and session titles Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d199cbe commit 5a57098

File tree

3 files changed

+357
-127
lines changed

3 files changed

+357
-127
lines changed

src/app/chat/[id]/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default function ChatSessionPage({ params }: ChatSessionPageProps) {
2121
const [sessionTitle, setSessionTitle] = useState<string>('');
2222
const [sessionModel, setSessionModel] = useState<string>('');
2323
const [sessionMode, setSessionMode] = useState<string>('');
24+
const [projectName, setProjectName] = useState<string>('');
2425
const { setWorkingDirectory, setSessionId, setSessionTitle: setPanelSessionTitle, setPanelOpen } = usePanel();
2526

2627
// Load session info and set working directory
@@ -32,6 +33,7 @@ export default function ChatSessionPage({ params }: ChatSessionPageProps) {
3233
const data: { session: ChatSession } = await res.json();
3334
if (data.session.working_directory) {
3435
setWorkingDirectory(data.session.working_directory);
36+
localStorage.setItem("codepilot:last-working-directory", data.session.working_directory);
3537
}
3638
setSessionId(id);
3739
setPanelOpen(true);
@@ -40,6 +42,7 @@ export default function ChatSessionPage({ params }: ChatSessionPageProps) {
4042
setPanelSessionTitle(title);
4143
setSessionModel(data.session.model || '');
4244
setSessionMode(data.session.mode || 'code');
45+
setProjectName(data.session.project_name || '');
4346
}
4447
} catch {
4548
// Session info load failed - panel will still work without directory
@@ -112,9 +115,15 @@ export default function ChatSessionPage({ params }: ChatSessionPageProps) {
112115
{/* Chat title bar */}
113116
{sessionTitle && (
114117
<div
115-
className="flex items-center justify-center px-4 py-2"
118+
className="flex items-center justify-center px-4 py-2 gap-1"
116119
style={{ WebkitAppRegion: 'drag' } as React.CSSProperties}
117120
>
121+
{projectName && (
122+
<>
123+
<span className="text-xs text-muted-foreground shrink-0">{projectName}</span>
124+
<span className="text-xs text-muted-foreground shrink-0">/</span>
125+
</>
126+
)}
118127
<h2 className="text-sm font-medium text-foreground/80 truncate max-w-md">
119128
{sessionTitle}
120129
</h2>

0 commit comments

Comments
 (0)