合并 master 并保留外部生成 worker 模式
合入 master 的生产健康巡检、JumpHop 和 SpacetimeDB 更新 保留外部生成 worker、队列/内联模式与 lease guard 口径 合并 Server-Provision 工具复用、health patrol 和外部生成 worker systemd 配置 补齐 SpacetimeDB 生成绑定并通过本地检查
This commit is contained in:
@@ -372,9 +372,7 @@ import {
|
||||
type CreationWorkShelfItem,
|
||||
isPersistedBarkBattleDraftGenerating,
|
||||
} from '../custom-world-home/creationWorkShelf';
|
||||
import {
|
||||
selectAdjacentPlatformRecommendEntry,
|
||||
} from '../rpg-entry/rpgEntryPublicGalleryViewModel';
|
||||
import { selectAdjacentPlatformRecommendEntry } from '../rpg-entry/rpgEntryPublicGalleryViewModel';
|
||||
import {
|
||||
isBigFishGalleryEntry,
|
||||
isEdutainmentGalleryEntry,
|
||||
@@ -1328,7 +1326,9 @@ const PuzzleClearResultView = lazy(async () => {
|
||||
});
|
||||
|
||||
const PuzzleClearRuntimeShell = lazy(async () => {
|
||||
const module = await import('../puzzle-clear-runtime/PuzzleClearRuntimeShell');
|
||||
const module = await import(
|
||||
'../puzzle-clear-runtime/PuzzleClearRuntimeShell'
|
||||
);
|
||||
return {
|
||||
default: module.PuzzleClearRuntimeShell,
|
||||
};
|
||||
@@ -1848,6 +1848,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
const entries = creationEntryConfig?.creationTypes ?? [];
|
||||
return new Map(entries.map((entry) => [entry.id, entry]));
|
||||
}, [creationEntryConfig]);
|
||||
const publicWorkInteractions = useMemo(
|
||||
() => creationEntryConfig?.publicWorkInteractions ?? [],
|
||||
[creationEntryConfig],
|
||||
);
|
||||
const getUnifiedSpec = useCallback(
|
||||
(playId: UnifiedCreationPlayId) =>
|
||||
getUnifiedCreationSpec(playId, unifiedCreationConfigById.get(playId)),
|
||||
@@ -1903,6 +1907,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
shouldRestoreCustomWorldAgentUiState(),
|
||||
);
|
||||
const handledInitialPublicWorkCodeRef = useRef<string | null>(null);
|
||||
const handledJumpHopRuntimeRestoreRef = useRef<string | null>(null);
|
||||
const selectionStageRef = useRef(selectionStage);
|
||||
const creationFlowReturnTargetRef =
|
||||
useRef<CreationFlowReturnTarget>('create');
|
||||
@@ -3035,8 +3040,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
woodenFishGalleryEntries,
|
||||
],
|
||||
);
|
||||
const { featuredEntries: featuredGalleryEntries, latestEntries: latestGalleryEntries } =
|
||||
publicGalleryFeeds;
|
||||
const {
|
||||
featuredEntries: featuredGalleryEntries,
|
||||
latestEntries: latestGalleryEntries,
|
||||
} = publicGalleryFeeds;
|
||||
const recommendRuntimeEntries = useMemo(
|
||||
() =>
|
||||
buildPlatformRecommendedEntries({
|
||||
@@ -3219,23 +3226,22 @@ export function PlatformEntryFlowShellImpl({
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
const progressTickDecision =
|
||||
resolvePlatformGenerationProgressTickDecision({
|
||||
selectionStage,
|
||||
miniGameStates: {
|
||||
puzzle: puzzleGenerationState,
|
||||
match3d: match3dGenerationState,
|
||||
'big-fish': bigFishGenerationState,
|
||||
'square-hole': squareHoleGenerationState,
|
||||
'jump-hop': jumpHopGenerationState,
|
||||
'wooden-fish': woodenFishGenerationState,
|
||||
'baby-object-match': babyObjectMatchGenerationState,
|
||||
},
|
||||
visualNovel: {
|
||||
startedAtMs: visualNovelGenerationStartedAtMs,
|
||||
phase: visualNovelGenerationPhase,
|
||||
},
|
||||
});
|
||||
const progressTickDecision = resolvePlatformGenerationProgressTickDecision({
|
||||
selectionStage,
|
||||
miniGameStates: {
|
||||
puzzle: puzzleGenerationState,
|
||||
match3d: match3dGenerationState,
|
||||
'big-fish': bigFishGenerationState,
|
||||
'square-hole': squareHoleGenerationState,
|
||||
'jump-hop': jumpHopGenerationState,
|
||||
'wooden-fish': woodenFishGenerationState,
|
||||
'baby-object-match': babyObjectMatchGenerationState,
|
||||
},
|
||||
visualNovel: {
|
||||
startedAtMs: visualNovelGenerationStartedAtMs,
|
||||
phase: visualNovelGenerationPhase,
|
||||
},
|
||||
});
|
||||
|
||||
if (!progressTickDecision.shouldTick) {
|
||||
return undefined;
|
||||
@@ -3738,7 +3744,11 @@ export function PlatformEntryFlowShellImpl({
|
||||
markPendingDraftFailed('match3d', session.sessionId);
|
||||
markDraftFailed(
|
||||
'match3d',
|
||||
[session.draft?.profileId, session.publishedProfileId, session.sessionId],
|
||||
[
|
||||
session.draft?.profileId,
|
||||
session.publishedProfileId,
|
||||
session.sessionId,
|
||||
],
|
||||
errorMessage,
|
||||
);
|
||||
try {
|
||||
@@ -4020,7 +4030,11 @@ export function PlatformEntryFlowShellImpl({
|
||||
markPendingDraftFailed('square-hole', session.sessionId);
|
||||
markDraftFailed(
|
||||
'square-hole',
|
||||
[session.draft?.profileId, session.publishedProfileId, session.sessionId],
|
||||
[
|
||||
session.draft?.profileId,
|
||||
session.publishedProfileId,
|
||||
session.sessionId,
|
||||
],
|
||||
errorMessage,
|
||||
);
|
||||
void refreshSquareHoleShelf().catch(() => undefined);
|
||||
@@ -4100,15 +4114,18 @@ export function PlatformEntryFlowShellImpl({
|
||||
if (!isPuzzleCompileActionReady(response.session)) {
|
||||
const nextPayload =
|
||||
formPayload ?? buildPuzzleFormPayloadFromSession(response.session);
|
||||
const fallbackGenerationState = createPuzzleDraftGenerationStateFromPayload(
|
||||
nextPayload,
|
||||
response.session,
|
||||
);
|
||||
const nextGenerationState = mergePuzzleSessionProgressIntoGenerationState(
|
||||
puzzleGenerationState ?? fallbackGenerationState,
|
||||
response.session,
|
||||
);
|
||||
activePuzzleGenerationSessionIdRef.current = response.session.sessionId;
|
||||
const fallbackGenerationState =
|
||||
createPuzzleDraftGenerationStateFromPayload(
|
||||
nextPayload,
|
||||
response.session,
|
||||
);
|
||||
const nextGenerationState =
|
||||
mergePuzzleSessionProgressIntoGenerationState(
|
||||
puzzleGenerationState ?? fallbackGenerationState,
|
||||
response.session,
|
||||
);
|
||||
activePuzzleGenerationSessionIdRef.current =
|
||||
response.session.sessionId;
|
||||
setSelectionStage('puzzle-generating');
|
||||
markDraftGenerating('puzzle', [
|
||||
response.session.sessionId,
|
||||
@@ -7604,6 +7621,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
profileId: string,
|
||||
options: {
|
||||
embedded?: boolean;
|
||||
preloadedWork?: JumpHopWorkProfileResponse | null;
|
||||
returnStage?: 'work-detail' | 'platform';
|
||||
} = {},
|
||||
) => {
|
||||
@@ -7636,7 +7654,11 @@ export function PlatformEntryFlowShellImpl({
|
||||
: null,
|
||||
);
|
||||
const [detail, runResponse] = await Promise.all([
|
||||
jumpHopClient.getWorkDetail(normalizedProfileId).catch(() => null),
|
||||
options.preloadedWork
|
||||
? Promise.resolve({ item: options.preloadedWork })
|
||||
: jumpHopClient
|
||||
.getWorkDetail(normalizedProfileId)
|
||||
.catch(() => null),
|
||||
jumpHopClient.startRun(normalizedProfileId, {
|
||||
...runtimeGuestOptions,
|
||||
runtimeMode: 'published',
|
||||
@@ -7668,6 +7690,78 @@ export function PlatformEntryFlowShellImpl({
|
||||
[authUi, setSelectionStage],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectionStage !== 'jump-hop-runtime' || jumpHopRun) {
|
||||
return;
|
||||
}
|
||||
|
||||
const publicWorkCode = initialPublicWorkCode?.trim() ?? '';
|
||||
const restoreKey = publicWorkCode || '__jump-hop-runtime-empty__';
|
||||
if (handledJumpHopRuntimeRestoreRef.current === restoreKey) {
|
||||
return;
|
||||
}
|
||||
handledJumpHopRuntimeRestoreRef.current = restoreKey;
|
||||
|
||||
if (!publicWorkCode) {
|
||||
setJumpHopError(null);
|
||||
setJumpHopRuntimeRequestOptions(null);
|
||||
setJumpHopRuntimeReturnStage('platform');
|
||||
setSelectionStage('platform');
|
||||
pushAppHistoryPath('/');
|
||||
return;
|
||||
}
|
||||
|
||||
let cancelled = false;
|
||||
|
||||
const restoreJumpHopRuntime = async () => {
|
||||
setIsJumpHopBusy(true);
|
||||
setJumpHopError(null);
|
||||
try {
|
||||
const detail = await jumpHopClient.getGalleryDetail(publicWorkCode);
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
const profileId = detail.item.summary.profileId;
|
||||
const started = await startJumpHopRunFromProfile(profileId, {
|
||||
preloadedWork: detail.item,
|
||||
returnStage: 'work-detail',
|
||||
});
|
||||
if (!started && !cancelled) {
|
||||
setSelectionStage('platform');
|
||||
pushAppHistoryPath('/');
|
||||
}
|
||||
} catch (error) {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
setJumpHopError(
|
||||
resolveRpgCreationErrorMessage(error, '恢复跳一跳玩法失败。'),
|
||||
);
|
||||
setJumpHopRun(null);
|
||||
setJumpHopRuntimeRequestOptions(null);
|
||||
setJumpHopRuntimeReturnStage('platform');
|
||||
setSelectionStage('platform');
|
||||
pushAppHistoryPath('/');
|
||||
} finally {
|
||||
if (!cancelled) {
|
||||
setIsJumpHopBusy(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void restoreJumpHopRuntime();
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [
|
||||
initialPublicWorkCode,
|
||||
jumpHopRun,
|
||||
selectionStage,
|
||||
setSelectionStage,
|
||||
startJumpHopRunFromProfile,
|
||||
]);
|
||||
|
||||
const restartJumpHopRuntimeRun = useCallback(async () => {
|
||||
const runId = jumpHopRun?.runId;
|
||||
if (!runId) {
|
||||
@@ -7787,8 +7881,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
...current.filter(
|
||||
(item) =>
|
||||
item.workId !== response.work!.summary.workId &&
|
||||
item.sourceSessionId !==
|
||||
response.work!.summary.sourceSessionId,
|
||||
item.sourceSessionId !== response.work!.summary.sourceSessionId,
|
||||
),
|
||||
]);
|
||||
markPendingDraftReady(
|
||||
@@ -7910,7 +8003,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
workTitle: puzzleClearSession.draft?.workTitle,
|
||||
workDescription: puzzleClearSession.draft?.workDescription,
|
||||
themePrompt: puzzleClearSession.draft?.themePrompt,
|
||||
boardBackgroundPrompt: puzzleClearSession.draft?.boardBackgroundPrompt,
|
||||
boardBackgroundPrompt:
|
||||
puzzleClearSession.draft?.boardBackgroundPrompt,
|
||||
generateBoardBackground:
|
||||
puzzleClearSession.draft?.generateBoardBackground,
|
||||
boardBackgroundAsset: puzzleClearSession.draft?.boardBackgroundAsset,
|
||||
@@ -7935,11 +8029,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
);
|
||||
setPuzzleClearError(errorMessage);
|
||||
setPuzzleClearGenerationState(
|
||||
resolveFinishedMiniGameDraftGenerationState(
|
||||
generationState,
|
||||
'failed',
|
||||
{ error: errorMessage },
|
||||
),
|
||||
resolveFinishedMiniGameDraftGenerationState(generationState, 'failed', {
|
||||
error: errorMessage,
|
||||
}),
|
||||
);
|
||||
} finally {
|
||||
setIsPuzzleClearBusy(false);
|
||||
@@ -7966,7 +8058,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
setPuzzleClearWork(response.item);
|
||||
setPuzzleClearWorks((current) => [
|
||||
response.item.summary,
|
||||
...current.filter((item) => item.workId !== response.item.summary.workId),
|
||||
...current.filter(
|
||||
(item) => item.workId !== response.item.summary.workId,
|
||||
),
|
||||
]);
|
||||
void refreshPuzzleClearShelf();
|
||||
void refreshPuzzleClearGallery();
|
||||
@@ -7979,7 +8073,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
setPublicWorkDetailError(null);
|
||||
selectionStageRef.current = 'work-detail';
|
||||
setSelectionStage('work-detail');
|
||||
pushAppHistoryPath(buildPublicWorkStagePath('work-detail', publicWorkCode));
|
||||
pushAppHistoryPath(
|
||||
buildPublicWorkStagePath('work-detail', publicWorkCode),
|
||||
);
|
||||
openPublishShareModal({
|
||||
title: response.item.summary.workTitle || '拼消消',
|
||||
publicWorkCode,
|
||||
@@ -8081,7 +8177,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
return;
|
||||
}
|
||||
setPuzzleClearError(null);
|
||||
setPuzzleClearRun(retryPuzzleClearLocalLevel(puzzleClearRun, puzzleClearWork));
|
||||
setPuzzleClearRun(
|
||||
retryPuzzleClearLocalLevel(puzzleClearRun, puzzleClearWork),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10854,7 +10952,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
setIsPublicWorkDetailBusy(true);
|
||||
setPublicWorkDetailError(null);
|
||||
|
||||
const intent = resolvePlatformPublicWorkLikeIntent(entry);
|
||||
const intent = resolvePlatformPublicWorkLikeIntent(
|
||||
entry,
|
||||
publicWorkInteractions,
|
||||
);
|
||||
|
||||
if (intent.type === 'like-big-fish') {
|
||||
void likeBigFishGalleryWork(intent.profileId)
|
||||
@@ -10964,6 +11065,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
[
|
||||
isPublicWorkDetailBusy,
|
||||
platformBootstrap,
|
||||
publicWorkInteractions,
|
||||
resolveBigFishErrorMessage,
|
||||
resolvePuzzleErrorMessage,
|
||||
runProtectedAction,
|
||||
@@ -11250,7 +11352,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
notices: draftGenerationNotices,
|
||||
generation: {
|
||||
activeSessionId: jumpHopSession?.sessionId,
|
||||
hasActiveGenerationFailure: jumpHopGenerationState?.phase === 'failed',
|
||||
hasActiveGenerationFailure:
|
||||
jumpHopGenerationState?.phase === 'failed',
|
||||
},
|
||||
});
|
||||
markDraftNoticeSeen(openIntent.noticeKeys);
|
||||
@@ -11334,7 +11437,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
try {
|
||||
const detail = await puzzleClearClient.getRuntimeWorkDetail(profileId);
|
||||
setPuzzleClearWork(detail.item);
|
||||
openPublicWorkDetail(mapPuzzleClearWorkToPlatformGalleryCard(detail.item));
|
||||
openPublicWorkDetail(
|
||||
mapPuzzleClearWorkToPlatformGalleryCard(detail.item),
|
||||
);
|
||||
} catch (error) {
|
||||
setPublicWorkDetailError(
|
||||
resolveRpgCreationErrorMessage(error, '读取拼消消详情失败。'),
|
||||
@@ -11636,8 +11741,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
notices: draftGenerationNotices,
|
||||
generation: {
|
||||
activeSessionId: puzzleSession?.sessionId,
|
||||
hasActiveGenerationFailure:
|
||||
activeGenerationState?.phase === 'failed',
|
||||
hasActiveGenerationFailure: activeGenerationState?.phase === 'failed',
|
||||
hasActiveGenerationRunning: isMiniGameDraftGenerating(
|
||||
activeGenerationState ?? null,
|
||||
),
|
||||
@@ -11684,9 +11788,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
const failedError = backgroundTask?.error ?? openIntent.errorMessage;
|
||||
if (!failedSession) {
|
||||
try {
|
||||
const { session: latestSession } = await getPuzzleAgentSession(
|
||||
sourceSessionId,
|
||||
);
|
||||
const { session: latestSession } =
|
||||
await getPuzzleAgentSession(sourceSessionId);
|
||||
failedSession = latestSession;
|
||||
failedPayload = buildPuzzleFormPayloadFromSession(latestSession);
|
||||
} catch {
|
||||
@@ -11769,9 +11872,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
|
||||
if (openIntent.type === 'restore-generating') {
|
||||
try {
|
||||
const { session: latestSession } = await getPuzzleAgentSession(
|
||||
sourceSessionId,
|
||||
);
|
||||
const { session: latestSession } =
|
||||
await getPuzzleAgentSession(sourceSessionId);
|
||||
const payload = buildPuzzleFormPayloadFromSession(latestSession);
|
||||
const startedAtMs = resolveMiniGameDraftGenerationStartedAtMs(
|
||||
latestSession.updatedAt,
|
||||
@@ -11820,9 +11922,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
|
||||
markDraftNoticeSeen(noticeKeys);
|
||||
|
||||
const restoredSession = await puzzleFlow.restoreDraft(
|
||||
sourceSessionId,
|
||||
);
|
||||
const restoredSession = await puzzleFlow.restoreDraft(sourceSessionId);
|
||||
if (!restoredSession) {
|
||||
await refreshPuzzleShelf().catch(() => undefined);
|
||||
return;
|
||||
@@ -11870,8 +11970,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
forceDraft: options.forceDraft,
|
||||
generation: {
|
||||
activeSessionId: match3dSession?.sessionId,
|
||||
hasActiveGenerationFailure:
|
||||
activeGenerationState?.phase === 'failed',
|
||||
hasActiveGenerationFailure: activeGenerationState?.phase === 'failed',
|
||||
hasActiveGenerationRunning: isMiniGameDraftGenerating(
|
||||
activeGenerationState ?? null,
|
||||
),
|
||||
@@ -12066,9 +12165,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
|
||||
markDraftNoticeSeen(noticeKeys);
|
||||
|
||||
const restoredSession = await match3dFlow.restoreDraft(
|
||||
sourceSessionId,
|
||||
);
|
||||
const restoredSession = await match3dFlow.restoreDraft(sourceSessionId);
|
||||
if (!restoredSession) {
|
||||
await refreshMatch3DShelf().catch(() => undefined);
|
||||
return;
|
||||
@@ -13517,8 +13614,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
activeRecommendEntryKey && !isDesktopLayout
|
||||
? (recommendRuntimeEntries.find(
|
||||
(entry) =>
|
||||
getPlatformPublicGalleryEntryKey(entry) ===
|
||||
activeRecommendEntryKey,
|
||||
getPlatformPublicGalleryEntryKey(entry) === activeRecommendEntryKey,
|
||||
) ?? null)
|
||||
: null;
|
||||
const isActiveRecommendRuntimeReady =
|
||||
@@ -13534,7 +13630,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
hasVisualNovelRun: Boolean(visualNovelRun),
|
||||
hasWoodenFishRun: Boolean(woodenFishRun),
|
||||
puzzleRunEntryProfileId: puzzleRun?.entryProfileId ?? null,
|
||||
puzzleRunCurrentLevelProfileId: puzzleRun?.currentLevel?.profileId ?? null,
|
||||
puzzleRunCurrentLevelProfileId:
|
||||
puzzleRun?.currentLevel?.profileId ?? null,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -13608,7 +13705,10 @@ export function PlatformEntryFlowShellImpl({
|
||||
setIsPublicWorkDetailBusy(true);
|
||||
setPublicWorkDetailError(null);
|
||||
|
||||
const intent = resolvePlatformPublicWorkRemixIntent(entry);
|
||||
const intent = resolvePlatformPublicWorkRemixIntent(
|
||||
entry,
|
||||
publicWorkInteractions,
|
||||
);
|
||||
|
||||
if (intent.type === 'remix-big-fish') {
|
||||
void remixBigFishGalleryWork(intent.profileId)
|
||||
@@ -13683,6 +13783,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
isPublicWorkDetailBusy,
|
||||
platformBootstrap,
|
||||
puzzleFlow,
|
||||
publicWorkInteractions,
|
||||
resetRecommendRuntimeSelection,
|
||||
resolveBigFishErrorMessage,
|
||||
resolvePuzzleErrorMessage,
|
||||
@@ -13899,10 +14000,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
const detailEntry = mapPuzzleClearWorkToPlatformGalleryCard(entry);
|
||||
return (
|
||||
canExposePublicWork(detailEntry) &&
|
||||
isSamePuzzleClearPublicWorkCode(
|
||||
normalizedKeyword,
|
||||
entry.profileId,
|
||||
)
|
||||
isSamePuzzleClearPublicWorkCode(normalizedKeyword, entry.profileId)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -14202,16 +14300,20 @@ export function PlatformEntryFlowShellImpl({
|
||||
|
||||
useEffect(() => {
|
||||
const publicWorkCode = initialPublicWorkCode?.trim();
|
||||
if (
|
||||
!publicWorkCode ||
|
||||
handledInitialPublicWorkCodeRef.current === publicWorkCode
|
||||
) {
|
||||
if (!publicWorkCode) {
|
||||
return;
|
||||
}
|
||||
if (selectionStage === 'jump-hop-runtime') {
|
||||
handledInitialPublicWorkCodeRef.current = publicWorkCode;
|
||||
return;
|
||||
}
|
||||
if (handledInitialPublicWorkCodeRef.current === publicWorkCode) {
|
||||
return;
|
||||
}
|
||||
|
||||
handledInitialPublicWorkCodeRef.current = publicWorkCode;
|
||||
void handlePublicCodeSearch(publicWorkCode);
|
||||
}, [handlePublicCodeSearch, initialPublicWorkCode]);
|
||||
}, [handlePublicCodeSearch, initialPublicWorkCode, selectionStage]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectionStage === 'platform') {
|
||||
@@ -14323,7 +14425,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
jumpHopItems: isJumpHopCreationVisible ? jumpHopShelfItems : [],
|
||||
woodenFishItems: woodenFishShelfItems,
|
||||
match3dItems: match3dShelfItems,
|
||||
squareHoleItems: isSquareHoleCreationVisible ? squareHoleShelfItems : [],
|
||||
squareHoleItems: isSquareHoleCreationVisible
|
||||
? squareHoleShelfItems
|
||||
: [],
|
||||
puzzleItems: puzzleShelfItems,
|
||||
babyObjectMatchItems: isBabyObjectMatchVisible
|
||||
? babyObjectMatchDrafts
|
||||
@@ -14555,7 +14659,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
puzzleShelfError ??
|
||||
puzzleError ??
|
||||
(isVisualNovelCreationOpen ? visualNovelError : null) ??
|
||||
babyObjectMatchError ??
|
||||
babyObjectMatchError ??
|
||||
puzzleClearError ??
|
||||
barkBattleError)
|
||||
}
|
||||
@@ -15963,7 +16067,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
profile={jumpHopWork}
|
||||
isBusy={isJumpHopBusy}
|
||||
error={jumpHopError}
|
||||
runtimeRequestOptions={jumpHopRuntimeRequestOptions ?? undefined}
|
||||
runtimeRequestOptions={
|
||||
jumpHopRuntimeRequestOptions ?? undefined
|
||||
}
|
||||
onBack={() => {
|
||||
setSelectionStage(jumpHopRuntimeReturnStage);
|
||||
}}
|
||||
@@ -16423,7 +16529,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
<UnifiedCreationPage
|
||||
spec={getUnifiedSpec('visual-novel')}
|
||||
onBack={leaveVisualNovelFlow}
|
||||
isBackDisabled={isVisualNovelBusy || isVisualNovelStreamingReply}
|
||||
isBackDisabled={
|
||||
isVisualNovelBusy || isVisualNovelStreamingReply
|
||||
}
|
||||
>
|
||||
<VisualNovelAgentWorkspace
|
||||
session={visualNovelSession}
|
||||
|
||||
@@ -899,6 +899,23 @@ test('platform public work detail flow resolves like intent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('platform public work detail flow respects configured like disable', () => {
|
||||
expect(
|
||||
resolvePlatformPublicWorkLikeIntent(buildTypedEntry('puzzle'), [
|
||||
{
|
||||
sourceType: 'puzzle',
|
||||
likeEnabled: false,
|
||||
remixEnabled: true,
|
||||
likeDisabledMessage: '拼图点赞维护中。',
|
||||
remixDisabledMessage: '拼图改造维护中。',
|
||||
},
|
||||
]),
|
||||
).toEqual({
|
||||
type: 'unsupported',
|
||||
errorMessage: '拼图点赞维护中。',
|
||||
});
|
||||
});
|
||||
|
||||
test('platform public work detail flow resolves remix intent', () => {
|
||||
expect(
|
||||
resolvePlatformPublicWorkRemixIntent(buildTypedEntry('big-fish')),
|
||||
@@ -969,13 +986,31 @@ test('platform public work detail flow resolves remix intent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('platform public work detail flow respects configured remix disable', () => {
|
||||
expect(
|
||||
resolvePlatformPublicWorkRemixIntent(buildRpgEntry(), [
|
||||
{
|
||||
sourceType: 'custom-world',
|
||||
likeEnabled: true,
|
||||
remixEnabled: false,
|
||||
likeDisabledMessage: 'RPG 点赞维护中。',
|
||||
remixDisabledMessage: 'RPG 改造维护中。',
|
||||
},
|
||||
]),
|
||||
).toEqual({
|
||||
type: 'unsupported',
|
||||
errorMessage: 'RPG 改造维护中。',
|
||||
});
|
||||
});
|
||||
|
||||
test('platform public work detail flow resolves edit intent for draft-backed works', () => {
|
||||
const bigFishEntry = buildTypedEntry('big-fish');
|
||||
expect(resolvePlatformPublicWorkEditIntent(bigFishEntry, buildEditIntentDeps()))
|
||||
.toEqual({
|
||||
type: 'edit-big-fish',
|
||||
work: mapPublicWorkDetailToBigFishWork(bigFishEntry),
|
||||
});
|
||||
expect(
|
||||
resolvePlatformPublicWorkEditIntent(bigFishEntry, buildEditIntentDeps()),
|
||||
).toEqual({
|
||||
type: 'edit-big-fish',
|
||||
work: mapPublicWorkDetailToBigFishWork(bigFishEntry),
|
||||
});
|
||||
|
||||
const selectedPuzzleDetail = buildPuzzleWork({
|
||||
profileId: 'puzzle-profile',
|
||||
@@ -1153,7 +1188,10 @@ test('platform public work detail flow resolves edit intent for unsupported and
|
||||
|
||||
const edutainmentEntry = buildTypedEntry('edutainment');
|
||||
expect(
|
||||
resolvePlatformPublicWorkEditIntent(edutainmentEntry, buildEditIntentDeps()),
|
||||
resolvePlatformPublicWorkEditIntent(
|
||||
edutainmentEntry,
|
||||
buildEditIntentDeps(),
|
||||
),
|
||||
).toEqual({
|
||||
type: 'resolve-edutainment-draft',
|
||||
entry: edutainmentEntry,
|
||||
|
||||
@@ -97,6 +97,14 @@ export type PlatformPublicWorkDetailOpenStrategy =
|
||||
|
||||
export type PlatformPublicWorkActionMode = 'edit' | 'remix';
|
||||
|
||||
export type PlatformPublicWorkInteractionConfig = {
|
||||
sourceType: string;
|
||||
likeEnabled: boolean;
|
||||
remixEnabled: boolean;
|
||||
likeDisabledMessage: string;
|
||||
remixDisabledMessage: string;
|
||||
};
|
||||
|
||||
export type PlatformPublicWorkLikeIntent =
|
||||
| {
|
||||
type: 'like-big-fish';
|
||||
@@ -678,9 +686,55 @@ export function resolvePlatformPublicWorkActionMode(
|
||||
: 'remix';
|
||||
}
|
||||
|
||||
export function getPlatformPublicWorkInteractionSourceType(
|
||||
entry: PlatformPublicGalleryCard,
|
||||
) {
|
||||
return 'sourceType' in entry ? entry.sourceType : 'custom-world';
|
||||
}
|
||||
|
||||
function resolveConfiguredPublicWorkInteractionBlock(
|
||||
entry: PlatformPublicGalleryCard,
|
||||
configs: readonly PlatformPublicWorkInteractionConfig[] | null | undefined,
|
||||
action: 'like' | 'remix',
|
||||
): PlatformPublicWorkLikeIntent | PlatformPublicWorkRemixIntent | null {
|
||||
const sourceType = getPlatformPublicWorkInteractionSourceType(entry);
|
||||
const config = configs?.find((item) => item.sourceType === sourceType);
|
||||
if (!config) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (action === 'like' && !config.likeEnabled) {
|
||||
return {
|
||||
type: 'unsupported',
|
||||
errorMessage:
|
||||
config.likeDisabledMessage.trim() || '该作品类型暂不支持点赞。',
|
||||
};
|
||||
}
|
||||
|
||||
if (action === 'remix' && !config.remixEnabled) {
|
||||
return {
|
||||
type: 'unsupported',
|
||||
errorMessage:
|
||||
config.remixDisabledMessage.trim() || '该作品类型暂不支持改造。',
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function resolvePlatformPublicWorkLikeIntent(
|
||||
entry: PlatformPublicGalleryCard,
|
||||
configs?: readonly PlatformPublicWorkInteractionConfig[] | null,
|
||||
): PlatformPublicWorkLikeIntent {
|
||||
const configuredBlock = resolveConfiguredPublicWorkInteractionBlock(
|
||||
entry,
|
||||
configs,
|
||||
'like',
|
||||
);
|
||||
if (configuredBlock) {
|
||||
return configuredBlock as PlatformPublicWorkLikeIntent;
|
||||
}
|
||||
|
||||
if (isBigFishGalleryEntry(entry)) {
|
||||
return {
|
||||
type: 'like-big-fish',
|
||||
@@ -760,7 +814,17 @@ export function resolvePlatformPublicWorkLikeIntent(
|
||||
|
||||
export function resolvePlatformPublicWorkRemixIntent(
|
||||
entry: PlatformPublicGalleryCard,
|
||||
configs?: readonly PlatformPublicWorkInteractionConfig[] | null,
|
||||
): PlatformPublicWorkRemixIntent {
|
||||
const configuredBlock = resolveConfiguredPublicWorkInteractionBlock(
|
||||
entry,
|
||||
configs,
|
||||
'remix',
|
||||
);
|
||||
if (configuredBlock) {
|
||||
return configuredBlock as PlatformPublicWorkRemixIntent;
|
||||
}
|
||||
|
||||
if (isBigFishGalleryEntry(entry)) {
|
||||
return {
|
||||
type: 'remix-big-fish',
|
||||
@@ -933,8 +997,9 @@ export function resolvePlatformPublicWorkEditIntent(
|
||||
|
||||
if (isVisualNovelGalleryEntry(entry)) {
|
||||
const work =
|
||||
deps.visualNovelWorks?.find((item) => item.profileId === entry.profileId) ??
|
||||
null;
|
||||
deps.visualNovelWorks?.find(
|
||||
(item) => item.profileId === entry.profileId,
|
||||
) ?? null;
|
||||
if (!work) {
|
||||
return {
|
||||
type: 'blocked',
|
||||
|
||||
Reference in New Issue
Block a user