feat: add edutainment drawing and visual package flows
This commit is contained in:
@@ -30,6 +30,7 @@ const STAGE_ROUTE_ENTRIES = [
|
||||
['baby-object-match-generating', '/creation/baby-object-match/generating'],
|
||||
['baby-object-match-result', '/creation/baby-object-match/result'],
|
||||
['baby-object-match-runtime', '/runtime/baby-object-match'],
|
||||
['baby-love-drawing-runtime', '/runtime/baby-love-drawing'],
|
||||
['puzzle-agent-workspace', '/creation/puzzle/agent'],
|
||||
['puzzle-result', '/creation/puzzle/result'],
|
||||
['puzzle-gallery-detail', '/gallery/puzzle/detail'],
|
||||
|
||||
@@ -45,6 +45,20 @@ describe('matchAppRoute', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('routes baby love drawing path to the standalone runtime when edutainment is enabled', () => {
|
||||
expect(matchAppRoute('/runtime/baby-love-drawing')).toEqual({
|
||||
kind: 'baby-love-drawing',
|
||||
});
|
||||
});
|
||||
|
||||
it('blocks direct baby love drawing path when edutainment entry is disabled', () => {
|
||||
vi.stubEnv('VITE_ENABLE_EDUTAINMENT_ENTRY', 'false');
|
||||
|
||||
expect(matchAppRoute('/runtime/baby-love-drawing')).toEqual({
|
||||
kind: 'game',
|
||||
});
|
||||
});
|
||||
|
||||
it('routes former standalone editor paths back to the main game', () => {
|
||||
expect(matchAppRoute('/item-editor/tools')).toEqual({
|
||||
kind: 'game',
|
||||
|
||||
@@ -25,6 +25,9 @@ export type AppRouteMatch =
|
||||
| {
|
||||
kind: 'child-motion-demo';
|
||||
}
|
||||
| {
|
||||
kind: 'baby-love-drawing';
|
||||
}
|
||||
| {
|
||||
kind: 'game';
|
||||
};
|
||||
@@ -43,6 +46,9 @@ const Match3DPlaygroundApp = lazy(() => import('../Match3DPlaygroundApp')) as Ap
|
||||
const BarkBattlePlaygroundApp = lazy(() => import('../BarkBattlePlaygroundApp')) as AppRouteComponent;
|
||||
const PuzzlePlaygroundApp = lazy(() => import('../PuzzlePlaygroundApp')) as AppRouteComponent;
|
||||
const ChildMotionDemoApp = lazy(() => import('../ChildMotionDemoApp')) as AppRouteComponent;
|
||||
const BabyLoveDrawingRuntimeApp = lazy(
|
||||
() => import('../components/edutainment-runtime/BabyLoveDrawingRuntimeShell'),
|
||||
) as AppRouteComponent;
|
||||
|
||||
function normalizeRoutePath(pathname: string) {
|
||||
return normalizeAppPath(pathname);
|
||||
@@ -84,6 +90,15 @@ export function matchAppRoute(pathname: string): AppRouteMatch {
|
||||
};
|
||||
}
|
||||
|
||||
if (
|
||||
normalizedPath === '/runtime/baby-love-drawing' &&
|
||||
isEdutainmentEntryEnabled()
|
||||
) {
|
||||
return {
|
||||
kind: 'baby-love-drawing',
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
kind: 'game',
|
||||
};
|
||||
@@ -137,6 +152,15 @@ export function resolveAppRoute(pathname: string): ResolvedAppRoute {
|
||||
};
|
||||
}
|
||||
|
||||
if (matchedRoute.kind === 'baby-love-drawing') {
|
||||
return {
|
||||
kind: 'baby-love-drawing',
|
||||
loadingEyebrow: '正在载入宝贝爱画',
|
||||
loadingText: '正在进入画板...',
|
||||
Component: BabyLoveDrawingRuntimeApp,
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
kind: 'game',
|
||||
loadingEyebrow: '正在载入游戏',
|
||||
|
||||
Reference in New Issue
Block a user