继续沉淀结果页返回按钮

新增共享 PlatformBackActionButton 承接结果页轻量返回入口
将拼图方洞拼消消视觉小说等结果页返回按钮收口到共享组件
将拼消消跳一跳敲木鱼宝贝识物结果页返回按钮收口到共享组件
补充对应测试并更新 PlatformUiKit 收口计划与共享决策记录
This commit is contained in:
2026-06-11 04:52:48 +08:00
parent 1b89611c9a
commit 0d9259b762
20 changed files with 313 additions and 75 deletions

View File

@@ -2087,6 +2087,7 @@
- 决策:`PlatformAsyncStatePanel` 从 profile modal 扩展到作品架类白底 panel`CustomWorldCreationHub.tsx` 的作品架主体现在也统一走 `loadingState / emptyState / children` 三段 slot但 error + 重试继续留在业务层外侧不把共享组件扩成“banner + retry + content”全能状态机。后续白底作品架或列表 panel 若只是互斥的 `loading / empty / content`,优先直接复用这套骨架。
- 决策:`CopyFeedbackButton.tsx``actionSurface` 分支继续收口到 `PlatformActionButton``pill` 分支继续保留 `PlatformPillBadge` 风格;复制反馈按钮不再直接调用 `getPlatformActionButtonClassName` 手拼平台按钮基础 chrome。后续同类“复制状态机 + 平台动作按钮”组合优先直接复用 `CopyFeedbackButton`不要在业务页重新混写图标、文案、aria 和动作按钮 class。
- 决策:白底 / 暗色面板里的轻量空态和普通 CTA 继续向共享组件收口。`PuzzleResultView.tsx` 的缺草稿提示、`RpgCreationAssetDebugPanel.tsx` 的空诊断提示、`VisualNovelEntityGrid` 的空实体列表、`AccountModal.tsx` 里账号安全分区的“无安全限制 / 无登录设备 / 无操作记录”以及 `LoginScreen.tsx` 的“当前登录入口暂不可用”都改为 `PlatformEmptyState``Match3DResultView.tsx` 的引用素材列表直接复用 `PlatformAssetPickerGrid` 自己的空态;`AdventureEntityModal.tsx` 的私聊按钮、`InventoryPanel.tsx` 的锻造 / 合成按钮、`RpgCreationRoleAssetStudioModalImpl.tsx``RpgCreationEntityEditorShared.tsx` 里的局部 `ActionButton` 包装层,以及 `RpgAdventurePanel.tsx` / `RpgAdventurePanelOverlays.tsx` 里标准 runtime CTA 都改为委托 `PlatformActionButton surface="editorDark"`。后续白底子面板里的只读空态优先使用 `PlatformEmptyState surface="subpanel"`;暗色编辑 / 运行面板里的普通动作优先使用 `PlatformActionButton surface="editorDark"`,若业务仍需 `stopPropagation`、tone 映射、运行态 icon 排版或局部字号,可保留薄包装层,但不要再直接写原生 `<button>` 基础 chrome。
- 决策:白底 / 浅色结果页和工作台顶部的“左箭头 + 返回文案”轻量返回入口统一收口到 `src/components/common/PlatformBackActionButton.tsx`;共享组件固定承接 `PlatformActionButton tone="ghost" size="xs"` 上的返回按钮骨架,并只开放 `compact / regular` 两档尺寸,分别覆盖紧凑结果页 header 与标准白底结果页顶栏。当前已覆盖 `PuzzleResultView.tsx``SquareHoleResultView.tsx``Match3DResultView.tsx``VisualNovelResultView.tsx``PuzzleClearResultView.tsx``JumpHopResultView.tsx``WoodenFishResultView.tsx``BabyObjectMatchResultView.tsx`;暖色生成页继续走 `GenerationHeaderBackButton``BigFishResultView.tsx` 这类 dark hero / 强品牌返回入口继续走 `PlatformIconButton darkMini`,不把三条视觉语义线硬并成一个组件。
- 决策:`CustomWorldNpcVisualEditor.tsx` 的本地 `ActionButton``SkillEffectPreview.tsx` 的“重新预览”按钮也继续并入这条暗色按钮收口线,统一委托 `PlatformActionButton surface="editorDark"`;局部包装层只保留 `stopPropagation`、图标排布、`tone` 映射和极少量视觉微调。后续暗色编辑器里的局部动作按钮若只是普通 CTA不再新增原生 `<button>` 实现,优先沿用“薄包装 + 共享按钮本体”模式。
- 决策RPG 创作侧标准 dark header / footer 动作也继续纳入同一条按钮收口线。`RpgCreationRoleAssetStudioModalImpl.tsx` 的 header“关闭”、`RpgCreationEntityEditorShared.tsx` 的 footer“取消”以及 `RpgCreationRoleAssetStudioFooter.tsx` 的“保存到当前角色”都改为委托 `PlatformActionButton surface="editorDark"`;局部壳层只保留布局、宽度/字号贴合和少量 tone 语义,不再为标准 dark close / cancel / save CTA 单独维护原生 `<button>` 基础 chrome。
- 决策RPG runtime overlay 里的标准 dark CTA 和可点击 dark row 也继续纳入这条收口线。`RpgAdventurePanelOverlays.tsx` 的 goal panel“知道了”、任务详情里的“领取任务 / 返回交付”、任务完成提示里的“打开任务日志”都改为委托 `PlatformActionButton surface="editorDark"`;设置面板里的“运行统计”入口改为 `PlatformSubpanel as="button" surface="dark"`。像素风 choice button、HUD launcher、奖励物品格和输入 composer 保持 runtime 专属语义,不继续硬并到普通平台按钮。

