refactor: 收口公开作品流聚合

This commit is contained in:
2026-06-04 04:18:16 +08:00
parent c31676a0e1
commit df17f51edf
6 changed files with 345 additions and 114 deletions

View File

@@ -361,12 +361,7 @@ import {
isEdutainmentGalleryEntry,
mapBabyObjectMatchDraftToPlatformGalleryCard,
mapBarkBattleWorkToPlatformGalleryCard,
mapBigFishWorkToPlatformGalleryCard,
mapJumpHopWorkToPlatformGalleryCard,
mapPuzzleWorkToPlatformGalleryCard,
mapSquareHoleWorkToPlatformGalleryCard,
mapVisualNovelWorkToPlatformGalleryCard,
mapWoodenFishWorkToPlatformGalleryCard,
type PlatformPublicGalleryCard,
resolvePlatformPublicWorkCode,
} from '../rpg-entry/rpgEntryWorldPresentation';
@@ -551,11 +546,11 @@ import {
resolvePlatformPublicCodeSearchPlan,
} from './platformPublicCodeSearchModel';
import {
buildPlatformPublicGalleryFeeds,
getPlatformPublicGalleryEntryKey,
getPlatformRecommendRuntimeKind,
isPlatformRecommendRuntimeReadyForEntry,
isSamePlatformPublicGalleryEntry,
mergePlatformPublicGalleryEntries,
type RecommendRuntimeKind,
resolvePlatformRecommendRuntimeStartIntent,
} from './platformPublicGalleryFlow';
@@ -2795,123 +2790,43 @@ export function PlatformEntryFlowShellImpl({
agentResultPreview?.source,
);
}, [agentResultPreview]);
const featuredGalleryEntries = useMemo(() => {
const bigFishPublicEntries = isBigFishCreationVisible
? bigFishGalleryEntries.map(mapBigFishWorkToPlatformGalleryCard)
: [];
const babyObjectMatchPublicEntries = isBabyObjectMatchVisible
? babyObjectMatchDrafts
.filter((draft) => draft.publicationStatus === 'published')
.map(mapBabyObjectMatchDraftToPlatformGalleryCard)
: [];
const match3dPublicEntries = match3dGalleryEntries.map(
mapMatch3DWorkToPublicWorkDetail,
);
const puzzlePublicEntries = puzzleGalleryEntries.map(
mapPuzzleWorkToPlatformGalleryCard,
);
const barkBattlePublicEntries =
barkBattleGalleryEntries.length > 0
? barkBattleGalleryEntries.map(mapBarkBattleWorkToPlatformGalleryCard)
: barkBattleWorks
.filter((work) => work.status === 'published')
.map(mapBarkBattleWorkToPlatformGalleryCard);
const squareHolePublicEntries = squareHoleGalleryEntries.map(
mapSquareHoleWorkToPlatformGalleryCard,
);
const jumpHopPublicEntries = jumpHopGalleryEntries.map(
mapJumpHopWorkToPlatformGalleryCard,
);
const woodenFishPublicEntries = woodenFishGalleryEntries.map(
mapWoodenFishWorkToPlatformGalleryCard,
);
const visualNovelPublicEntries = visualNovelGalleryEntries.map(
mapVisualNovelWorkToPlatformGalleryCard,
);
return mergePlatformPublicGalleryEntries(
platformBootstrap.publishedGalleryEntries,
[
...bigFishPublicEntries,
...match3dPublicEntries,
...puzzlePublicEntries,
...barkBattlePublicEntries,
...squareHolePublicEntries,
...jumpHopPublicEntries,
...woodenFishPublicEntries,
...(isVisualNovelCreationOpen ? visualNovelPublicEntries : []),
...babyObjectMatchPublicEntries,
],
).slice(0, 6);
}, [
babyObjectMatchDrafts,
isBigFishCreationVisible,
isBabyObjectMatchVisible,
isVisualNovelCreationOpen,
bigFishGalleryEntries,
jumpHopGalleryEntries,
match3dGalleryEntries,
platformBootstrap.publishedGalleryEntries,
puzzleGalleryEntries,
barkBattleGalleryEntries,
barkBattleWorks,
squareHoleGalleryEntries,
visualNovelGalleryEntries,
woodenFishGalleryEntries,
]);
const latestGalleryEntries = useMemo(
const publicGalleryFeeds = useMemo(
() =>
mergePlatformPublicGalleryEntries(
platformBootstrap.publishedGalleryEntries,
[
...(isBigFishCreationVisible
? bigFishGalleryEntries.map(mapBigFishWorkToPlatformGalleryCard)
: []),
...match3dGalleryEntries.map(mapMatch3DWorkToPublicWorkDetail),
...puzzleGalleryEntries.map(mapPuzzleWorkToPlatformGalleryCard),
...barkBattleGalleryEntries.map(
mapBarkBattleWorkToPlatformGalleryCard,
),
...jumpHopGalleryEntries.map(mapJumpHopWorkToPlatformGalleryCard),
...(barkBattleGalleryEntries.length === 0
? barkBattleWorks
.filter((work) => work.status === 'published')
.map(mapBarkBattleWorkToPlatformGalleryCard)
: []),
...woodenFishGalleryEntries.map(
mapWoodenFishWorkToPlatformGalleryCard,
),
...squareHoleGalleryEntries.map(
mapSquareHoleWorkToPlatformGalleryCard,
),
...(isVisualNovelCreationOpen
? visualNovelGalleryEntries.map(
mapVisualNovelWorkToPlatformGalleryCard,
)
: []),
...(isBabyObjectMatchVisible
? babyObjectMatchDrafts
.filter((draft) => draft.publicationStatus === 'published')
.map(mapBabyObjectMatchDraftToPlatformGalleryCard)
: []),
],
),
buildPlatformPublicGalleryFeeds({
rpgEntries: platformBootstrap.publishedGalleryEntries,
bigFishEntries: bigFishGalleryEntries,
match3dEntries: match3dGalleryEntries,
puzzleEntries: puzzleGalleryEntries,
barkBattleGalleryEntries,
barkBattleWorks,
jumpHopEntries: jumpHopGalleryEntries,
woodenFishEntries: woodenFishGalleryEntries,
squareHoleEntries: squareHoleGalleryEntries,
visualNovelEntries: visualNovelGalleryEntries,
babyObjectMatchDrafts,
isBigFishCreationVisible,
isBabyObjectMatchVisible,
isVisualNovelCreationOpen,
}),
[
babyObjectMatchDrafts,
barkBattleGalleryEntries,
barkBattleWorks,
bigFishGalleryEntries,
isBabyObjectMatchVisible,
isBigFishCreationVisible,
isVisualNovelCreationOpen,
bigFishGalleryEntries,
jumpHopGalleryEntries,
match3dGalleryEntries,
platformBootstrap.publishedGalleryEntries,
puzzleGalleryEntries,
squareHoleGalleryEntries,
visualNovelGalleryEntries,
barkBattleGalleryEntries,
barkBattleWorks,
woodenFishGalleryEntries,
],
);
const { featuredEntries: featuredGalleryEntries, latestEntries: latestGalleryEntries } =
publicGalleryFeeds;
const recommendRuntimeEntries = useMemo(
() =>
buildPlatformRecommendFeedEntries(