Merge permanent conversation deletion and simplified project configuration
This commit is contained in:
commit
c77d8cf3a2
21 files changed
+1104
-326
No files matched your search
@@ -5,14 +5,12 @@ import { useTranslation } from 'react-i18next';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||
import {
|
||||
Archive,
|
||||
Bot,
|
||||
BotMessageSquare,
|
||||
Cpu,
|
||||
FolderKanban,
|
||||
Gamepad2,
|
||||
LogOut,
|
||||
MessageSquare,
|
||||
MoreHorizontal,
|
||||
Plus,
|
||||
Settings as SettingsIcon,
|
||||
@@ -131,7 +129,6 @@ export function Sidebar({
|
||||
} = useCurrentUserProfile();
|
||||
const refreshProviderSnapshot = useProviderStore((state) => state.refreshProviderSnapshot);
|
||||
const [projectsOpen, setProjectsOpen] = useState(true);
|
||||
const [archivedProjectId, setArchivedProjectId] = useState<string | null>(null);
|
||||
const [projectMenuOpen, setProjectMenuOpen] = useState(false);
|
||||
const [accountMenuOpen, setAccountMenuOpen] = useState(false);
|
||||
const [profileDialogOpen, setProfileDialogOpen] = useState(false);
|
||||
@@ -357,17 +354,13 @@ export function Sidebar({
|
||||
await readAndEnterProject(project);
|
||||
}, [readAndEnterProject]);
|
||||
|
||||
const openProjectAction = async (project: CodingProjectSummary, action: 'settings' | 'archived' | 'recent') => {
|
||||
const openProjectSettings = async (project: CodingProjectSummary) => {
|
||||
const opening = openProject(project);
|
||||
const intent = projectEntryIntentRef.current;
|
||||
await opening;
|
||||
if (intent !== projectEntryIntentRef.current) return;
|
||||
if (codingWorkspaceStore.getState().activeProjectId !== project.id) return;
|
||||
if (action === 'settings') {
|
||||
navigate('/project-config');
|
||||
} else {
|
||||
setArchivedProjectId(action === 'archived' ? project.id : null);
|
||||
}
|
||||
navigate('/project-config');
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -508,7 +501,6 @@ export function Sidebar({
|
||||
|
||||
{visibleProjects.map((project) => {
|
||||
const active = activeProject?.id === project.id;
|
||||
const archived = active && archivedProjectId === project.id;
|
||||
return (
|
||||
<div key={project.id}>
|
||||
<div className="relative">
|
||||
@@ -548,14 +540,7 @@ export function Sidebar({
|
||||
>
|
||||
<DropdownMenu.Item
|
||||
className="flex items-center rounded p-2 outline-none focus:bg-accent"
|
||||
onSelect={() => void openProjectAction(project, archived ? 'recent' : 'archived')}
|
||||
>
|
||||
{archived ? <MessageSquare aria-hidden="true" className="mr-2 h-3.5 w-3.5" /> : <Archive aria-hidden="true" className="mr-2 h-3.5 w-3.5" />}
|
||||
{archived ? '最近对话' : '已归档对话'}
|
||||
</DropdownMenu.Item>
|
||||
<DropdownMenu.Item
|
||||
className="flex items-center rounded p-2 outline-none focus:bg-accent"
|
||||
onSelect={() => void openProjectAction(project, 'settings')}
|
||||
onSelect={() => void openProjectSettings(project)}
|
||||
>
|
||||
<SettingsIcon aria-hidden="true" className="mr-2 h-3.5 w-3.5" />
|
||||
项目设置
|
||||
@@ -569,8 +554,7 @@ export function Sidebar({
|
||||
key={project.id}
|
||||
projectId={project.id}
|
||||
compact={workspaceLayout}
|
||||
archived={archived}
|
||||
onArchivedChange={(value) => setArchivedProjectId(value ? project.id : null)}
|
||||
onMenuOpenChange={setProjectMenuOpen}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user