This commit is contained in:
2026-04-22 22:01:07 +08:00
parent d8716d70b0
commit b317c2a8ea
37 changed files with 1821 additions and 515 deletions

View File

@@ -74,6 +74,7 @@ import {
normalizeAgentBackedProfile,
resolveRpgCreationErrorMessage,
} from './platformEntryShared';
import type { PlatformCreationTypeId } from './platformEntryCreationTypes';
import type { PlatformEntryFlowShellProps } from './platformEntryTypes';
import { PlatformEntryWorldDetailView } from './PlatformEntryWorldDetailView';
import { usePlatformEntryBootstrap } from './usePlatformEntryBootstrap';
@@ -363,9 +364,9 @@ export function PlatformEntryFlowShellImpl({
[authUi],
);
const openCreationTypePicker = useCallback(() => {
const prepareCreationLaunch = useCallback(() => {
if (sessionController.isCreatingAgentSession) {
return;
return false;
}
if (!hasSavedGame) {
@@ -373,13 +374,21 @@ export function PlatformEntryFlowShellImpl({
}
sessionController.setCreationTypeError(null);
setShowCreationTypeModal(true);
return true;
}, [
handleStartNewGame,
hasSavedGame,
sessionController,
]);
const openCreationTypePicker = useCallback(() => {
if (!prepareCreationLaunch()) {
return;
}
setShowCreationTypeModal(true);
}, [prepareCreationLaunch]);
const resolveBigFishErrorMessage = useCallback(
(error: unknown, fallback: string) =>
resolveRpgCreationErrorMessage(error, fallback),
@@ -466,6 +475,45 @@ export function PlatformEntryFlowShellImpl({
setSelectionStage,
]);
const handleCreationHubCreateType = useCallback(
(type: PlatformCreationTypeId) => {
if (type === 'airp' || type === 'visual-novel') {
return;
}
if (!prepareCreationLaunch()) {
return;
}
if (type === 'rpg') {
runProtectedAction(() => {
void sessionController.openRpgAgentWorkspace();
});
return;
}
if (type === 'big-fish') {
runProtectedAction(() => {
void openBigFishAgentWorkspace();
});
return;
}
if (type === 'puzzle') {
runProtectedAction(() => {
void openPuzzleAgentWorkspace();
});
}
},
[
openBigFishAgentWorkspace,
openPuzzleAgentWorkspace,
prepareCreationLaunch,
runProtectedAction,
sessionController,
],
);
const leaveBigFishFlow = useCallback(() => {
setBigFishError(null);
setBigFishRun(null);
@@ -925,9 +973,6 @@ export function PlatformEntryFlowShellImpl({
sessionController.creationTypeError ??
puzzleError
}
onBack={() => {
platformBootstrap.setPlatformTab('home');
}}
onRetry={() => {
platformBootstrap.setPlatformError(null);
void platformBootstrap.refreshCustomWorldWorks().catch((error) => {
@@ -936,7 +981,11 @@ export function PlatformEntryFlowShellImpl({
);
});
}}
onCreateNew={openCreationTypePicker}
createError={sessionController.creationTypeError ?? bigFishError ?? puzzleError}
createBusy={
sessionController.isCreatingAgentSession || isBigFishBusy || isPuzzleBusy
}
onCreateType={handleCreationHubCreateType}
onOpenDraft={(item) => {
runProtectedAction(() => {
void detailNavigation.handleOpenCreationWork(item);