diff --git a/apps/ai-game-creator-shell/src/styles.css b/apps/ai-game-creator-shell/src/styles.css index 18b025651..76d00c806 100644 --- a/apps/ai-game-creator-shell/src/styles.css +++ b/apps/ai-game-creator-shell/src/styles.css @@ -5893,11 +5893,6 @@ iframe.preview-frame { line-height: 1.1; } -.game-resource-book-main-heading > span { - color: #a4877a; - font-size: 12px; -} - .game-resource-book-main-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); diff --git a/apps/ai-game-creator-shell/src/view/project-development/index.tsx b/apps/ai-game-creator-shell/src/view/project-development/index.tsx index e5ea3cdca..1fcda0ed4 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/index.tsx +++ b/apps/ai-game-creator-shell/src/view/project-development/index.tsx @@ -6105,14 +6105,7 @@ export default function ProjectDevelopmentView({ } >
-
-

资源总览

-
- - {canvasResources.length > 0 - ? `${canvasResources.length} 项正式与候选资源` - : '从资源栏目开始整理资源'} - +

资源总览

{ + const manifest = createGameCreationAppManifest( + 'workbench-overview-heading', + '总览标题项目', + ); + manifest.assets = [ + { + id: 'overview-heading-document', + kind: 'design-document', + mediaType: 'text/markdown', + localPath: 'memory/overview-heading.md', + source: { kind: 'generated', taskId: 'design-foundation' }, + category: 'document', + }, + ]; + window.__TAURI__ = { + core: { + invoke: vi.fn( + async (command: string, args?: Record) => { + if (command === 'read_local_project_resource_graph') { + return resourceGraphForInputs(args); + } + if (command === 'read_local_project_resource_canvas_layout') { + return { + schemaVersion: 'game-creator-resource-layout.v1', + projectId: args?.expectedProjectId, + mode: args?.mode, + revision: 0, + positions: [], + updatedAt: 0, + }; + } + if (command === 'update_local_project_resource_canvas_layout') { + return { + status: 'updated', + layout: { + schemaVersion: 'game-creator-resource-layout.v1', + projectId: args?.expectedProjectId, + mode: args?.mode, + revision: 1, + positions: args?.positions, + updatedAt: 1, + }, + }; + } + throw new Error(`unexpected invoke ${command}`); + }, + ), + }, + }; + + render( + React.createElement(ProjectDevelopmentView, { + projectName: manifest.name, + projectPath: '/tmp/workbench-overview-heading', + manifest, + attachments: [], + recentRunStatus: null, + recentRunStopReason: null, + supervisor: React.createElement('div', null, '项目总控'), + onHomeOpen: vi.fn(), + onProjectsOpen: vi.fn(), + }), + ); + + const heading = await waitFor(() => { + const element = document.querySelector( + '.game-resource-book-main-heading', + ); + expect(element).not.toBeNull(); + return element!; + }); + // 精确到标题栏整段文本:副标题只要回来一个字,这条断言就会红。 + expect(heading.textContent).toBe('资源总览'); + expect(heading.querySelectorAll('h2')).toHaveLength(1); + expect(heading.querySelector('h2')?.textContent).toBe('资源总览'); + // 卡片里的装饰性文案必须原样保留(同一次改动里最容易误删的东西)。 + expect(screen.getByRole('button', { name: '打开所有资源' })).not.toBeNull(); + expect( + document.querySelector( + '.game-resource-book-thumbnail[data-resource-book-category="document"] .game-resource-book-thumbnail-footer', + )?.textContent, + ).toContain('打开文档'); + }); }