引导移动端创作主页使用桌面端

移动端直达 /creation 时展示桌面端打开引导

补充移动端创作主页回归测试

同步创作主页与玩法链路文档口径
This commit is contained in:
2026-06-22 19:09:55 +08:00
parent 7b2903496e
commit b03b6b0c13
5 changed files with 78 additions and 9 deletions
@@ -1,4 +1,4 @@
import { Loader2 } from 'lucide-react';
import { Home, Loader2, Monitor } from 'lucide-react';
import { AnimatePresence, motion } from 'motion/react';
import {
@@ -1636,6 +1636,45 @@ function CreationResultRecoveryPanel({
);
}
function MobileCreationDesktopGuide({
onReturnHome,
}: {
onReturnHome: () => void;
}) {
return (
<main
className="flex min-h-full flex-1 items-center justify-center px-4 py-8"
aria-label="桌面端创作提示"
>
<PlatformSubpanel
as="section"
radius="xl"
padding="none"
className="platform-remap-surface w-full max-w-sm px-5 py-6 text-center"
>
<span className="mx-auto flex h-14 w-14 items-center justify-center rounded-[1.05rem] bg-[rgba(199,101,50,0.12)] text-[var(--platform-accent-strong)]">
<Monitor aria-hidden="true" className="h-7 w-7" />
</span>
<h1 className="mt-4 text-xl font-black leading-tight text-[var(--platform-text-strong)]">
</h1>
<p className="mt-3 text-sm font-semibold leading-6 text-[var(--platform-text-base)]">
</p>
<PlatformActionButton
onClick={onReturnHome}
size="md"
shape="pill"
className="mt-5 min-h-11 w-full"
>
<Home aria-hidden="true" className="h-4 w-4" />
</PlatformActionButton>
</PlatformSubpanel>
</main>
);
}
export function PlatformEntryFlowShellImpl({
selectionStage,
setSelectionStage,
@@ -15238,7 +15277,7 @@ export function PlatformEntryFlowShellImpl({
'works-only',
'正在加载草稿列表...',
);
const creationLandingContent = (
const creationLandingContent = isDesktopLayout ? (
<Suspense fallback={<LazyPanelFallback label="正在加载创作主页..." />}>
<CreationLandingView
onOpenProject={openEditorProject}
@@ -15250,6 +15289,14 @@ export function PlatformEntryFlowShellImpl({
]}
/>
</Suspense>
) : (
<MobileCreationDesktopGuide
onReturnHome={() => {
pushAppHistoryPath('/');
platformBootstrap.setPlatformTab('home');
setSelectionStage('platform', { path: '/' });
}}
/>
);
const projectGalleryContent = (
<Suspense fallback={<LazyPanelFallback label="正在加载项目..." />}>
@@ -9267,13 +9267,22 @@ test('project page header can return to main site', async () => {
expect(window.location.pathname).toBe('/');
});
test('direct mobile creation home keeps landing content without mobile nav entry', async () => {
test('direct mobile creation home guides users to desktop without mobile nav entry', async () => {
const user = userEvent.setup();
window.history.replaceState(null, '', '/creation');
const { container } = render(<TestWrapper withAuth />);
expect(
await screen.findByRole('main', { name: '陶泥儿创作主页' }),
await screen.findByRole('main', { name: '桌面端创作提示' }),
).toBeTruthy();
expect(screen.getByText('请在桌面端打开创作主页')).toBeTruthy();
expect(
screen.getByText('图片画布、项目管理和素材库需要更大的操作空间。'),
).toBeTruthy();
expect(
screen.queryByRole('main', { name: '陶泥儿创作主页' }),
).toBeNull();
const bottomNav = container.querySelector('.platform-bottom-nav');
expect(bottomNav).toBeTruthy();
expect(
@@ -9282,6 +9291,15 @@ test('direct mobile creation home keeps landing content without mobile nav entry
expect(
within(bottomNav as HTMLElement).queryByRole('button', { name: '项目' }),
).toBeNull();
await user.click(screen.getByRole('button', { name: //u }));
await waitFor(() => {
expect(window.location.pathname).toBe('/');
expect(
screen.queryByRole('main', { name: '桌面端创作提示' }),
).toBeNull();
});
});
test('embedded puzzle form timeout exits busy state and shows a readable error', async () => {