资源总览去掉大标题旁的副标题

- 删除资源总览标题栏里那颗副标题的**两个分支**:`${canvasResources.length} 项正式与候选资源` 与空项目时的 `从资源栏目开始整理资源`
- 位置:`apps/ai-game-creator-shell/src/view/project-development/index.tsx` 的 `<header className="game-resource-book-main-heading">`(基线 364492de3 的 5867-5871 行那颗 `<span>`,标题栏自 5863 行起)
- 同步删除只服务于它的 `.game-resource-book-main-heading > span` 样式,模块内不再留墓碑规则
- 该文案没有承载 `aria-label` 等语义(区域语义一直在容器的 `aria-label="资源总览"` 上),因此不需要把语义迁移到容器,也没有改成"更短的说明"
- 全量计数没有丢:同一次改动后由总览第 0 张「所有资源」卡的计数徽标承载,仍是同一份画布投影
- 卡片内部的说明/装饰文案(「打开 UI 交互」「打开角色与对象」「1 个直接子版本」等)保持不动
- 断言:资源总览标题栏整段 `textContent` 恰为「资源总览」(精确相等,不放宽成 `not.toContain`),并复核总览第 0 张卡与「文档」栏目卡的内部文案仍在
- 既有用例没有任何一条断言过这段副标题文案(全仓检索只命中源文件),因此没有"按文案已删更新"或"按四不写删除"的对象;本用例是补上的正向合同断言
This commit is contained in:
2026-09-11 11:28:59 +08:00
parent 1cc9a23815
commit 28bb5800ea
3 changed files with 93 additions and 13 deletions
@@ -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));
@@ -6105,14 +6105,7 @@ export default function ProjectDevelopmentView({
}
>
<header className="game-resource-book-main-heading">
<div>
<h2></h2>
</div>
<span>
{canvasResources.length > 0
? `${canvasResources.length} 项正式与候选资源`
: '从资源栏目开始整理资源'}
</span>
<h2></h2>
</header>
<div className="game-resource-book-main-grid">
<ResourceBookThumbnail
@@ -8805,4 +8805,96 @@ export function registerProjectAgentStatusTests() {
allOutline.querySelector('[aria-current="page"]')?.textContent?.trim(),
).toBe('所有资源');
});
/**
*
*
* N
* 0
* / UI 1
*/
it('keeps the resource overview heading free of a subtitle', async () => {
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<string, unknown>) => {
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<HTMLElement>(
'.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('打开文档');
});
}