创作数据流程收束

This commit is contained in:
2026-04-21 09:44:17 +08:00
parent effe0355bd
commit 3614e1f5a2
93 changed files with 1794 additions and 8651 deletions

View File

@@ -9,7 +9,7 @@ describe('matchAppRoute', () => {
});
});
it('routes deprecated editor paths back to the main game', () => {
it('routes former standalone editor paths back to the main game', () => {
expect(matchAppRoute('/item-editor/tools')).toEqual({
kind: 'game',
});
@@ -26,10 +26,4 @@ describe('matchAppRoute', () => {
kind: 'game',
});
});
it('keeps the sprite tool route', () => {
expect(matchAppRoute('/sprite-tool')).toEqual({
kind: 'qwen-sprite-tool',
});
});
});

View File

@@ -9,9 +9,6 @@ type AppRouteComponent = LazyExoticComponent<
export type AppRouteMatch =
| {
kind: 'game';
}
| {
kind: 'qwen-sprite-tool';
};
export type ResolvedAppRoute = {
@@ -23,15 +20,6 @@ export type ResolvedAppRoute = {
};
const GameApp = lazy(() => import('../AuthenticatedApp')) as AppRouteComponent;
const QwenSpriteToolApp = lazy(
() => import('../tools/QwenSpriteSheetTool'),
) as AppRouteComponent;
const QWEN_SPRITE_TOOL_PREFIXES = [
'/qwen-sprite-tool',
'/sprite-tool',
'/pixelmotion-qwen',
];
function normalizeRoutePath(pathname: string) {
const trimmedPathname = pathname.trim().toLowerCase();
@@ -43,25 +31,8 @@ function normalizeRoutePath(pathname: string) {
return trimmedPathname.replace(/\/+$/u, '');
}
function matchesRoutePrefix(pathname: string, prefix: string) {
const normalizedPrefix = normalizeRoutePath(prefix);
return (
pathname === normalizedPrefix || pathname.startsWith(`${normalizedPrefix}/`)
);
}
export function matchAppRoute(pathname: string): AppRouteMatch {
const normalizedPathname = normalizeRoutePath(pathname);
const isQwenSpriteToolRoute = QWEN_SPRITE_TOOL_PREFIXES.some((prefix) =>
matchesRoutePrefix(normalizedPathname, prefix),
);
if (isQwenSpriteToolRoute) {
return {
kind: 'qwen-sprite-tool',
};
}
void normalizeRoutePath(pathname);
return {
kind: 'game',
@@ -71,15 +42,6 @@ export function matchAppRoute(pathname: string): AppRouteMatch {
export function resolveAppRoute(pathname: string): ResolvedAppRoute {
const matchedRoute = matchAppRoute(pathname);
if (matchedRoute.kind === 'qwen-sprite-tool') {
return {
kind: matchedRoute.kind,
loadingEyebrow: '正在载入精灵表工坊',
loadingText: '正在载入 Qwen 精灵表工具...',
Component: QwenSpriteToolApp,
};
}
return {
kind: 'game',
loadingEyebrow: '正在载入游戏',