View File

@@ -268,6 +268,7 @@
19.3.42. `PlatformAsyncStatePanel` 继续从首页扩展到公共素材网格、runtime 面板和账号子区块:`PlatformAssetPickerGrid` 现已统一用共享状态壳承接 `loading / empty / content`,但继续把 `error` banner 留在外层,以保持“错误提示可与内容或加载态并存”的原语义;`VisualNovelSavePanel.tsx` 的存档列表,以及 `AccountModal.tsx` 里的“安全状态 / 当前登录设备 / 账号操作记录”三个子区块也都改成各自使用 `PlatformAsyncStatePanel`。后续白底列表、素材选择器或账号子面板若只是标准互斥异步状态,优先按这三种接法复用共享状态壳,不再把读取态和空态分支手写回组件内部。验证命令:`npx vitest run src/components/common/PlatformAssetPickerCard.test.tsx src/components/visual-novel-runtime/VisualNovelRuntimePanels.emptyState.test.tsx src/components/auth/AccountModal.test.tsx src/components/platform-entry/PlatformProfileRewardCodeRedeemModal.test.tsx``npm run typecheck``npm run check:encoding``git diff --check`
19.3.43. 轻量按钮漏网继续向共享按钮收口:`PlatformTagEditor.tsx` 的标签 chip 删除入口已改成紧凑 `PlatformIconButton`,保留 `label="删除标签 ${tag}"`、透明背景和原 chip 高度,不再手写裸 `<button>``RpgEntryCharacterSelectView.tsx` 两处重复的“返回”按钮已统一沉到文件内 `CharacterSelectBackButton`,底层委托 `PlatformActionButton surface="editorDark"`,保留原有暗色视觉与文案。后续同类“局部 chip 删除按钮”优先先用 `PlatformIconButton` 压缩尺寸和视觉;暗色轻量返回 / 返回上一级 CTA 则优先用 `PlatformActionButton surface="editorDark"` 包一层局部 helper不再复制原生 `<button>` class。验证命令`npx vitest run src/components/common/PlatformTagEditor.test.tsx src/components/rpg-entry/RpgEntryCharacterSelectView.test.tsx``npm run typecheck``npm run check:encoding``git diff --check`
19.3.44. 暖色生成页顶部返回入口开始沉淀共享壳:`GenerationProgressHero.tsx` 新增 `GenerationHeaderBackButton`,统一承接 `ArrowLeft + 文案 + 透明背景` 的暖色生成页返回按钮骨架,并底层复用 `PlatformIconButton variant="darkMini"``CustomWorldGenerationView.tsx``BarkBattleGeneratingView.tsx` 已接入,继续保留各自 `backLabel`、禁用态和局部暖色文字样式。后续同类生成页、等待页或暖色 hero 顶栏若只是“左箭头 + 返回文案”的轻量返回入口,优先复用这个小组件,不再各自手写 `ArrowLeft`、透明按钮背景和字号间距。验证命令:`npx vitest run src/components/CustomWorldGenerationView.test.tsx src/components/bark-battle-creation/BarkBattleGeneratingView.test.tsx src/components/common/PlatformIconButton.test.tsx``npm run typecheck``npm run check:encoding``git diff --check`
19.3.45. 白底 / 浅色结果页与工作台顶部的轻量返回入口继续收口到 `src/components/common/PlatformBackActionButton.tsx`;该 Module 固定承接 `PlatformActionButton tone="ghost" size="xs"` 上的 `ArrowLeft + 返回文案` 骨架,并只暴露 `compact / regular` 两档尺寸,分别覆盖紧凑结果页 header 与标准白底结果页顶栏。当前 `PuzzleResultView.tsx``SquareHoleResultView.tsx``Match3DResultView.tsx``VisualNovelResultView.tsx` 四个结果页已接入 `variant="compact"``PuzzleClearResultView.tsx``JumpHopResultView.tsx``WoodenFishResultView.tsx` 三个结果页已接入 `variant="regular"``BabyObjectMatchResultView.tsx` 继续使用紧凑款并保留 `className="px-3"` 贴合原横向留白。暖色生成页顶部返回入口继续走 `GenerationHeaderBackButton``BigFishResultView.tsx` 这类 dark hero / 强品牌 special case 继续保留 `PlatformIconButton variant="darkMini"` 路线,不强行并入同一个白底返回按钮基元。后续白底结果页、浅色工作台或普通 platform 顶栏里若只是“左箭头 + 返回”轻量返回入口,优先直接复用 `PlatformBackActionButton`,只在局部补尺寸和少量外边距,不再各页重复手写 ghost button class。
19.3. creative-agent 首页的侧边栏菜单、账号入口、开启新对话、我的创作、首页激励 CTA 和 prompt suggestion 按钮迁移到 `PlatformIconButton` / `PlatformActionButton`;首页继续保留 `creative-agent-home__*` 本地 class 承接透明顶栏、抽屉和品牌化胶囊视觉,不把视觉回收和语义收口绑成一次大改。`Beta` 徽标和历史记录纯文本行暂保留本地实现,等出现更多同构轻量列表行后再评估是否抽新的共享 row primitive。
19.4. 大鱼吃小鱼结果页 hero 的返回入口迁移到 `PlatformIconButton variant="darkMini"`,测试 / 发布动作迁移到 `PlatformActionButton surface="editorDark"`;结果页只保留测试运行、发布提交和文案状态语义,不再手写 hero 顶栏按钮壳。
19.4.1. 大鱼吃小鱼结果页的发布失败弹层迁移到 `src/components/common/PlatformStatusDialog.tsx``PlatformStatusDialog` 补充自定义图标、可访问标签和动作按钮样式透传后,`BigFishResultView` 不再保留 `BigFishResultErrorModal` 内联的 `UnifiedConfirmDialog + PlatformIconBadge` 组合。结果页只保留失败文案和关闭回调,发布失败的状态图标、遮罩、白底面板和“知道了”主动作统一由共享状态弹层承接。验证命令:`npm run test -- src/components/common/PlatformStatusDialog.test.tsx src/components/big-fish-result/BigFishResultView.test.tsx``npm run typecheck`

