refactor: 收口创作作品架Hub接口
This commit is contained in:
@@ -14733,6 +14733,161 @@ export function PlatformEntryFlowShellImpl({
|
||||
selectionStage,
|
||||
]);
|
||||
|
||||
const creationHubShelfItems = useMemo(
|
||||
() =>
|
||||
buildCreationWorkShelfItems({
|
||||
rpgItems: creationHubItems,
|
||||
rpgLibraryEntries: platformBootstrap.savedCustomWorldEntries,
|
||||
bigFishItems: isBigFishCreationVisible ? bigFishShelfItems : [],
|
||||
jumpHopItems: isJumpHopCreationVisible ? jumpHopShelfItems : [],
|
||||
woodenFishItems: woodenFishShelfItems,
|
||||
match3dItems: match3dShelfItems,
|
||||
squareHoleItems: isSquareHoleCreationVisible ? squareHoleShelfItems : [],
|
||||
puzzleItems: puzzleShelfItems,
|
||||
babyObjectMatchItems: isBabyObjectMatchVisible
|
||||
? babyObjectMatchDrafts
|
||||
: [],
|
||||
barkBattleItems: barkBattleShelfItems,
|
||||
visualNovelItems: visualNovelShelfItems,
|
||||
canDeleteRpg: true,
|
||||
canDeleteBigFish: isBigFishCreationVisible,
|
||||
canDeleteMatch3D: true,
|
||||
canDeleteSquareHole: isSquareHoleCreationVisible,
|
||||
canDeletePuzzle: true,
|
||||
canDeleteBabyObjectMatch: isBabyObjectMatchVisible,
|
||||
canDeleteVisualNovel: true,
|
||||
onOpenRpgDraft: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void detailNavigation.handleOpenCreationWork(item);
|
||||
});
|
||||
},
|
||||
onEnterRpgPublished: (profileId) => {
|
||||
runProtectedAction(() => {
|
||||
const matchedWork = creationHubItems.find(
|
||||
(entry) => entry.profileId === profileId,
|
||||
);
|
||||
if (!matchedWork) {
|
||||
return;
|
||||
}
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void detailNavigation.handleOpenCreationWork(matchedWork);
|
||||
});
|
||||
},
|
||||
onDeleteRpg: handleDeletePublishedWork,
|
||||
onOpenBigFishDetail: isBigFishCreationVisible
|
||||
? (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openBigFishDraft(item);
|
||||
});
|
||||
}
|
||||
: undefined,
|
||||
onDeleteBigFish: isBigFishCreationVisible
|
||||
? handleDeleteBigFishWork
|
||||
: undefined,
|
||||
onOpenJumpHopDetail: isJumpHopCreationVisible
|
||||
? (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openJumpHopDraft(item);
|
||||
});
|
||||
}
|
||||
: undefined,
|
||||
onOpenWoodenFishDetail: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openWoodenFishDraft(item);
|
||||
});
|
||||
},
|
||||
onOpenMatch3DDetail: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openMatch3DDraft(item);
|
||||
});
|
||||
},
|
||||
onDeleteMatch3D: handleDeleteMatch3DWork,
|
||||
onOpenSquareHoleDetail: isSquareHoleCreationVisible
|
||||
? (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openSquareHoleDraft(item);
|
||||
});
|
||||
}
|
||||
: undefined,
|
||||
onDeleteSquareHole: isSquareHoleCreationVisible
|
||||
? handleDeleteSquareHoleWork
|
||||
: undefined,
|
||||
onOpenPuzzleDetail: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openPuzzleDraft(item);
|
||||
});
|
||||
},
|
||||
onDeletePuzzle: handleDeletePuzzleWork,
|
||||
onClaimPuzzlePointIncentive: handleClaimPuzzlePointIncentive,
|
||||
onOpenBabyObjectMatchDetail: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
openBabyObjectMatchDraft(item);
|
||||
});
|
||||
},
|
||||
onDeleteBabyObjectMatch: handleDeleteBabyObjectMatchWork,
|
||||
onOpenBarkBattleDetail: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
openBarkBattleDraft(item);
|
||||
});
|
||||
},
|
||||
onOpenVisualNovelDetail: (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openVisualNovelDraft(item);
|
||||
});
|
||||
},
|
||||
onDeleteVisualNovel: handleDeleteVisualNovelWork,
|
||||
getItemState: getCreationWorkShelfState,
|
||||
}),
|
||||
[
|
||||
barkBattleShelfItems,
|
||||
babyObjectMatchDrafts,
|
||||
bigFishShelfItems,
|
||||
creationHubItems,
|
||||
detailNavigation,
|
||||
getCreationWorkShelfState,
|
||||
handleClaimPuzzlePointIncentive,
|
||||
handleDeleteBabyObjectMatchWork,
|
||||
handleDeleteBigFishWork,
|
||||
handleDeleteMatch3DWork,
|
||||
handleDeletePublishedWork,
|
||||
handleDeletePuzzleWork,
|
||||
handleDeleteSquareHoleWork,
|
||||
handleDeleteVisualNovelWork,
|
||||
isBabyObjectMatchVisible,
|
||||
isBigFishCreationVisible,
|
||||
isJumpHopCreationVisible,
|
||||
isSquareHoleCreationVisible,
|
||||
jumpHopShelfItems,
|
||||
markCreationFlowReturnToDraftShelf,
|
||||
match3dShelfItems,
|
||||
openBabyObjectMatchDraft,
|
||||
openBarkBattleDraft,
|
||||
openBigFishDraft,
|
||||
openJumpHopDraft,
|
||||
openMatch3DDraft,
|
||||
openPuzzleDraft,
|
||||
openSquareHoleDraft,
|
||||
openVisualNovelDraft,
|
||||
openWoodenFishDraft,
|
||||
platformBootstrap.savedCustomWorldEntries,
|
||||
puzzleShelfItems,
|
||||
runProtectedAction,
|
||||
squareHoleShelfItems,
|
||||
visualNovelShelfItems,
|
||||
woodenFishShelfItems,
|
||||
],
|
||||
);
|
||||
|
||||
// 中文注释:最近创作必须由真实作品架/后端草稿摘要决定,不能混入本地生成中占位。
|
||||
const backendRecentCreationShelfItems = useMemo(
|
||||
() =>
|
||||
@@ -14781,7 +14936,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
{creationEntryConfig ? (
|
||||
<CustomWorldCreationHub
|
||||
mode={mode}
|
||||
items={creationHubItems}
|
||||
shelfItems={creationHubShelfItems}
|
||||
loading={
|
||||
platformBootstrap.isLoadingPlatform ||
|
||||
isBigFishLoadingLibrary ||
|
||||
@@ -14871,144 +15026,11 @@ export function PlatformEntryFlowShellImpl({
|
||||
creationTypes={creationEntryTypes}
|
||||
recentWorkItems={backendRecentCreationShelfItems}
|
||||
onCreateType={handleCreationHubCreateType}
|
||||
getWorkState={getCreationWorkShelfState}
|
||||
onOpenShelfItem={(item) => {
|
||||
markDraftNoticeSeen(getGenerationNoticeShelfKeys(item));
|
||||
}}
|
||||
onOpenDraft={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void detailNavigation.handleOpenCreationWork(item);
|
||||
});
|
||||
}}
|
||||
onEnterPublished={(profileId) => {
|
||||
runProtectedAction(() => {
|
||||
const matchedWork = creationHubItems.find(
|
||||
(entry) => entry.profileId === profileId,
|
||||
);
|
||||
if (!matchedWork) {
|
||||
return;
|
||||
}
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void detailNavigation.handleOpenCreationWork(matchedWork);
|
||||
});
|
||||
}}
|
||||
onDeletePublished={(item) => {
|
||||
handleDeletePublishedWork(item);
|
||||
}}
|
||||
deletingWorkId={deletingCreationWorkId}
|
||||
rpgLibraryEntries={platformBootstrap.savedCustomWorldEntries}
|
||||
bigFishItems={isBigFishCreationVisible ? bigFishShelfItems : []}
|
||||
jumpHopItems={isJumpHopCreationVisible ? jumpHopShelfItems : []}
|
||||
woodenFishItems={woodenFishShelfItems}
|
||||
onOpenBigFishDetail={
|
||||
isBigFishCreationVisible
|
||||
? (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openBigFishDraft(item);
|
||||
});
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onOpenJumpHopDetail={
|
||||
isJumpHopCreationVisible
|
||||
? (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openJumpHopDraft(item);
|
||||
});
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onDeleteBigFish={
|
||||
isBigFishCreationVisible
|
||||
? (item) => {
|
||||
handleDeleteBigFishWork(item);
|
||||
}
|
||||
: null
|
||||
}
|
||||
onDeleteJumpHop={null}
|
||||
onOpenWoodenFishDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openWoodenFishDraft(item);
|
||||
});
|
||||
}}
|
||||
onDeleteWoodenFish={null}
|
||||
match3dItems={match3dShelfItems}
|
||||
onOpenMatch3DDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openMatch3DDraft(item);
|
||||
});
|
||||
}}
|
||||
onDeleteMatch3D={(item) => {
|
||||
handleDeleteMatch3DWork(item);
|
||||
}}
|
||||
squareHoleItems={
|
||||
isSquareHoleCreationVisible ? squareHoleShelfItems : []
|
||||
}
|
||||
onOpenSquareHoleDetail={
|
||||
isSquareHoleCreationVisible
|
||||
? (item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openSquareHoleDraft(item);
|
||||
});
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
onDeleteSquareHole={
|
||||
isSquareHoleCreationVisible
|
||||
? (item) => {
|
||||
handleDeleteSquareHoleWork(item);
|
||||
}
|
||||
: null
|
||||
}
|
||||
puzzleItems={puzzleShelfItems}
|
||||
onOpenPuzzleDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openPuzzleDraft(item);
|
||||
});
|
||||
}}
|
||||
onDeletePuzzle={(item) => {
|
||||
handleDeletePuzzleWork(item);
|
||||
}}
|
||||
onClaimPuzzlePointIncentive={(item) => {
|
||||
handleClaimPuzzlePointIncentive(item);
|
||||
}}
|
||||
claimingPuzzleProfileId={claimingPuzzlePointIncentiveProfileId}
|
||||
babyObjectMatchItems={
|
||||
isBabyObjectMatchVisible ? babyObjectMatchDrafts : []
|
||||
}
|
||||
onOpenBabyObjectMatchDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
openBabyObjectMatchDraft(item);
|
||||
});
|
||||
}}
|
||||
onDeleteBabyObjectMatch={(item) => {
|
||||
handleDeleteBabyObjectMatchWork(item);
|
||||
}}
|
||||
barkBattleItems={barkBattleShelfItems}
|
||||
onOpenBarkBattleDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
openBarkBattleDraft(item);
|
||||
});
|
||||
}}
|
||||
visualNovelItems={visualNovelShelfItems}
|
||||
onOpenVisualNovelDetail={(item) => {
|
||||
runProtectedAction(() => {
|
||||
markCreationFlowReturnToDraftShelf();
|
||||
void openVisualNovelDraft(item);
|
||||
});
|
||||
}}
|
||||
onDeleteVisualNovel={(item) => {
|
||||
handleDeleteVisualNovelWork(item);
|
||||
}}
|
||||
/>
|
||||
) : null}
|
||||
</Suspense>
|
||||
|
||||
Reference in New Issue
Block a user