refactor: 收口创作直达恢复目标

This commit is contained in:
2026-06-04 01:57:13 +08:00
parent dbc00be2cc
commit a504da1e32
7 changed files with 213 additions and 27 deletions

View File

@@ -409,6 +409,7 @@ import {
buildWoodenFishCreationUrlState,
hasPuzzleRuntimeUrlStateValue,
normalizeCreationUrlValue,
resolveCreationUrlRestoreTarget,
resolveInitialCreationUrlRestoreDecision,
} from './platformCreationUrlStateModel';
import { resolvePlatformCreationWorkDeleteConfirmationModel } from './platformCreationWorkDeleteFlow';
@@ -12142,21 +12143,17 @@ export function PlatformEntryFlowShellImpl({
handledInitialCreationUrlStateRef.current = true;
const restoreCreationUrlState = async () => {
const path = window.location.pathname;
const sessionId = normalizeCreationUrlValue(
initialCreationUrlState.sessionId,
const target = resolveCreationUrlRestoreTarget(
window.location.pathname,
initialCreationUrlState,
);
const profileId = normalizeCreationUrlValue(
initialCreationUrlState.profileId,
);
const draftId = normalizeCreationUrlValue(
initialCreationUrlState.draftId,
);
const workId = normalizeCreationUrlValue(initialCreationUrlState.workId);
if (!target) {
return;
}
const { sessionId, profileId, draftId, workId } = target;
if (path.startsWith('/creation/big-fish')) {
const targetSessionId =
sessionId ?? workId?.replace(/^big-fish-work-/u, '');
if (target.kind === 'big-fish') {
const targetSessionId = target.bigFishSessionId;
if (targetSessionId) {
const matchedWork =
(bigFishWorks.length > 0
@@ -12176,7 +12173,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/match3d')) {
if (target.kind === 'match3d') {
const matchedWork =
(match3dWorks.length > 0
? match3dWorks
@@ -12199,7 +12196,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/square-hole')) {
if (target.kind === 'square-hole') {
const matchedWork =
(squareHoleWorks.length > 0
? squareHoleWorks
@@ -12220,7 +12217,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/puzzle')) {
if (target.kind === 'puzzle') {
const matchedWork =
(puzzleWorks.length > 0
? puzzleWorks
@@ -12241,7 +12238,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/visual-novel')) {
if (target.kind === 'visual-novel') {
const matchedWork =
(visualNovelWorks.length > 0
? visualNovelWorks
@@ -12257,7 +12254,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/bark-battle')) {
if (target.kind === 'bark-battle') {
const matchedWork =
(barkBattleWorks.length > 0
? barkBattleWorks
@@ -12271,7 +12268,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/baby-object-match')) {
if (target.kind === 'baby-object-match') {
const matchedDraft =
(babyObjectMatchDrafts.length > 0
? babyObjectMatchDrafts
@@ -12288,7 +12285,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/jump-hop')) {
if (target.kind === 'jump-hop') {
let session: JumpHopSessionSnapshotResponse | null = null;
let work: JumpHopWorkProfileResponse | null = null;
try {
@@ -12316,7 +12313,7 @@ export function PlatformEntryFlowShellImpl({
);
enterCreateTab();
setSelectionStage(
path.includes('/generating')
target.isGeneratingPath
? 'jump-hop-generating'
: session?.draft || work
? 'jump-hop-result'
@@ -12330,7 +12327,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
if (path.startsWith('/creation/wooden-fish')) {
if (target.kind === 'wooden-fish') {
if (!sessionId) {
return;
}
@@ -12347,7 +12344,7 @@ export function PlatformEntryFlowShellImpl({
);
enterCreateTab();
setSelectionStage(
path.includes('/generating')
target.isGeneratingPath
? 'wooden-fish-generating'
: session.draft
? 'wooden-fish-result'