feat(sidebar): project notes/todos live in right sidebar context tab

Replace the header sticky-note popover/mobile overlay with a dedicated Context
tab in the right sidebar. Context is cycled by the right-sidebar shortcut
alongside git and files, and persisted across reloads.
This commit is contained in:
Bohdan Triapitsyn
2026-04-18 13:46:57 +03:00
parent a9c51f115e
commit d203ba2ae0
5 changed files with 70 additions and 129 deletions
@@ -1,15 +1,19 @@
import React from 'react';
import { RiFolder3Line, RiGitBranchLine } from '@remixicon/react';
import { RiBookletLine, RiFolder3Line, RiGitBranchLine } from '@remixicon/react';
import { SortableTabsStrip } from '@/components/ui/sortable-tabs-strip';
import { ProjectNotesTodoPanel } from '@/components/session/ProjectNotesTodoPanel';
import { GitView } from '@/components/views';
import { useUIStore } from '@/stores/useUIStore';
import { useGitStore } from '@/stores/useGitStore';
import { useProjectsStore } from '@/stores/useProjectsStore';
import { useDirectoryStore } from '@/stores/useDirectoryStore';
import { useUIStore } from '@/stores/useUIStore';
import { useRuntimeAPIs } from '@/hooks/useRuntimeAPIs';
import { useEffectiveDirectory } from '@/hooks/useEffectiveDirectory';
import { formatDirectoryName } from '@/lib/utils';
import { SidebarFilesTree } from './SidebarFilesTree';
type RightTab = 'git' | 'files';
type RightTab = 'git' | 'files' | 'context';
/**
* Keeps git status fresh while the right sidebar is open.
@@ -35,6 +39,56 @@ function useRightSidebarGitSync(directory: string | undefined, isSidebarOpen: bo
}, [directory, git, isSidebarOpen, ensureStatus]);
}
const ContextSidebarPanel: React.FC = () => {
const activeProjectId = useProjectsStore((state) => state.activeProjectId);
const projects = useProjectsStore((state) => state.projects);
const homeDirectory = useDirectoryStore((state) => state.homeDirectory);
const gitDirectories = useGitStore((state) => state.directories);
const activeProject = React.useMemo(() => {
if (activeProjectId) {
return projects.find((project) => project.id === activeProjectId) ?? projects[0] ?? null;
}
return projects[0] ?? null;
}, [activeProjectId, projects]);
const projectRef = React.useMemo(() => {
if (!activeProject) {
return null;
}
return {
id: activeProject.id,
path: activeProject.path,
};
}, [activeProject]);
const projectLabel = React.useMemo(() => {
if (!activeProject) {
return null;
}
return activeProject.label?.trim()
|| formatDirectoryName(activeProject.path, homeDirectory)
|| activeProject.path;
}, [activeProject, homeDirectory]);
const canCreateWorktree = React.useMemo(() => {
if (!activeProject) {
return false;
}
return gitDirectories.get(activeProject.path)?.isGitRepo === true;
}, [activeProject, gitDirectories]);
return (
<div className="h-full min-h-0 overflow-auto bg-sidebar">
<ProjectNotesTodoPanel
projectRef={projectRef}
projectLabel={projectLabel}
canCreateWorktree={canCreateWorktree}
/>
</div>
);
};
export const RightSidebarTabs: React.FC = () => {
const rightSidebarTab = useUIStore((state) => state.rightSidebarTab);
const setRightSidebarTab = useUIStore((state) => state.setRightSidebarTab);
@@ -54,6 +108,11 @@ export const RightSidebarTabs: React.FC = () => {
label: 'Files',
icon: <RiFolder3Line className="h-3.5 w-3.5" />,
},
{
id: 'context',
label: 'Context',
icon: <RiBookletLine className="h-3.5 w-3.5" />,
},
], []);
return (
@@ -72,7 +131,8 @@ export const RightSidebarTabs: React.FC = () => {
<div className="min-h-0 flex-1 overflow-hidden">
{rightSidebarTab === 'git' && <GitView />}
{rightSidebarTab === 'files' && <SidebarFilesTree />}
{rightSidebarTab === 'context' && <ContextSidebarPanel />}
</div>
</div>
);
};
};