收口运行态状态提示组件
新增 PlatformRuntimeStatusToast 统一运行态短错误、成功和反馈 toast 迁移跳一跳、拼图、敲木鱼、方洞和宝贝爱画运行态状态 chip 补充公共组件与运行态回归测试,并更新 PlatformUiKit 文档和 Hermes 决策记录
This commit is contained in:
@@ -200,6 +200,30 @@ test('拼图界面不调用 mocap,也不渲染 mocap 光标或调试面板', (
|
||||
expect(screen.queryByTestId('puzzle-mocap-cursor')).toBeNull();
|
||||
});
|
||||
|
||||
test('拼图运行态错误提示使用公共运行态 toast', () => {
|
||||
renderPuzzleRuntime(
|
||||
<PuzzleRuntimeShell
|
||||
run={{
|
||||
...clearedRun,
|
||||
currentLevel: {
|
||||
...clearedRun.currentLevel!,
|
||||
status: 'playing',
|
||||
},
|
||||
}}
|
||||
error="交换失败"
|
||||
onBack={vi.fn()}
|
||||
onSwapPieces={vi.fn()}
|
||||
onDragPiece={vi.fn()}
|
||||
onAdvanceNextLevel={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
const toast = screen.getByRole('alert');
|
||||
|
||||
expect(toast.textContent).toBe('交换失败');
|
||||
expect(toast.className).toContain('platform-runtime-status-toast');
|
||||
});
|
||||
|
||||
test('指针拖拽时会触发拖拽提交并在松开时落子', () => {
|
||||
const originalRequestAnimationFrame = window.requestAnimationFrame;
|
||||
const onDragPiece = vi.fn();
|
||||
|
||||
@@ -55,6 +55,7 @@ import {
|
||||
resolveRuntimeCountdownSecondBucket,
|
||||
} from '../../services/runtimeAudioFeedback';
|
||||
import { useAuthUi } from '../auth/AuthUiContext';
|
||||
import { PlatformRuntimeStatusToast } from '../common/PlatformRuntimeStatusToast';
|
||||
import { RuntimeResourcePendingMarker } from '../common/RuntimeResourcePendingMarker';
|
||||
import { ResolvedAssetImage } from '../ResolvedAssetImage';
|
||||
import {
|
||||
@@ -1987,9 +1988,9 @@ export function PuzzleRuntimeShell({
|
||||
|
||||
<div className="absolute bottom-0 left-0 z-20 flex w-full flex-col items-center gap-2 px-3 py-3 sm:px-4 sm:py-4">
|
||||
{error ? (
|
||||
<div className="puzzle-runtime-error-chip rounded-full px-3 py-1 text-xs">
|
||||
<PlatformRuntimeStatusToast tone="error" size="xs">
|
||||
{error}
|
||||
</div>
|
||||
</PlatformRuntimeStatusToast>
|
||||
) : null}
|
||||
{selectedPieceId &&
|
||||
shouldDisplaySelectedState &&
|
||||
@@ -2202,9 +2203,14 @@ export function PuzzleRuntimeShell({
|
||||
<div className="puzzle-runtime-dialog__body px-5 py-4 text-sm">
|
||||
消耗 1 泥点
|
||||
{propConfirmError ? (
|
||||
<div className="puzzle-runtime-error-chip mt-3 rounded-[0.9rem] border px-3 py-2 text-xs leading-5">
|
||||
<PlatformRuntimeStatusToast
|
||||
tone="error"
|
||||
size="xs"
|
||||
shape="rounded"
|
||||
className="mt-3"
|
||||
>
|
||||
{propConfirmError}
|
||||
</div>
|
||||
</PlatformRuntimeStatusToast>
|
||||
) : null}
|
||||
</div>
|
||||
<footer className="puzzle-runtime-dialog__line flex items-center justify-end gap-3 border-t px-5 py-4">
|
||||
|
||||
Reference in New Issue
Block a user