View File

@@ -0,0 +1,35 @@
/* @vitest-environment jsdom */
import { render, screen } from '@testing-library/react';
import { expect, test } from 'vitest';
import { PlatformBackActionButton } from './PlatformBackActionButton';
test('renders compact back action button by default', () => {
render(<PlatformBackActionButton />);
const button = screen.getByRole('button', { name: '返回' });
expect(button.className).toContain('platform-button--ghost');
expect(button.className).toContain('min-h-0');
expect(button.className).toContain('text-[11px]');
expect(button.className).toContain('gap-1.5');
expect(button.querySelector('svg')?.className.baseVal).toContain('h-3.5');
});
test('supports regular variant and editor dark surface', () => {
render(
<PlatformBackActionButton
label="返回编辑"
variant="regular"
surface="editorDark"
/>,
);
const button = screen.getByRole('button', { name: '返回编辑' });
expect(button.className).toContain('platform-action-button--editor-dark');
expect(button.className).toContain('text-sm');
expect(button.className).toContain('gap-2');
expect(button.querySelector('svg')?.className.baseVal).toContain('h-4');
});

View File

@@ -0,0 +1,58 @@
import type { ButtonHTMLAttributes } from 'react';
import { ArrowLeft } from 'lucide-react';
import { PlatformActionButton } from './PlatformActionButton';
import type { PlatformActionButtonSurface } from './platformActionButtonModel';
type PlatformBackActionButtonVariant = 'compact' | 'regular';
type PlatformBackActionButtonProps = Omit<
ButtonHTMLAttributes<HTMLButtonElement>,
'children'
> & {
label?: string;
variant?: PlatformBackActionButtonVariant;
surface?: PlatformActionButtonSurface;
};
const VARIANT_CLASS: Record<PlatformBackActionButtonVariant, string> = {
compact: 'gap-1.5 py-1.5 text-[11px]',
regular: 'gap-2 py-2 text-sm',
};
const ICON_CLASS: Record<PlatformBackActionButtonVariant, string> = {
compact: 'h-3.5 w-3.5',
regular: 'h-4 w-4',
};
/**
* 平台轻量返回动作按钮。
* 统一结果页、工作台等白底场景里的“左箭头 + 返回文案”按钮骨架。
*/
export function PlatformBackActionButton({
label = '返回',
variant = 'compact',
surface = 'platform',
className,
...buttonProps
}: PlatformBackActionButtonProps) {
return (
<PlatformActionButton
{...buttonProps}
surface={surface}
tone="ghost"
size="xs"
className={[
'min-h-0 self-start',
VARIANT_CLASS[variant],
className,
]
.filter(Boolean)
.join(' ')}
>
<ArrowLeft className={ICON_CLASS[variant]} />
{label}
</PlatformActionButton>
);
}

