合并 fix/agc-resource-layout-manual:「整理画布」移入资源动作簇(离开行尾)

- 冲突解在 index.tsx 工具条动作区:两侧都要在同一位置插入按钮(WS1 的「生成任务」入口 +
  WS2 把「整理画布」从行尾移到「生成素材」之后),按「两侧语义都保住」解——
  「整理画布」在前(紧邻「生成素材」,满足其 previousElementSibling 断言与「不是行尾」断言),
  「生成任务」紧随其后,共用同一个闭合标签;行尾那份旧「整理画布」由 WS2 的删除 hunk 干净应用
- 已核对:ria-label="整理画布" 与 ria-label="生成任务" 在文件中各恰好一处
- 合并后实测:gc:typecheck 通过;resourceCanvasManualLayout 9 + appSurface 439 = 448 passed
This commit is contained in:
2026-09-14 19:29:51 +08:00
2 changed files with 43 additions and 27 deletions
@@ -7557,6 +7557,28 @@ export default function ProjectDevelopmentView({
</button>
) : null}
{/*
{/*
`game-workbench-view-actions`
+ secondary pill
CSS****
/
/
*/}
<button
type="button"
aria-label="整理画布"
disabled={!resourceLayoutReady}
aria-busy={resourceLayoutSaving}
onClick={() => activeResourceLayout.rederiveNow()}
>
<LayoutGrid size={15} aria-hidden="true" />
</button>
{/*
@@ -7578,8 +7600,7 @@ export default function ProjectDevelopmentView({
<ListChecks size={15} aria-hidden="true" />
{resourceAssetGenerationInFlightCount > 0
? `生成任务 · ${resourceAssetGenerationInFlightCount}`
: '生成任务'}
</button>
: '生成任务'} </button>
{pendingResourceEdits.length > 0 ||
pendingResourceEditsLoadState === 'failed' ? (
<button
@@ -7627,26 +7648,6 @@ export default function ProjectDevelopmentView({
</button>
</div>
{/*
`game-workbench-view-actions`
+ secondary pill
CSS
/
/
*/}
<button
type="button"
aria-label="整理画布"
disabled={!resourceLayoutReady}
aria-busy={resourceLayoutSaving}
onClick={() => activeResourceLayout.rederiveNow()}
>
<LayoutGrid size={15} aria-hidden="true" />
</button>
</>
) : null}
</div>
@@ -753,7 +753,7 @@ describe('资源画布手动重排口径', () => {
expect(typeWrites(tauri)).toHaveLength(1);
});
it('「整理画布」不属于「资源排列方式」这组模式切换,而是一枚独立动作按钮', async () => {
it('「整理画布」不属于「资源排列方式」这组模式切换,而是一枚资源动作按钮', async () => {
const projectPath = '/tmp/manual-layout-surface-project';
const tauri = installLayoutTauri({
projectIdsByPath: { [projectPath]: 'manual-layout-surface-project' },
@@ -783,13 +783,28 @@ describe('资源画布手动重排口径', () => {
within(sortGroup).queryByRole('button', { name: '整理画布' }),
).toBeNull();
// 它仍同一行、仍是同一枚动作按钮,只是搬出了那个 group。
// 它仍同一行里的同一枚动作按钮,只是搬出了那个 group、也离开了行尾
const rederiveButton = screen.getByRole('button', { name: '整理画布' });
expect(sortGroup.contains(rederiveButton)).toBe(false);
expect(rederiveButton.closest('.game-resource-sort-tabs')).toBeNull();
expect(
rederiveButton.closest('.game-workbench-view-actions'),
).not.toBeNull();
const actionsRow = rederiveButton.closest('.game-workbench-view-actions');
expect(actionsRow).not.toBeNull();
// 位置:不再是这一行的最后一个按钮(行尾会被读成"针对整个工具条"的动作),
// 紧跟「生成素材」,并且在排序组左侧。
const rowButtons = Array.from(actionsRow!.querySelectorAll('button'));
expect(rowButtons.at(-1)).not.toBe(rederiveButton);
const rederiveIndex = rowButtons.indexOf(rederiveButton);
const sortGroupIndex = rowButtons.findIndex((button) =>
sortGroup.contains(button),
);
expect(rederiveIndex).toBeGreaterThanOrEqual(0);
expect(sortGroupIndex).toBeGreaterThanOrEqual(0);
expect(rederiveIndex).toBeLessThan(sortGroupIndex);
expect(rederiveButton.previousElementSibling).toBe(
screen.getByRole('button', { name: '生成素材' }),
);
// 语义没变:可点性只跟布局就绪绑定,布局读完后它就是可点的。
await waitFor(() =>
expect(