This commit is contained in:
2026-04-28 20:25:37 +08:00
parent f0471a4f8d
commit 0f013b6eee
45 changed files with 1117 additions and 1047 deletions

View File

@@ -1,7 +1,7 @@
import { ArrowRight } from 'lucide-react';
import { UnifiedModal } from '../common/UnifiedModal';
import { PLATFORM_CREATION_TYPES } from './platformEntryCreationTypes';
import { getVisiblePlatformCreationTypes } from './platformEntryCreationTypes';
export interface PlatformEntryCreationTypeModalProps {
isOpen: boolean;
@@ -14,7 +14,7 @@ export interface PlatformEntryCreationTypeModalProps {
}
function CreationTypeCard(props: {
item: (typeof PLATFORM_CREATION_TYPES)[number];
item: ReturnType<typeof getVisiblePlatformCreationTypes>[number];
busy: boolean;
onSelect: () => void;
}) {
@@ -81,9 +81,7 @@ export function PlatformEntryCreationTypeModal({
// 平台入口只渲染当前允许展示的创作类型;
// 被隐藏的玩法仍保留既有实现与路由,不在这里删除能力本体。
const visibleCreationTypes = PLATFORM_CREATION_TYPES.filter(
(item) => !item.hidden,
);
const visibleCreationTypes = getVisiblePlatformCreationTypes();
return (
<UnifiedModal

View File

@@ -122,6 +122,7 @@ import { useRpgCreationResultAutosave } from '../rpg-entry/useRpgCreationResultA
import { useRpgCreationSessionController } from '../rpg-entry/useRpgCreationSessionController';
import { PlatformEntryCreationTypeModal } from './PlatformEntryCreationTypeModal';
import type { PlatformCreationTypeId } from './platformEntryCreationTypes';
import { isPlatformCreationTypeVisible } from './platformEntryCreationTypes';
import {
PlatformEntryHomeView,
type PlatformHomeTab,
@@ -473,6 +474,7 @@ export function PlatformEntryFlowShellImpl({
const [deletingCreationWorkId, setDeletingCreationWorkId] = useState<
string | null
>(null);
const isBigFishCreationVisible = isPlatformCreationTypeVisible('big-fish');
const hadReadableProtectedDataRef = useRef(false);
const hasInitialAgentSession = Boolean(
readCustomWorldAgentUiState().activeSessionId &&
@@ -660,7 +662,9 @@ export function PlatformEntryFlowShellImpl({
await Promise.allSettled([
platformBootstrap.refreshPublishedGallery(),
platformBootstrap.refreshCustomWorldWorks(),
refreshBigFishGallery(),
isBigFishCreationVisible
? refreshBigFishGallery()
: Promise.resolve([] as BigFishWorkSummary[]),
refreshPuzzleGallery(),
]);
return latestSession;
@@ -716,9 +720,9 @@ export function PlatformEntryFlowShellImpl({
}, [agentResultPreview]);
const featuredGalleryEntries = useMemo(() => {
const bigFishPublicEntries = bigFishGalleryEntries.map(
mapBigFishWorkToPlatformGalleryCard,
);
const bigFishPublicEntries = isBigFishCreationVisible
? bigFishGalleryEntries.map(mapBigFishWorkToPlatformGalleryCard)
: [];
const puzzlePublicEntries = puzzleGalleryEntries.map(
mapPuzzleWorkToPlatformGalleryCard,
);
@@ -727,6 +731,7 @@ export function PlatformEntryFlowShellImpl({
[...bigFishPublicEntries, ...puzzlePublicEntries],
).slice(0, 6);
}, [
isBigFishCreationVisible,
bigFishGalleryEntries,
platformBootstrap.publishedGalleryEntries,
puzzleGalleryEntries,
@@ -736,11 +741,14 @@ export function PlatformEntryFlowShellImpl({
mergePlatformPublicGalleryEntries(
platformBootstrap.publishedGalleryEntries,
[
...bigFishGalleryEntries.map(mapBigFishWorkToPlatformGalleryCard),
...(isBigFishCreationVisible
? bigFishGalleryEntries.map(mapBigFishWorkToPlatformGalleryCard)
: []),
...puzzleGalleryEntries.map(mapPuzzleWorkToPlatformGalleryCard),
],
),
[
isBigFishCreationVisible,
bigFishGalleryEntries,
platformBootstrap.publishedGalleryEntries,
puzzleGalleryEntries,
@@ -986,7 +994,6 @@ export function PlatformEntryFlowShellImpl({
const bigFishError = bigFishFlow.error;
const setBigFishError = bigFishFlow.setError;
const isBigFishBusy = bigFishFlow.isBusy;
const setIsBigFishBusy = bigFishFlow.setIsBusy;
const streamingBigFishReplyText = bigFishFlow.streamingReplyText;
const isStreamingBigFishReply = bigFishFlow.isStreamingReply;
@@ -1892,10 +1899,17 @@ export function PlatformEntryFlowShellImpl({
useEffect(() => {
if (selectionStage === 'platform') {
void refreshBigFishGallery();
if (isBigFishCreationVisible) {
void refreshBigFishGallery();
}
void refreshPuzzleGallery();
}
}, [refreshBigFishGallery, refreshPuzzleGallery, selectionStage]);
}, [
isBigFishCreationVisible,
refreshBigFishGallery,
refreshPuzzleGallery,
selectionStage,
]);
useEffect(() => {
if (
@@ -1914,6 +1928,7 @@ export function PlatformEntryFlowShellImpl({
useEffect(() => {
if (
isBigFishCreationVisible &&
(platformBootstrap.platformTab === 'create' ||
selectionStage === 'platform') &&
platformBootstrap.canReadProtectedData
@@ -1921,6 +1936,7 @@ export function PlatformEntryFlowShellImpl({
void refreshBigFishShelf();
}
}, [
isBigFishCreationVisible,
platformBootstrap.canReadProtectedData,
platformBootstrap.platformTab,
refreshBigFishShelf,
@@ -1955,7 +1971,9 @@ export function PlatformEntryFlowShellImpl({
resolveRpgCreationErrorMessage(error, '读取创作作品列表失败。'),
);
});
void refreshBigFishShelf();
if (isBigFishCreationVisible) {
void refreshBigFishShelf();
}
void refreshPuzzleShelf();
}}
createError={
@@ -1991,20 +2009,32 @@ export function PlatformEntryFlowShellImpl({
handleExperienceRpgWork(item);
}}
rpgLibraryEntries={platformBootstrap.savedCustomWorldEntries}
bigFishItems={bigFishWorks}
onOpenBigFishDetail={(item) => {
runProtectedAction(() => {
void openBigFishDraft(item);
});
}}
onExperienceBigFish={(item) => {
runProtectedAction(() => {
void startBigFishRunFromWork(item);
});
}}
onDeleteBigFish={(item) => {
handleDeleteBigFishWork(item);
}}
bigFishItems={isBigFishCreationVisible ? bigFishWorks : []}
onOpenBigFishDetail={
isBigFishCreationVisible
? (item) => {
runProtectedAction(() => {
void openBigFishDraft(item);
});
}
: undefined
}
onExperienceBigFish={
isBigFishCreationVisible
? (item) => {
runProtectedAction(() => {
void startBigFishRunFromWork(item);
});
}
: null
}
onDeleteBigFish={
isBigFishCreationVisible
? (item) => {
handleDeleteBigFishWork(item);
}
: null
}
puzzleItems={puzzleWorks}
onOpenPuzzleDetail={(item) => {
runProtectedAction(() => {

View File

@@ -14,6 +14,21 @@ export type PlatformCreationTypeCard = {
hidden?: boolean;
};
/**
* 返回当前平台入口允许展示的创作类型。
* 平台层的入口、首屏卡带与初始化请求都应基于这份结果统一判断。
*/
export function getVisiblePlatformCreationTypes() {
return PLATFORM_CREATION_TYPES.filter((item) => !item.hidden);
}
/**
* 判断某个创作类型当前是否仍暴露在平台入口中。
*/
export function isPlatformCreationTypeVisible(id: PlatformCreationTypeId) {
return PLATFORM_CREATION_TYPES.some((item) => item.id === id && !item.hidden);
}
/**
* 创作页与类型弹层共用同一份模板元数据,避免多入口文案和可用状态漂移。
* `hidden` 只控制平台入口是否展示,不影响既有玩法链路和路由能力。