View File

@@ -235,3 +235,29 @@ test('baby object result blocks placeholder assets and exposes regeneration', as
expect(onPublish).not.toHaveBeenCalled();
expect(onStartTestRun).not.toHaveBeenCalled();
});
test('baby object result header back button reuses shared compact back action button', async () => {
const user = userEvent.setup();
const onBack = vi.fn();
render(
<BabyObjectMatchResultView
draft={createGeneratedDraft()}
isBusy
onBack={onBack}
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-[11px]');
expect(backButton.className).toContain('gap-1.5');
expect(backButton.className).toContain('px-3');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-3.5');
expect((backButton as HTMLButtonElement).disabled).toBe(true);
await user.click(backButton);
expect(onBack).not.toHaveBeenCalled();
});

View File

@@ -1,5 +1,4 @@
import {
ArrowLeft,
CheckCircle2,
Loader2,
Play,
@@ -16,6 +15,7 @@ import {
normalizeBabyObjectMatchTags,
} from '../../../packages/shared/src/contracts/edutainmentBabyObject';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformMediaFrame } from '../common/PlatformMediaFrame';
import { PlatformOverlayBadge } from '../common/PlatformOverlayBadge';
import { PlatformPillBadge } from '../common/PlatformPillBadge';
@@ -87,16 +87,11 @@ export function BabyObjectMatchResultView({
<div className="platform-page-stage platform-remap-surface flex h-full min-h-0 flex-col overflow-hidden px-3 pb-3 pt-3 sm:px-4 sm:pt-4 xl:px-5 xl:pb-4 xl:pt-4">
<div className="mx-auto flex h-full min-h-0 w-full max-w-5xl flex-col">
<div className="mb-3 flex shrink-0 items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
disabled={isBusy}
tone="ghost"
size="xs"
className="min-h-0 gap-2 px-3 py-1.5 text-[11px]"
>
<ArrowLeft className="h-3.5 w-3.5" />
</PlatformActionButton>
className="px-3"
/>
<div className="flex min-w-0 items-center gap-2">
<PlatformPillBadge
tone={isPublished ? 'success' : 'neutral'}

View File

@@ -1,6 +1,6 @@
/* @vitest-environment jsdom */
import { render, screen } from '@testing-library/react';
import { fireEvent, render, screen } from '@testing-library/react';
import { beforeEach, expect, test, vi } from 'vitest';
import type { JumpHopWorkProfileResponse } from '../../../packages/shared/src/contracts/jumpHop';
@@ -290,6 +290,32 @@ test('跳一跳草稿结果页不请求公开排行榜', () => {
expect(screen.queryByText('排行榜')).toBeNull();
});
test('跳一跳结果页头部返回按钮复用共享 back action button', () => {
const onBack = vi.fn();
render(
<JumpHopResultView
profile={buildProfile()}
onBack={onBack}
onEdit={() => {}}
onStartTestRun={() => {}}
onPublish={() => {}}
onRegenerateTiles={() => {}}
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-sm');
expect(backButton.className).toContain('gap-2');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-4');
fireEvent.click(backButton);
expect(onBack).toHaveBeenCalledTimes(1);
});
function buildProfile(
options: {
publicationStatus?: JumpHopWorkProfileResponse['summary']['publicationStatus'];

View File

@@ -13,6 +13,7 @@ import {
} from '../../services/jump-hop/jumpHopRuntimeModel';
import { useJumpHopLeaderboard } from '../../services/jump-hop/useJumpHopLeaderboard';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformEmptyState } from '../common/PlatformEmptyState';
import { PlatformMediaFrame } from '../common/PlatformMediaFrame';
import { PlatformMediaTileGrid } from '../common/PlatformMediaTileGrid';
@@ -331,15 +332,10 @@ export function JumpHopResultView({
return (
<div className="platform-remap-surface mx-auto flex h-full min-h-0 w-full max-w-5xl flex-col overflow-y-auto overscroll-contain px-3 pb-[max(1.5rem,env(safe-area-inset-bottom))] pt-3 sm:px-4 sm:pt-4">
<div className="mb-3 flex items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
tone="ghost"
size="xs"
className="min-h-0 gap-2 py-2 text-sm"
>
<ArrowLeft className="h-4 w-4" />
</PlatformActionButton>
variant="regular"
/>
<div className="flex gap-2">
<PlatformActionButton
onClick={onRegenerateTiles}

View File

@@ -148,6 +148,31 @@ function createReadyGeneratedItemAsset(index: number) {
}
describe('Match3DResultView', () => {
test('结果页头部返回按钮复用共享 compact back action button', () => {
const onBack = vi.fn();
render(
<Match3DResultView
profile={createProfile()}
onBack={onBack}
onStartTestRun={() => {}}
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-[11px]');
expect(backButton.className).toContain('gap-1.5');
expect(backButton.querySelector('svg')?.className.baseVal).toContain(
'h-3.5',
);
fireEvent.click(backButton);
expect(onBack).toHaveBeenCalledTimes(1);
});
test('标准白底面板使用 PlatformSubpanel lg 外壳', async () => {
match3dSpritesheetParser.loadMatch3DSpritesheetAssetRegions.mockResolvedValue(
Array.from({ length: 10 }, (_, index) => ({

View File

@@ -53,6 +53,7 @@ import {
import { readPuzzleReferenceImageAsDataUrl } from '../../services/puzzleReferenceImage';
import { useAuthUi } from '../auth/AuthUiContext';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformAssetPickerGrid } from '../common/PlatformAssetPickerCard';
import { PlatformFieldLabel } from '../common/PlatformFieldLabel';
import { PlatformIconButton } from '../common/PlatformIconButton';
@@ -1354,18 +1355,11 @@ function Match3DResultHeader({
return (
<div className="mb-4 flex items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
disabled={isBusy}
tone="ghost"
size="xs"
className="min-h-0 self-start py-1.5 text-[11px]"
>
<span className="inline-flex items-center gap-1.5">
<ArrowLeft className="h-3.5 w-3.5" />
</span>
</PlatformActionButton>
variant="compact"
/>
{badge}
</div>
);

View File

@@ -222,3 +222,29 @@ test('结果页在素材未发布就绪时禁用发布,且不写入规则说
).toBe(true);
expect(screen.queryByText(/|||/u)).toBeNull();
});
test('结果页头部返回按钮复用共享 back action button', () => {
const onBack = vi.fn();
render(
<PuzzleClearResultView
profile={createProfile()}
onBack={onBack}
onEdit={vi.fn()}
onStartTestRun={vi.fn()}
onPublish={vi.fn()}
onRegenerateAtlas={vi.fn()}
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-sm');
expect(backButton.className).toContain('gap-2');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-4');
fireEvent.click(backButton);
expect(onBack).toHaveBeenCalledTimes(1);
});

View File

@@ -1,4 +1,4 @@
import { ArrowLeft, Loader2, Play, RefreshCcw, Send } from 'lucide-react';
import { Loader2, Play, RefreshCcw, Send } from 'lucide-react';
import { useState } from 'react';
import type {
@@ -6,6 +6,7 @@ import type {
PuzzleClearWorkProfileResponse,
} from '../../../packages/shared/src/contracts/puzzleClear';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformMediaFrame } from '../common/PlatformMediaFrame';
import { PlatformMediaTileGrid } from '../common/PlatformMediaTileGrid';
import { PlatformStatGrid } from '../common/PlatformStatGrid';
@@ -74,15 +75,10 @@ export function PuzzleClearResultView({
return (
<div className="platform-remap-surface mx-auto flex h-full min-h-0 w-full max-w-6xl flex-col px-3 pb-3 pt-3 sm:px-4 sm:pt-4">
<div className="mb-3 flex items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
tone="ghost"
size="xs"
className="min-h-0 gap-2 py-2 text-sm"
>
<ArrowLeft className="h-4 w-4" />
</PlatformActionButton>
variant="regular"
/>
<PlatformActionButton
onClick={onRegenerateAtlas}
disabled={isBusy}

View File

@@ -100,6 +100,29 @@ test('renders missing draft notice with shared PlatformEmptyState chrome', () =>
expect(noticePanel?.className).toContain('text-[var(--platform-text-soft)]');
});
test('renders shared compact back action button in result header', () => {
const onBack = vi.fn();
render(
<PuzzleResultView
session={createSession()}
onBack={onBack}
onExecuteAction={() => {}}
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-[11px]');
expect(backButton.className).toContain('gap-1.5');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-3.5');
fireEvent.click(backButton);
expect(onBack).toHaveBeenCalledTimes(1);
});
function createSession(
overrides: Partial<PuzzleAgentSessionSnapshot> = {},
): PuzzleAgentSessionSnapshot {

View File

@@ -1,5 +1,4 @@
import {
ArrowLeft,
CheckCircle2,
Loader2,
MessageSquareText,
@@ -23,6 +22,7 @@ import { readPuzzleReferenceImageAsDataUrl } from '../../services/puzzleReferenc
import { useAuthUi } from '../auth/AuthUiContext';
import { CreativeImageInputPanel } from '../common/CreativeImageInputPanel';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformEmptyState } from '../common/PlatformEmptyState';
import { PlatformFieldLabel } from '../common/PlatformFieldLabel';
import { PlatformIconBadge } from '../common/PlatformIconBadge';
@@ -425,18 +425,11 @@ function PuzzleResultHeader({
return (
<div className="mb-4 flex items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
disabled={isBusy}
tone="ghost"
size="xs"
className="min-h-0 self-start py-1.5 text-[11px]"
>
<span className="inline-flex items-center gap-1.5">
<ArrowLeft className="h-3.5 w-3.5" />
</span>
</PlatformActionButton>
variant="compact"
/>
{autoSaveBadge}
</div>
);

View File

@@ -98,6 +98,12 @@ test('square hole result view exposes test run and publish actions', async () =>
expect(screen.getByRole('button', { name: '试玩' })).toBeTruthy();
expect(screen.getByRole('button', { name: '发布' })).toBeTruthy();
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-[11px]');
expect(backButton.className).toContain('gap-1.5');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-3.5');
await user.clear(screen.getByLabelText('游戏名称'));
await user.type(screen.getByLabelText('游戏名称'), '几何新挑战');
@@ -109,7 +115,7 @@ test('square hole result view exposes test run and publish actions', async () =>
await user.type(holePromptInput, '圆形洞口贴图');
await user.click(screen.getByRole('button', { name: '试玩' }));
await user.click(screen.getByRole('button', { name: '发布' }));
await user.click(screen.getByRole('button', { name: '返回' }));
await user.click(backButton);
await waitFor(() => {
expect(onStartTestRun).toHaveBeenCalledTimes(1);

View File

@@ -1,5 +1,4 @@
import {
ArrowLeft,
CheckCircle2,
ImagePlus,
Images,
@@ -30,6 +29,7 @@ import {
} from '../../services/square-hole-works';
import { useAuthUi } from '../auth/AuthUiContext';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformAssetPickerGrid } from '../common/PlatformAssetPickerCard';
import { PlatformFieldLabel } from '../common/PlatformFieldLabel';
import { PlatformIconButton } from '../common/PlatformIconButton';
@@ -467,16 +467,11 @@ function SquareHoleResultHeader({
return (
<div className="mb-4 flex items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
disabled={isBusy}
tone="ghost"
size="xs"
className="min-h-0 self-start gap-1.5 px-3 py-1.5 text-[11px]"
>
<ArrowLeft className="h-3.5 w-3.5" />
</PlatformActionButton>
variant="compact"
/>
{badge}
</div>
);

View File

@@ -42,6 +42,31 @@ test('visual novel profile tab uses PlatformSubpanel shells', () => {
expect(workTitlePanel?.className).toContain('rounded-[1.35rem]');
});
test('visual novel result header back button reuses shared compact back action button', async () => {
const user = userEvent.setup();
const onBack = vi.fn();
render(
<VisualNovelResultView
draft={mockVisualNovelDraft}
onBack={onBack}
isBusy
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-[11px]');
expect(backButton.className).toContain('gap-1.5');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-3.5');
expect((backButton as HTMLButtonElement).disabled).toBe(true);
await user.click(backButton);
expect(onBack).not.toHaveBeenCalled();
});
test('visual novel profile media previews use PlatformMediaFrame aspects', () => {
const draftWithCover = {
...mockVisualNovelDraft,

View File

@@ -1,5 +1,4 @@
import {
ArrowLeft,
CheckCircle2,
ImagePlus,
Images,
@@ -42,6 +41,7 @@ import {
} from '../../services/visual-novel-creation';
import { useAuthUi } from '../auth/AuthUiContext';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformAssetPickerGrid } from '../common/PlatformAssetPickerCard';
import { PlatformEmptyState } from '../common/PlatformEmptyState';
import { PlatformFieldLabel } from '../common/PlatformFieldLabel';
@@ -2058,16 +2058,11 @@ export function VisualNovelResultView({
return (
<div className="platform-remap-surface mx-auto flex h-full min-h-0 w-full flex-col xl:max-w-[min(100%,96rem)]">
<div className="mb-4 flex items-center justify-between gap-3">
<PlatformActionButton
tone="ghost"
size="xs"
<PlatformBackActionButton
onClick={onBack}
disabled={isBusy}
className="min-h-0 self-start px-3 py-1.5 text-[11px]"
>
<ArrowLeft className="h-3.5 w-3.5" />
</PlatformActionButton>
variant="compact"
/>
<div className="flex items-center gap-2">
<PlatformIconButton
disabled={isBusy}

View File

@@ -115,3 +115,29 @@ test('结果页支持在试玩前编辑并保存主题信息', async () => {
});
await waitFor(() => expect(onStartTestRun).toHaveBeenCalledTimes(1));
});
test('结果页头部返回按钮复用共享 back action button', () => {
const onBack = vi.fn();
render(
<WoodenFishResultView
profile={createDraft()}
onBack={onBack}
onEdit={() => {}}
onStartTestRun={() => {}}
onPublish={() => {}}
onRegenerateHitObject={() => {}}
/>,
);
const backButton = screen.getByRole('button', { name: '返回' });
expect(backButton.className).toContain('platform-button--ghost');
expect(backButton.className).toContain('text-sm');
expect(backButton.className).toContain('gap-2');
expect(backButton.querySelector('svg')?.className.baseVal).toContain('h-4');
fireEvent.click(backButton);
expect(onBack).toHaveBeenCalledTimes(1);
});

View File

@@ -11,6 +11,7 @@ import {
WOODEN_FISH_DEFAULT_HIT_SOUND_ASSET,
} from '../../services/wooden-fish/woodenFishDefaults';
import { PlatformActionButton } from '../common/PlatformActionButton';
import { PlatformBackActionButton } from '../common/PlatformBackActionButton';
import { PlatformMediaFrame } from '../common/PlatformMediaFrame';
import { PlatformPillBadge } from '../common/PlatformPillBadge';
import { PlatformStatusMessage } from '../common/PlatformStatusMessage';
@@ -206,15 +207,10 @@ export function WoodenFishResultView({
return (
<div className="platform-remap-surface mx-auto flex h-full min-h-0 w-full max-w-5xl flex-col px-3 pb-3 pt-3 sm:px-4 sm:pt-4">
<div className="mb-3 flex items-center justify-between gap-3">
<PlatformActionButton
<PlatformBackActionButton
onClick={onBack}
tone="ghost"
size="xs"
className="min-h-0 gap-2 py-2 text-sm"
>
<ArrowLeft className="h-4 w-4" />
</PlatformActionButton>
variant="regular"
/>
<PlatformActionButton
onClick={onRegenerateHitObject}
disabled={isBusy}