feat: integrate project setup onboarding
This commit is contained in:
@@ -14,6 +14,7 @@ import { useProjectConfigStore } from '@/stores/project-config';
|
||||
import { useSettingsStore } from '@/stores/settings';
|
||||
import { cn } from '@/lib/utils';
|
||||
import type { SidebarPeekSource } from './sidebar-peek';
|
||||
import { isCodingProjectConversationReady } from '../../../shared/coding-project-contracts';
|
||||
|
||||
const SIDEBAR_PEEK_CLOSE_DELAY_MS = 180;
|
||||
|
||||
@@ -88,7 +89,11 @@ export function MainLayout() {
|
||||
if (activeProject && isProgrammingModule) void load(activeProject.id).catch(() => undefined);
|
||||
}, [activeProject, isProgrammingModule, load]);
|
||||
|
||||
const initializationBlocked = Boolean(activeProject && (!config || !config.initialized) && !isInitializationSafeRoute);
|
||||
const initializationBlocked = Boolean(
|
||||
activeProject
|
||||
&& (!config || !isCodingProjectConversationReady(config))
|
||||
&& !isInitializationSafeRoute,
|
||||
);
|
||||
return (
|
||||
<div data-testid="main-layout" className="relative flex h-[100dvh] flex-col overflow-hidden bg-transparent font-sans">
|
||||
{/* Title bar: drag region on macOS, icon + controls on Windows */}
|
||||
@@ -121,8 +126,8 @@ export function MainLayout() {
|
||||
<div data-testid="project-initialization-gate" className="glass-surface absolute inset-0 z-[100] flex items-center justify-center bg-background/90 p-6">
|
||||
<div className="surface-card max-w-md rounded-2xl border border-border/80 bg-background p-8 text-center shadow-float">
|
||||
<LockKeyhole className="mx-auto h-10 w-10" />
|
||||
<h1 className="mt-4 text-2xl font-semibold">项目尚未初始化</h1>
|
||||
<p className="mt-3 text-sm font-medium text-muted-foreground">请先在项目配置中完成至少一个手动 Agent 的名称、模型和职责设置。</p>
|
||||
<h1 className="mt-4 text-2xl font-semibold">项目还差一步</h1>
|
||||
<p className="mt-3 text-pretty text-sm font-medium leading-6 text-muted-foreground">请先在项目配置中创建或恢复一个项目智能体,并完成名称、模型和职责设置。</p>
|
||||
<Button onClick={() => navigate('/project-config')} className="mt-6 border border-brand/20 bg-brand font-semibold text-primary-foreground"><Settings2 className="mr-2 h-4 w-4" />打开项目配置</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -55,7 +55,10 @@ import { isCanonicalCodingProjectId } from '@/lib/coding-projects';
|
||||
import type { CodingProjectSummary } from '@/types/coding-project';
|
||||
import { useProjectConfigStore } from '@/stores/project-config';
|
||||
import type { ProjectType } from '../../../shared/project-config';
|
||||
import type { ProjectIdentityChoice } from '../../../shared/coding-project-contracts';
|
||||
import {
|
||||
isCodingProjectConversationReady,
|
||||
type ProjectIdentityChoice,
|
||||
} from '../../../shared/coding-project-contracts';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
type OpenDialogResult = {
|
||||
@@ -439,7 +442,7 @@ export function Sidebar({ workspaceLayout = false, sidebarPeekOpen = false, onSi
|
||||
return;
|
||||
}
|
||||
await setActiveProject(project.id);
|
||||
navigate(result.config.initialized
|
||||
navigate(isCodingProjectConversationReady(result.config)
|
||||
? '/chat'
|
||||
: projectConfigPath);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user