fix: complete jump-hop frontend wiring
This commit is contained in:
@@ -716,6 +716,12 @@ function mapVisualNovelWorkToPublicWorkDetail(
|
||||
return mapVisualNovelWorkToPlatformGalleryCard(item);
|
||||
}
|
||||
|
||||
function mapJumpHopWorkToPublicWorkDetail(
|
||||
item: JumpHopGalleryCardResponse | JumpHopWorkProfileResponse,
|
||||
): PlatformPublicGalleryCard {
|
||||
return mapJumpHopWorkToPlatformGalleryCard(item);
|
||||
}
|
||||
|
||||
function mapBarkBattleWorkToPublicWorkDetail(
|
||||
item: BarkBattleWorkSummary,
|
||||
): PlatformPublicGalleryCard {
|
||||
@@ -2563,6 +2569,22 @@ export function PlatformEntryFlowShellImpl({
|
||||
useState(false);
|
||||
const [squareHoleGenerationState, setSquareHoleGenerationState] =
|
||||
useState<MiniGameDraftGenerationState | null>(null);
|
||||
const [jumpHopSession, setJumpHopSession] =
|
||||
useState<JumpHopSessionSnapshotResponse | null>(null);
|
||||
const [jumpHopRun, setJumpHopRun] = useState<
|
||||
JumpHopRunResponse['run'] | null
|
||||
>(null);
|
||||
const [jumpHopWork, setJumpHopWork] =
|
||||
useState<JumpHopWorkProfileResponse | null>(null);
|
||||
const [jumpHopGalleryEntries, setJumpHopGalleryEntries] = useState<
|
||||
JumpHopGalleryCardResponse[]
|
||||
>([]);
|
||||
const [jumpHopRuntimeReturnStage, setJumpHopRuntimeReturnStage] =
|
||||
useState<JumpHopRuntimeReturnStage>('jump-hop-result');
|
||||
const [jumpHopGenerationState, setJumpHopGenerationState] =
|
||||
useState<MiniGameDraftGenerationState | null>(null);
|
||||
const [jumpHopError, setJumpHopError] = useState<string | null>(null);
|
||||
const [isJumpHopBusy, setIsJumpHopBusy] = useState(false);
|
||||
const [barkBattleWorks, setBarkBattleWorks] = useState<
|
||||
BarkBattleWorkSummary[]
|
||||
>([]);
|
||||
@@ -3674,6 +3696,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
...match3dGalleryEntries.map(mapMatch3DWorkToPublicWorkDetail),
|
||||
...puzzleGalleryEntries.map(mapPuzzleWorkToPlatformGalleryCard),
|
||||
...barkBattleGalleryEntries.map(mapBarkBattleWorkToPlatformGalleryCard),
|
||||
...jumpHopGalleryEntries.map(mapJumpHopWorkToPlatformGalleryCard),
|
||||
...(barkBattleGalleryEntries.length === 0
|
||||
? barkBattleWorks
|
||||
.filter((work) => work.status === 'published')
|
||||
|
||||
@@ -31,6 +31,11 @@ export type SelectionStage =
|
||||
| 'square-hole-generating'
|
||||
| 'square-hole-result'
|
||||
| 'square-hole-runtime'
|
||||
| 'jump-hop-workspace'
|
||||
| 'jump-hop-generating'
|
||||
| 'jump-hop-result'
|
||||
| 'jump-hop-runtime'
|
||||
| 'jump-hop-gallery-detail'
|
||||
| 'bark-battle-generating'
|
||||
| 'bark-battle-result'
|
||||
| 'bark-battle-runtime'
|
||||
|
||||
@@ -1910,7 +1910,9 @@ function describePublicGalleryCardKind(entry: PlatformPublicGalleryCard) {
|
||||
? '汪汪'
|
||||
: isEdutainmentGalleryEntry(entry)
|
||||
? entry.templateName
|
||||
: describePlatformThemeLabel(entry.themeMode);
|
||||
: isJumpHopGalleryEntry(entry)
|
||||
? '跳一跳'
|
||||
: describePlatformThemeLabel(entry.themeMode);
|
||||
return formatPlatformWorkDisplayTag(kind);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,4 +17,37 @@ describe('appPageRoutes', () => {
|
||||
'/profile/feedback',
|
||||
);
|
||||
});
|
||||
|
||||
it('resolves jump-hop creation, gallery and runtime routes', () => {
|
||||
expect(resolveSelectionStageFromPath('/creation/jump-hop/workspace')).toBe(
|
||||
'jump-hop-workspace',
|
||||
);
|
||||
expect(resolveSelectionStageFromPath('/creation/jump-hop/generating')).toBe(
|
||||
'jump-hop-generating',
|
||||
);
|
||||
expect(resolveSelectionStageFromPath('/creation/jump-hop/result')).toBe(
|
||||
'jump-hop-result',
|
||||
);
|
||||
expect(resolveSelectionStageFromPath('/gallery/jump-hop/detail')).toBe(
|
||||
'jump-hop-gallery-detail',
|
||||
);
|
||||
expect(resolveSelectionStageFromPath('/runtime/jump-hop')).toBe(
|
||||
'jump-hop-runtime',
|
||||
);
|
||||
expect(resolvePathForSelectionStage('jump-hop-workspace')).toBe(
|
||||
'/creation/jump-hop/workspace',
|
||||
);
|
||||
expect(resolvePathForSelectionStage('jump-hop-generating')).toBe(
|
||||
'/creation/jump-hop/generating',
|
||||
);
|
||||
expect(resolvePathForSelectionStage('jump-hop-result')).toBe(
|
||||
'/creation/jump-hop/result',
|
||||
);
|
||||
expect(resolvePathForSelectionStage('jump-hop-gallery-detail')).toBe(
|
||||
'/gallery/jump-hop/detail',
|
||||
);
|
||||
expect(resolvePathForSelectionStage('jump-hop-runtime')).toBe(
|
||||
'/runtime/jump-hop',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,6 +21,11 @@ const STAGE_ROUTE_ENTRIES = [
|
||||
['square-hole-agent-workspace', '/creation/square-hole/agent'],
|
||||
['square-hole-result', '/creation/square-hole/result'],
|
||||
['square-hole-runtime', '/runtime/square-hole'],
|
||||
['jump-hop-workspace', '/creation/jump-hop/workspace'],
|
||||
['jump-hop-generating', '/creation/jump-hop/generating'],
|
||||
['jump-hop-result', '/creation/jump-hop/result'],
|
||||
['jump-hop-gallery-detail', '/gallery/jump-hop/detail'],
|
||||
['jump-hop-runtime', '/runtime/jump-hop'],
|
||||
['bark-battle-generating', '/creation/bark-battle/generating'],
|
||||
['bark-battle-result', '/creation/bark-battle/result'],
|
||||
['bark-battle-runtime', '/runtime/bark-battle'],
|
||||
|
||||
26
src/services/publicWorkCode.test.ts
Normal file
26
src/services/publicWorkCode.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
buildJumpHopPublicWorkCode,
|
||||
isSameJumpHopPublicWorkCode,
|
||||
} from './publicWorkCode';
|
||||
|
||||
describe('publicWorkCode', () => {
|
||||
it('builds and matches jump-hop public work codes from profile ids', () => {
|
||||
expect(buildJumpHopPublicWorkCode('jump-hop-profile-12345678')).toBe(
|
||||
'JH-12345678',
|
||||
);
|
||||
expect(
|
||||
isSameJumpHopPublicWorkCode(
|
||||
'jh-12345678',
|
||||
'jump-hop-profile-12345678',
|
||||
),
|
||||
).toBe(true);
|
||||
expect(
|
||||
isSameJumpHopPublicWorkCode(
|
||||
'jump hop profile 12345678',
|
||||
'jump-hop-profile-12345678',
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -67,6 +67,14 @@ export function buildBarkBattlePublicWorkCode(workId: string) {
|
||||
return `BB-${normalizeBarkBattlePublicWorkCodeSuffix(workId)}`;
|
||||
}
|
||||
|
||||
export function buildJumpHopPublicWorkCode(profileId: string) {
|
||||
const normalized = normalizePublicCodeText(profileId);
|
||||
const fallback = normalized || '00000000';
|
||||
const suffix = fallback.slice(-8).padStart(8, '0');
|
||||
|
||||
return `JH-${suffix}`;
|
||||
}
|
||||
|
||||
export function isSamePuzzlePublicWorkCode(keyword: string, profileId: string) {
|
||||
const normalizedKeyword = normalizePublicCodeText(keyword);
|
||||
|
||||
@@ -149,3 +157,13 @@ export function isSameBarkBattlePublicWorkCode(keyword: string, workId: string)
|
||||
normalizedKeyword === normalizeBarkBattlePublicWorkCodeSuffix(workId)
|
||||
);
|
||||
}
|
||||
|
||||
export function isSameJumpHopPublicWorkCode(keyword: string, profileId: string) {
|
||||
const normalizedKeyword = normalizePublicCodeText(keyword);
|
||||
|
||||
return (
|
||||
normalizedKeyword ===
|
||||
normalizePublicCodeText(buildJumpHopPublicWorkCode(profileId)) ||
|
||||
normalizedKeyword === normalizePublicCodeText(profileId)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user